Joseph R.
Joseph R.

Reputation: 3

Am not able to run rails server

The error that I get when I try to run this command is

Could not find gem 'json (>= 1.8.0) ruby', which is required by gem 'uglifier (>= 1.3.0) ruby', in any of the sources.

I have been looking around for a solution and what I've come across is people saying to just run bundle install or bundle update but when I run bundle install or bundle update I get this error.

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20141122-37267-ceck48.rb extconf.rb 
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
     ^
1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/folders/n5/4jlbndy93t772cpgp3dr9znh0000gn/T/bundler20141122-37267-uyl5vv/json-1.8.1/gems/json-1.8.1 for inspection.
Results logged to /var/folders/n5/4jlbndy93t772cpgp3dr9znh0000gn/T/bundler20141122-37267-uyl5vv/json-1.8.1/extensions/universal-darwin-13/2.0.0/json-1.8.1/gem_make.out
An error occurred while installing json (1.8.1), and Bundler cannot continue.
Make sure that `gem install json -v '1.8.1'` succeeds before bundling.

I thought it might be helpful to point out that Im going through the one month rails trying to learn ruby on rails and don't know very much.

Upvotes: 0

Views: 653

Answers (2)

spickermann
spickermann

Reputation: 106932

Perhaps this problem has to do with a recent update of XCode. After a XCode update you need to do the following steps:

  1. Open Xcode and accept the license agreement
  2. Reinstall the Command Line Tools.

The second step seems to depend on your OS versions. If xcode-select --install does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices.

After reinstalling the Command Line Tools try to rerun bundle install.

Upvotes: 1

Aleksei Matiushkin
Aleksei Matiushkin

Reputation: 121000

Mavericks comes with ruby 2 preinstalled. Though you might tune the installation and install missing ruby-dev, I would highly recommend you to install ruby via rvm (preferred) or rbenv so you can manage multiple ruby versions and use gemsets.

Here is a good step-through explanation on how to do this.

Upvotes: 2

Related Questions