Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Rails on Mavericks

Tags:

Not sure what happened but when I upgraded to Mavericks it says that Rails it not install. I executed the following command:

rails --version

And it said "Rails is not currently installed and run sudo gem install rails".

I run sudo gem install rails and get the following:

ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.1 for inspection.

UPDATE:

I ran the command gcc --version and got the following:

Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin13.0.0
Thread model: posix
like image 671
john doe Avatar asked Oct 25 '13 03:10

john doe


2 Answers

You need to install the Command Line Developer Tools. Just open Terminal and type up a command that requires it -- for instance, git, gcc or make. Or use the following command:

$ xcode-select --install

You'll see an alert like this:

enter image description here

Just click Install and that's it. As of OS X 10.9, there's no longer need to install Xcode for Ruby development.

Credit for the steps and picture goes to Daniel Kehoe in his latest guide: http://railsapps.github.io/installrubyonrails-mac.html

like image 84
Marcelo De Polli Avatar answered Oct 26 '22 04:10

Marcelo De Polli


I had the same problem which I have now been able to solve.

The problem for me was that I had updated to the latest version of Xcode through the appstore but hadn't actually opened the application to complete the install. So here's what solved it for me:

  • Updated Xcode
  • Opened Xcode application
  • Accepted license agreement
  • Installed rails

Hope it works for you too.

like image 28
ifearthenight Avatar answered Oct 26 '22 06:10

ifearthenight