Error "copyplist failed with exit code 127"

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 :

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

If needed I can provide you with the whole copylist code but here’s the
lines that call “plutil” word:

system('plutil -s -lint -- "' + srcPath + '"')
...
system('plutil -convert "' + OPTIONS[:OutputFormat] + '" -s -o "' +
OPTIONS[:OutputDir] + '/' + File.basename(srcPath) + '" -- "' + srcPath
+ '"')

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 Dir.chdir("/usr/bin") 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.

Hi,

The entire error message is :

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

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

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
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;
the -o option is used with -convert, and is only
useful with one file argument (last file overwrites);
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 :

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

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

On Sat, Sep 25, 2010 at 3:23 AM, Samuel S. [email protected]
wrote:

/Developer/Library/Xcode/Plug-ins/CoreBuildTasks.xcplugin/Contents/Resources/copyplist

  • ‘"’)
    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
https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/wa/signIn
or http://developer.apple.com/bugreporter/; I’m not sure what the
difference is), then also do one at
http://openradar.appspot.com/page/1 (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).

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 :

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

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!

On Sun, Sep 26, 2010 at 3:38 AM, Samuel S. [email protected]
wrote:

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 :

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

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
-v, --[no-]validate Check validity before copying
-o, --outdir DIR Specify the output directory
-c, --convert FMT Convert output to FMT (same values as for ‘plutil -convert’)
-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!

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.

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

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 :slight_smile:

Could the problem be related to these posts?
http://stackoverflow.com/questions/1165758/build-problem-in-xcode
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.

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 :wink:
Enjoy.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs