2013-04-24 34 views
0

我通过Xcode > Preferences > Downloads > Components > Command Line Tools安装了Xcode 4.6.2命令行工具,其状态为“已安装”,但在重新启动我的Mac后,在Mac OS 10.8.3上运行,我没有/Developer文件夹,当我尝试运行sudo gem install posix-spawn我得到这个错误:无法安装posix-spawn

Building native extensions. This could take a while... 
ERROR: Error installing posix-spawn: 
    ERROR: Failed to build gem native extension. 

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb 
creating Makefile 

make 
xcrun cc -I. -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin12.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -fno-common -arch i386 -arch x86_64 -g -Os -pipe -fno-common -DENABLE_DTRACE -fno-common -pipe -fno-common -Wall -c posix-spawn.c 
xcrun: Error: could not stat active Xcode path '/Developer'. (No such file or directory) 
cc -arch i386 -arch x86_64 -pipe -bundle -undefined dynamic_lookup -o posix_spawn_ext.bundle posix-spawn.o -L. -L/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib -L. -arch i386 -arch x86_64  -lruby -lpthread -ldl -lobjc 
clang: error: no such file or directory: 'posix-spawn.o' 
make: *** [posix_spawn_ext.bundle] Error 1 


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6 for inspection. 
Results logged to /Library/Ruby/Gems/1.8/gems/posix-spawn-0.3.6/ext/gem_make.out 

other questions建议安装Xcode的命令行工具,但我已经做到了。 /usr/bin/gcc-4.2存在。

+1

似乎它与这行有关:'错误:不能统计活动Xcode路径'/ Developer''如果是这样,也许这个前面的问题可能会有所帮助:http://stackoverflow.com/questions/ 11961032/xcrun-误差可能-不-STAT-有源xcode的路径体积-xcode的-xcode45-DP1应用内-C – fmendez 2013-04-24 18:39:05

回答

0

解决方案是运行sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/,然后运行sudo gem install posix-spawn