First build attempt error: "Command PhaseScriptExecution failed"

Often times on the first attempt to build my plugins, Xcode gives an error: “Command PhaseScriptExecution failed with a nonzero exit code” that has something to do with Python script not finding something. Example:

  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py", line 406, in parse
    parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: no element found: line 1, column 0
Command PhaseScriptExecution failed with a nonzero exit code

If I immediately click on Build a second time the project builds perfectly without any further errors.

Any idea what is causing that? Why does it fail the first time but then succeed immediately afterwards? Anyone else experienced this?

l’m using Xcode and l haven’t come across this error yet… maybe you need to upgrade Python?

Maybe, but I thought Python was part of Xcode/Mac OS?

Mmm… l can’t remember that…

at least I can tell you I’m using version 3.9 by now but I had to install it myself…

AFAIK, iPlug1/2 requires Python 2.7 specifically. If you loaded 3.9 yourself iPlug is probably using the 2.7 version that is still on your system.

I have removed and re-installed Xcode. We’ll see if that made any difference.

Oh l see… anyway, if it works fine after you build a second time then l suppose you can live with it… there’s always minor nuisances with Apple

I removed and re-installed Xcode 11 but I’m still getting this issue even with the iPlugControls example straight from the iPlug2 package.

The error keeps coming up due to the script prepare_resource-mac.py

Here’s a complete error message from iPlugControls:

PhaseScriptExecution Run\ Script\ -\ prepare_resources-mac.py /Users/MyMac/Library/Developer/Xcode/DerivedData/IPlugControls-macOS-gzjmmkwfycmqekfztnogcxyiffmq/Build/Intermediates.noindex/IPlugControls-macOS.build/Release/VST2.build/Script-4FBCC1B31FD5AE9F00EFE550.sh (in target ‘VST2’ from project ‘IPlugControls-macOS’)

cd /Users/MyMac/Documents/iPlug2/Examples/IPlugControls/projects

/bin/sh -c /Users/MyMac/Library/Developer/Xcode/DerivedData/IPlugControls-macOS-gzjmmkwfycmqekfztnogcxyiffmq/Build/Intermediates.noindex/IPlugControls-macOS.build/Release/VST2.build/Script-4FBCC1B31FD5AE9F00EFE550.sh

Copying resources …
copying slider-handle.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying knob-rotate.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying slider-track.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying slider-track@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying hslider-track.svg to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying switch@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying hslider-handle.svg to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying slider-track.svg to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying font@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying slider-handle@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying knob.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying slider-handle.svg to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying knob@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying font.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying vector-knob.svg to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying switch.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying button@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying knob-rotate@2x.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying button.png to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying Roboto-Regular.ttf to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying fontaudio.ttf to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources
copying forkawesome-webfont.ttf to /Library/Audio/Plug-Ins/VST/IPlugControls.vst/Contents/Resources

Processing Info.plist files…
Traceback (most recent call last):
File “…/scripts/prepare_resources-mac.py”, line 209, in
main()
File “…/scripts/prepare_resources-mac.py”, line 60, in main
vst3 = plistlib.readPlist(plistpath)
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py”, line 78, in readPlist
rootObject = p.parse(pathOrFile)
File “/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plistlib.py”, line 406, in parse
parser.ParseFile(fileobj)
xml.parsers.expat.ExpatError: no element found: line 1, column 0

Command PhaseScriptExecution failed with a nonzero exit code

SOLVED - the problem was that I had Xcode Advanced project settings “Build Location” set to “Xcode Default”. I changed that setting to “Legacy” and the problem does not occur. (In iPlug1 I had to use the opposite - Xcode Default - for some reason, Legacy caused issues).

Perhaps this could be posted as an FYI sticky?

Not sure which settings you are referring to, when I figure it out I can add something.

File->Project Settings->Advanced

OK, i open the workspace so didn’t see it. So did you change something here after cloning an IPlug2 project ?

No, it’s the main toolbar of Xcode. File->Project Settings->Per User Project Settings->Advanced

This is a setting for all of Xcode. I also regularly see this issue on Xcode 9 - the python often fails. In the past of turned off parallel builds to reduce this error, but would be good if we could fix it.

Hallo everybody,
Ihm still new here and with iplug2.
Ive followed the Hints on 01_Getting_started_mac_ios but when I try to build, I got an error “Command PhaseScriptExecution failed with a nonzero exit code”
“plistlib.InvalidFileException: Invalid file”

Working an MacOS 12.7.3 and Xcode 14.2
What´s wrong?
Ette

The problem is with the plist files. If you have already built the plugin once before sometimes the existing plist files in those builds prevents writing new ones when you try to compile again. Go to wherever your plugin files are being created (Pro Tools Plugins folder, Plugins components folder, etc.) and DELETE the previously plugin(s) from the previous build. Also make sure to “Clean” your Xcode project between builds.