# Error "copyplist failed with exit code 127"

**URL:** <https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199>\
**Category:** ruby-talk\
**Created:** [25 September 2010 08:23 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199 "2010-09-25T08:23:57Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samuel\_Sam](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@Samuel\_Sam](https://rubytalk.org/u/Samuel_Sam)\
**Post date:** [25 September 2010 08:23 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/1 "2010-09-25T08:23:57Z")

</div>

Morning everyone,

I'm not a ruby developer (using XCode) but facing an error which is  
coming from the ruby file "copyplist " locate under :  
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copylyst

The entire error message is :  
[code]  
sh: plutil: command not found  
Command  
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
failed with exit code 127  
[/code]

If needed I can provide you with the whole copylist code but here's the  
lines that call "plutil" word:  
[code]  
system('plutil -s -lint -- "' + srcPath + '"')  
...  
system('plutil -convert "' + OPTIONS[:OutputFormat] + '" -s -o "' +  
OPTIONS[:OutputDir] + '/' + File.basename(srcPath) + '" -- "' + srcPath  
+ '"')  
[/code]

My current understanding of this error is :  
- The ruby file "copylist" tries to access a Unix script "plutil"but  
can't find it.

That "plutil" file is located under: /usr/bin which apparently is in  
ruby path by default.  
I tried to add the line [code] Dir.chdir("/usr/bin") [/code] in  
"copylist" just before the two lines stated upper but still getting the  
same error.  
I also tried with "./plutil" which failed miserably providing an other  
error.

I hope that one of you can help me.  
Thanks in advance.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Markus\_Fischer](https://avatars.discourse-cdn.com/v4/letter/m/b782af/32.png) [@Markus\_Fischer](https://rubytalk.org/u/Markus_Fischer)\
**Post date:** [25 September 2010 09:09 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/2 "2010-09-25T09:09:51Z")

</div>

Hi,

> The entire error message is :  
> [code]  
> sh: plutil: command not found  
> Command  
> /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
> failed with exit code 127  
> [/code]

I'm not that acquainted with MacOSX but I realize plutil is an essential  
part of it.

So, we some basic checks: plutil is there and really works? I.e. "which  
plutil procudes /usr/bin/plutil ?

The $PATH environment variable from which ruby (!) is called contains  
/usr/bin/ (OK unlikely not to be, but needs check) ?

Does it work using an absolute path to /usr/bin/plutil in the copylist  
script?

Are the permission on /usr/bin/plutil properly set?

All in all it looks rather like a MacOSX issue then ruby, but I'm sure  
we will get there.

- Markus

---

<div class="post-metadata">

**Author:** ![Eric\_Christopherson](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/eric_christopherson/32/1849_2.png) [@Eric\_Christopherson](https://rubytalk.org/u/Eric_Christopherson)\
**Post date:** [25 September 2010 17:39 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/3 "2010-09-25T17:39:47Z")

</div>

> Morning everyone,
> 
> I'm not a ruby developer (using XCode) but facing an error which is  
> coming from the ruby file "copyplist " locate under :  
> /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copylyst
> 
> The entire error message is :  
> [code]  
> sh: plutil: command not found  
> Command  
> /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
> failed with exit code 127  
> [/code]
> 
> If needed I can provide you with the whole copylist code but here's the  
> lines that call "plutil" word:  
> [code]  
> system('plutil -s -lint -- "' + srcPath + '"')  
> ...  
> system('plutil -convert "' + OPTIONS[:OutputFormat] + '" -s -o "' +  
> OPTIONS[:OutputDir] + '/' + File.basename(srcPath) + '" -- "' + srcPath  
> + '"')  
> [/code]
> 
> My current understanding of this error is :  
> - The ruby file "copylist" tries to access a Unix script "plutil"but  
> can't find it.
> 
> That "plutil" file is located under: /usr/bin which apparently is in  
> ruby path by default.  
> I tried to add the line [code] Dir.chdir("/usr/bin") [/code] in  
> "copylist" just before the two lines stated upper but still getting the  
> same error.  
> I also tried with "./plutil" which failed miserably providing an other  
> error.

Have you tried changing it to /usr/bin/plutil? (Just a suggestion; I'm  
guessing that would do the same thing as your chdir+./plutil, but you  
never know.)

It appears other people are suffering this problem too. Maybe you  
should file a bug report with Apple (at either  
\<[Feedback Assistant](https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/wa/signIn&gt);  
or \<[http://developer.apple.com/bugreporter/&gt;](http://developer.apple.com/bugreporter/&gt;); I'm not sure what the  
difference is), then also do one at  
\<[http://openradar.appspot.com/page/1&gt](http://openradar.appspot.com/page/1&gt); (which is basically a site  
intended to work in tandem with Apple's bug tracker; OpenRadar allows  
users to search for existing bug reports, which the Apple one does not  
do).

> **···**
>
> On Sat, Sep 25, 2010 at 3:23 AM, Samuel Sam \<samuel13\_666@yahoo.fr\> wrote:
> 
> > I hope that one of you can help me.  
> > Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Samuel\_Sam](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@Samuel\_Sam](https://rubytalk.org/u/Samuel_Sam)\
**Post date:** [25 September 2010 09:24 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/4 "2010-09-25T09:24:38Z")

</div>

Hello Markus,

Yes! The "plutil" script does work correctly:  
[code]  
$ plutil  
No files specified.  
plutil: [command\_option] [other\_options] file...  
The file '-' means stdin  
Command options are (-lint is the default):  
-help show this message and exit  
-lint check the property list files for syntax errors  
-convert fmt rewrite property list files in format  
&nbsp;&nbsp;&nbsp;&nbsp;fmt is one of: xml1 binary1  
There are some additional optional arguments:  
-s be silent on success  
-o path specify alternate file path name for result;  
&nbsp;&nbsp;&nbsp;&nbsp;the -o option is used with -convert, and is only  
&nbsp;&nbsp;&nbsp;&nbsp;useful with one file argument (last file overwrites);  
&nbsp;&nbsp;&nbsp;&nbsp;the path '-' means stdout  
-e extension specify alternate extension for converted files  
-- specifies that all further arguments are file names  
$  
$ plutil test.plist  
test.plist: OK  
[code]

I tried to use the absolute path /usr/bin/plutil but then, ruby  
considered plutil as being a directory and not a file. Error received :  
[code]  
sh: line 0: cd: /usr/bin/plutil: Not a directory  
Command  
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
failed with exit code 1  
[/code]

I've also checked permissions which appear to be coorect :  
-rwxr-xr-x 1 root wheel 71648 11 avr 04:47 plutil

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Samuel\_Sam](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@Samuel\_Sam](https://rubytalk.org/u/Samuel_Sam)\
**Post date:** [26 September 2010 08:38 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/5 "2010-09-26T08:38:00Z")

</div>

Eric,

I tried to use the absolute path /usr/bin/plutil but then, ruby  
considered plutil as being a directory and not a file. Error received :  
[code]  
sh: line 0: cd: /usr/bin/plutil: Not a directory  
Command  
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
failed with exit code 1  
[/code]

Thanks for directing me to these sites, I didn't know them.  
And thanks to everyone from Ruby community. I'll get back here once I  
have the answer!

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Eric\_Christopherson](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/eric_christopherson/32/1849_2.png) [@Eric\_Christopherson](https://rubytalk.org/u/Eric_Christopherson)\
**Post date:** [26 September 2010 21:03 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/6 "2010-09-26T21:03:21Z")

</div>

> Eric,
> 
> I tried to use the absolute path /usr/bin/plutil but then, ruby  
> considered plutil as being a directory and not a file. Error received :  
> [code]  
> sh: line 0: cd: /usr/bin/plutil: Not a directory  
> Command  
> /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
> failed with exit code 1  
> [/code]

Oh, yeah. Sorry, I forgot you wrote that.

It looks like the script has other problems as well. For instance,  
when I run it on a plist file:

> $ /Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist /Users/eric/Library/Preferences/com.apple.Terminal.plist .  
> copyplist: no output directory specified  
> usage: copyplist [options] SRCFILE ... DSTDIR  
> &nbsp;&nbsp;&nbsp;&nbsp;-v, --[no-]validate Check validity before copying  
> &nbsp;&nbsp;&nbsp;&nbsp;-o, --outdir DIR Specify the output directory  
> &nbsp;&nbsp;&nbsp;&nbsp;-c, --convert FMT Convert output to FMT (same values as for 'plutil -convert')  
> &nbsp;&nbsp;&nbsp;&nbsp;-h, --help Show this message

It specifies "no output directory specified", even though I've  
specified ".". So I use "-o ." to specify it more explicitly, and that  
works. However, when I add "-v" to validate, I get "unrecognized  
option: -lint", followed by the plutil help text. I'm not sure which  
program is reporting that "-lint" is unrecognized; if I manually run  
"plutil -lint" it works fine.

> Thanks for directing me to these sites, I didn't know them.  
> And thanks to everyone from Ruby community. I'll get back here once I  
> have the answer!

Good luck!

> **···**
>
> On Sun, Sep 26, 2010 at 3:38 AM, Samuel Sam \<samuel13\_666@yahoo.fr\> wrote:

---

<div class="post-metadata">

**Author:** ![Eric\_Christopherson](https://yyz1.discourse-cdn.com/flex029/user_avatar/rubytalk.org/eric_christopherson/32/1849_2.png) [@Eric\_Christopherson](https://rubytalk.org/u/Eric_Christopherson)\
**Post date:** [27 September 2010 02:05 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/7 "2010-09-27T02:05:57Z")

</div>

Could the problem be related to these posts?  
\<[http://stackoverflow.com/questions/1165758/build-problem-in-xcode](http://stackoverflow.com/questions/1165758/build-problem-in-xcode)\>  
\<[http://stackoverflow.com/questions/384962/copyplist-failed-with-exit-code-71](http://stackoverflow.com/questions/384962/copyplist-failed-with-exit-code-71)\>

Those have exit code 71 instead of 127, so I don't know if it's the  
same thing. I'm also not quite sure if the problem is with Rubys  
installed as /usr/bin/ruby, or if other versions in the path cause it  
too.

---

<div class="post-metadata">

**Author:** ![Samuel\_Sam](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@Samuel\_Sam](https://rubytalk.org/u/Samuel_Sam)\
**Post date:** [27 September 2010 07:23 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/8 "2010-09-27T07:23:34Z")

</div>

Ok, I've discovered something new : If I drag and drop the XCode error  
to the desktop, a texte file is being created showing much more details.

[code]  
CopyPlistFile "build/Release-iphonesimulator/CocosDenshion - Tom The  
Turret.app/sprites.plist"  
CocosDenshion/TestsAndDemos/TomTheTurret/Resources/sprites.plist  
cd /Users/samuel/Desktop/cocos2d-iphone-0.99.4  
setenv PATH  
"/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin"  
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
--convert binary1  
CocosDenshion/TestsAndDemos/TomTheTurret/Resources/sprites.plist  
--outdir  
"/Users/samuel/Desktop/cocos2d-iphone-0.99.4/build/Release-iphonesimulator/CocosDenshion  
- Tom The Turret.app"

sh: plutil: command not found  
Command  
/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist  
failed with exit code 127  
[/code]

Here, there's something I don't understand:  
In the error, the PATH doesn't contain /usr/bin and I'm almost sure  
that's causing my issue. But where things get weird is if I type  
"export" in a terminal I got :  
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin"

Well, at leasst I know at 90% that this is a path issus... Now I need to  
fix it 🙂

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

---

<div class="post-metadata">

**Author:** ![Samuel\_Sam](https://avatars.discourse-cdn.com/v4/letter/s/8dc957/32.png) [@Samuel\_Sam](https://rubytalk.org/u/Samuel_Sam)\
**Post date:** [27 September 2010 07:48 UTC](https://rubytalk.org/t/error-copyplist-failed-with-exit-code-127/60199/9 "2010-09-27T07:48:29Z")

</div>

And here we go, problem solved. Instead of searching for hours how to  
modify these paths, I just copied the "plutil" script to  
/developer/usr/bin. It's working perfectly.  
Apparently XCode does use it's own path variables that are different  
from the one in "environment.plist"

So, you guys were right, that's not a ruby problem but an XCode one.  
Again thanks for your advice 😉  
Enjoy.

> **···**
>
> --  
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).
