Upgrading Ruby to 2.1.0 (and above) in Mavericks
Mavericks comes installed with Ruby 2.0.0, so your current version of ruby should be the following (if you haven't touched Ruby since upgrading to Mavericks):
ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
I wanted to use RailsInstaller for this because it's seamless, but they don't have an updated install package for the newest version of Ruby and Mac OS X, so I used RVM instead.
Run the following to install RVM and the latest stable version of Ruby:
\curl -L https://get.rvm.io | bash -s stable --ruby
Install the Ruby interpreter:
rvm install 2.1.0 --autolibs=enable
After that's finished installing, run:
source /Users/{your_user_name}/.rvm/scripts/rvm
Run:
ruby -v
ruby 2.1.0p76 (2014-02-24 revision 45161) [x86_64-darwin13.0]
Then run:
rvm use 2.1.0
Or:
rvm 2.1.0
(The commands are equivalent)
To make this the default version of Ruby for future sessions, run:
rvm --default 2.1.0
After this, I had issues getting Rails 4 to work, the following made it possible:
rvm gemset create rails-4.0
rvm 2.1.0@rails-4.0
The above allows Rails to store gems associated with the particular folder, otherwise, it will try to compile the system version of Rails. After, install Rails 4.0:
gem install rails --version 4.0.0 --no-ri --no-rdoc
Follow the any messages you might get from bundler to update your gems after Rails has finished installing.
Written by Alexandra Mirtcheva
Related protips
10 Responses
thx for the tuto.
Worked great here (on Mtn Lion server)
Thank you! Greetings from Chile
thanks!
Thanx for the steps! worked great.
Awesome, thankyou!
On Yosemite the curl command dies with
About to install Homebrew, press Enter
for default installation in /usr/local
,
type new path if you wish custom Homebrew installation (the path needs to be writable for user)
: Requirements installation failed with status: 1.
What's that about?
Thanks for the tutorial! Much appreciated!
@jmagosta have you tried: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
thanks!
@jmagosta install Homebrew first, that resolved the same issue I had.