0

I installed the Xcode 4.6.2 Command Line Tools via Xcode > Preferences > Downloads > Components > Command Line Tools, and its status is "Installed", yet after restarting my mac, running on Mac OS 10.8.3, I have no /Developer folder, and when I try to run sudo gem install posix-spawn I get this error:

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 suggest installing the Xcode Command Line tools, but I've already done that. /usr/bin/gcc-4.2 exists.

Community
  • 1
  • 1
Rose Perrone
  • 61,572
  • 58
  • 208
  • 243
  • 1
    It seems that it has something to do with this line: `Error: could not stat active Xcode path '/Developer'` if so, perhaps this previous question might be helpful: http://stackoverflow.com/questions/11961032/xcrun-error-could-not-stat-active-xcode-path-volumes-xcode-xcode45-dp1-app-c – fmendez Apr 24 '13 at 18:39

2 Answers2

0

The solution was to run sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ and then sudo gem install posix-spawn.

Rose Perrone
  • 61,572
  • 58
  • 208
  • 243
0

Reinstalling Xcode worked for me. Run xcode-select --install and then install the gem with gem install posix-spawn.

cesarsotovalero
  • 1,116
  • 6
  • 15