Install Ruby 2.0 and Rails 4.0 on Mac OS Mountain Lion

1 min read

The easiest way is to install XCode Command Line tools and then install ruby 2 via rvm then install rails 4 via gem.

  • Install XCode Command lines tools
  • rvm install ruby-2.0.0
  • gem install rails


Few notes:
Update rvm by running rvm get head
You may face the below error if you dont install XCode Command line tools but try to install rails
[source language=ruby]
Building native extensions. This could take a while…
ERROR: Error installing atomic:
ERROR: Failed to build gem native extension.
/Users/username/.rvm/rubies/ruby-2.0.0-p247/bin/ruby extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/Users/username/.rvm/rubies/ruby-2.0.0-p247/bin/ruby
–with-atomic_reference-dir
–without-atomic_reference-dir
–with-atomic_reference-include
–without-atomic_reference-include=${atomic_reference-dir}/include
–with-atomic_reference-lib
–without-atomic_reference-lib=${atomic_reference-dir}/
/Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:434:in `try_do’: The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0′
from /Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/mkmf.rb:817:in `try_run’
from extconf.rb:26:in `


Gem files will remain installed in /Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.14 for inspection.
Results logged to /Users/username/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/atomic-1.1.14/ext/gem_make.out
[/source]
basically atomic gem expects you to have developer tools like gcc 4.2 which you can install view brew or simply install XCode command like tools, reinstall ruby via rvm and then install rails.

Related posts:

My Testing Experience with Healthcare Project

Hi Folks, I am working on a healthcare related web application. I would like to share few interesting things that I came across while...
Ashwin Sundarabaskar
5 min read

Fix for Net::OpenTimeout: execution expired When on AWS with…

If you happen to see the error “Net::OpenTimeout: execution expired” and if it originating from /home/ubuntu/.rvm/rubies/ruby-x.x.x/lib/ruby/x.x.x/net/smtp.rb and if you are running your server on...
Praveen Kumar
15 sec read

Leave a Reply

Your email address will not be published. Required fields are marked *