0

I'm trying to use the tutorial at: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book?version=3.2#sec-install_ruby

When I do sudo gem install rails -v 3.2.9 I get this error:

Building native extensions.  This could take a while... ERROR:  Error installing rails:   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. -DJSON_GENERATOR  -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE   -fno-common -arch i386 -arch x86_64 -g -O3 -pipe -fno-common -DENABLE_DTRACE  -fno-common  -pipe -fno-common   -c generator.c xcrun: Error: failed to exec real xcrun. (No such file or directory) cc -arch i386 -arch
x86_64 -pipe -bundle -undefined dynamic_lookup -o generator.bundle
generator.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: 'generator.o' make: ***
[generator.bundle] Error 1

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.5 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.5/ext/json/ext/generator/gem_make.out

I've installed command line tools

I've set sudo xcode-select -switch /usr/bin

which xcode-select /usr/bin/xcode-select

which cc /usr/bin/cc

any ideas? thanks!

cbascom
  • 766
  • 1
  • 5
  • 21
pinkroads
  • 31
  • 1
  • 4
  • 1
    Did you try the answer of http://stackoverflow.com/questions/11977648/xcrun-error-failed-to-exec-real-xcrun-no-such-file-or-directory? – iltempo Dec 23 '12 at 10:47

2 Answers2

0

You need to install the full XCode app to build C extensions to gems using the system Ruby.

If you don't want to install XCode, another alternative is to compile your own Ruby using rvm, ruby-build, or ruby-install.

Tim Moore
  • 8,958
  • 2
  • 23
  • 34
0

In case someone using Xcode 5:

  1. Install command line from Xcode's settings menu
  2. use "mac port" to install ruby 1.8.7
  3. retry "gem install cocopods"

This fixed my identical issue.

fah
  • 11
  • 5