Hassen
Hassen

Reputation: 7654

Ruby on Rails: Can't install JSON gem

When I try to create a new Rails application rails new app, the process stops when trying to install the JSON gem. So, I tried to install it alone, using:

gem install json

but I get the following error message:

Building native extensions.  This could take a while...
ERROR:  Error installing json:
    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-darwin11.0 -I/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin11.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
Error: No developer directory found at /Developer. Run /usr/bin/xcode-select to update the developer directory path.
make: *** [generator.o] Error 1

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

Do you have any idea what does this mean? and how can I fix it?

Some additional information: I'm using MacOSX, the Rails version is 3.2.11. and the Ruby version is 1.8.7.

Thanks for your help.

Upvotes: 0

Views: 3026

Answers (1)

Maximilian Stroh
Maximilian Stroh

Reputation: 1086

Isn't support for Ruby 1.8.X dropped in Rails? I recommend upgrading to 1.9.3. For your gem: if there are problems with the native extensions, try using the "`json-pure" gem instead, since it's written entirely in ruby and doesn't need the native extensions.

http://rubygems.org/gems/json_pure

Upvotes: 1

Related Questions