Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Iris Avalon
Iris Avalon
14,477 Points

Having trouble with bundle install asking for json 1.8.6

Hey everyone,

I'm trying to set up by ruby on rails development environment and I got up the the point where I created a test app (ruby new testapp).

After that was done I used cd testapp and tried running the bin/rails server line.

It spit out an error telling me "Could not find gem 'sdoc ( >= 0) ruby' in the gems available on this machine. Run bundle install to install missing gems.

So I ran bundle install afterwards. It seems to work okay at first, but in the middle of the process I get an error. It tells me it "Failed to build gem native extension" and near the bottom of this error it says Make sure that 'gem install json -v '1.8.6' succeeds before bundling

So then I ran sudo gem install json -v '1.8.6' since just gem instal blah blah blah gave me a write permission error. This also pops out a neat little error that I saw before saying it failed to build gem native extension.

So now I'm completely out of ideas. I'm not really sure what I'm supposed to do next.

My ruby version is 2.0.0p247

bundler version 1.6.2

Help please? :)

5 Answers

Neil Northrop
Neil Northrop
5,095 Points

Hey Raven,

It looks like it has something to do with Xcode and Mavericks. Check out this answer for the details:

https://stackoverflow.com/questions/761521/when-i-try-sudo-gem-install-json-i-get-the-following-error

Looks like if you run the following command, you should be good to go:

xcode-select --install

Then rerun the install for json:

sudo gem install json -v '1.8.1'

And you should be able to bundle install after that.

I hope that works for you!

Neil Northrop
Neil Northrop
5,095 Points

Hey Raven,

After you ran sudo gem install json -v '1.8.6', what was the error output the console gave you? Will you toss that up here in a reply?

Thanks!

Iris Avalon
Iris Avalon
14,477 Points

Hey Neil,

Here is what gets outputted when I run the gem install:

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/2.0/usr/bin/ruby extconf.rb

creating Makefile

make "DESTDIR=" compiling generator.c linking shared-object json/ext/generator.bundle clang: error: unknown argument: '-multiply_definedsuppress' [-Wunused-command-line-argument-hard-error-in-future] clang: note: this will be a hard error (cannot be downgraded to a warning) in the future make: *** [generator.bundle] Error 1

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

I hope that helps! I really can't wait to start learning Rails :)

Thanks for the reply by the way!

EDIT: Sorry, I said I ran 1.8.6 in the first post, but I meant to say 1.8.1 for the json gem

Iris Avalon
Iris Avalon
14,477 Points

Hello again :)

I gave that a try, and after running the xcode line it told me that xcode-select requires the command line developer tools and asked me if I'd like to install those now. I clicked yes, it agree, and let it go through its process. Once it finished, the download window disappeared and the command had seemed to finish. I tried to sudo gem install json -v '1.8.1' again but the same error occurred. Bundle install is still tossing up the same error on the json file again as well :(

I had tried running the xcode command again just in case it hadn't finished what it was doing. The same prompt telling me it needed the command line developer tools came up again and asked me to install once more. I clicked yes just to see what would happen. It starts the process but then stops suddenly saying it can't install software because it is not currently available from the Software Update Service. There was also a button when it asked to install the tools that said, "Get xcode", which I clicked after trying this again. It brings up the app store but it shows me that xcode is already installed.

I'm not sure if it was something on my end, but it seems I'm still stuck here :( Sorry!

Iris Avalon
Iris Avalon
14,477 Points

Hey again.

Was browsing around and decided to see if I could find another solution. After a while I decided to just reinstall rbenv, ruby, rails, bundler, sqlite3 and try again. So I updated my rails from 2.0.0 to 2.1.1 went through all the jigga-ma-roll, and now suddenly I am able to launch my rails server without it asking me to bundle install first. I'm not super sure what the difference was, but apparently this time my macbook likes me :)

Thanks for the help anyway! I'm glad someone was trying to lend me a hand :)