# First build attempt error: "Command PhaseScriptExecution failed"

**URL:** <https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346>\
**Category:** macOS\
**Created:** [16 March 2021 18:40 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346 "2021-03-16T18:40:03Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [16 March 2021 18:40 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/1 "2021-03-16T18:40:03Z")

</div>

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:

```auto
  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?

---

<div class="post-metadata">

**Author:** ![Ric](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ric](https://iplug2.discourse.group/u/Ric)\
**Post date:** [17 March 2021 19:31 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/2 "2021-03-17T19:31:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [17 March 2021 20:31 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/3 "2021-03-17T20:31:17Z")

</div>

> [@Ric](#):
>
> maybe you need to upgrade Python?

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

---

<div class="post-metadata">

**Author:** ![Ric](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ric](https://iplug2.discourse.group/u/Ric)\
**Post date:** [18 March 2021 02:02 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/4 "2021-03-18T02:02:47Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [18 March 2021 16:38 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/5 "2021-03-18T16:38:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Ric](https://avatars.discourse-cdn.com/v4/letter/r/c77e96/32.png) [@Ric](https://iplug2.discourse.group/u/Ric)\
**Post date:** [18 March 2021 17:40 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/6 "2021-03-18T17:40:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [18 March 2021 19:50 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/7 "2021-03-18T19:50:47Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [21 March 2021 17:12 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/8 "2021-03-21T17:12:21Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [21 March 2021 18:49 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/9 "2021-03-21T18:49:05Z")

</div>

> [@Nonlinear](#):
>
> Xcode Advanced project settings

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [21 March 2021 18:56 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/10 "2021-03-21T18:56:41Z")

</div>

File-\>Project Settings-\>Advanced

---

<div class="post-metadata">

**Author:** ![olilarkin](https://yyz2.discourse-cdn.com/free1/user_avatar/iplug2.discourse.group/olilarkin/32/2_2.png) [@olilarkin](https://iplug2.discourse.group/u/olilarkin)\
**Post date:** [21 March 2021 19:05 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/11 "2021-03-21T19:05:10Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Nonlinear](https://avatars.discourse-cdn.com/v4/letter/n/ad7895/32.png) [@Nonlinear](https://iplug2.discourse.group/u/Nonlinear)\
**Post date:** [21 March 2021 19:07 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/12 "2021-03-21T19:07:54Z")

</div>

> [@olilarkin](#):
>
> 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

---

<div class="post-metadata">

**Author:** ![AlexHarker](https://avatars.discourse-cdn.com/v4/letter/a/9de053/32.png) [@AlexHarker](https://iplug2.discourse.group/u/AlexHarker)\
**Post date:** [27 March 2021 16:57 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/13 "2021-03-27T16:57:50Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ette](https://avatars.discourse-cdn.com/v4/letter/e/898d66/32.png) [@ette](https://iplug2.discourse.group/u/ette)\
**Post date:** [5 February 2024 11:06 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/14 "2024-02-05T11:06:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RexMartin2](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@RexMartin2](https://iplug2.discourse.group/u/RexMartin2)\
**Post date:** [5 February 2024 16:52 UTC](https://iplug2.discourse.group/t/first-build-attempt-error-command-phasescriptexecution-failed/346/15 "2024-02-05T16:52:13Z")

</div>

> [@ette](#):
>
> when I try to build, I got an error “Command PhaseScriptExecution failed with a nonzero exit code”

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.
