Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to upgrade ruby and rails in mac os snow leopard

I want to upgrade my Mac Snow Leopard ruby from 1.8.7 to 1.9.1 version, anyone know the painless and best way to upgrade? because i read some forum/post/blog/discussion say that is it not good to override the ruby that ship by apple

and what the best way to upgrade rails from version 2.2.2 to 2.3.8? because all the information that i find either is for leopard/tiger only & few complicate article for snow leopard. and they also say is it not good to override the rails that ship by apple.

anyone can help me?

Thank.

like image 259
devlim Avatar asked Jun 05 '10 10:06

devlim


2 Answers

  • Dan Benjamin has some great instructions for compiling and installing Ruby, RubyGems and Rails into usr/local over at Hivelogic. This doesn't actually overwrite the system install of Ruby/RubyGems/Rails but rather takes precedence over it. Although the instructions cover Ruby 1.8.7, you can just update as appropriate for the 1.9.1 distribution.

  • Alternatively, Ruby Version Manager (RVM) is a great way to manage multiple Ruby versions and associated gems. This Railscast episode has the details.

  • You should be able to upgrade Rails to 2.3.8 using [sudo] gem install rails as usual.

like image 132
John Topley Avatar answered Nov 13 '22 11:11

John Topley


RVM (Ruby Version Manager) is the Standard for upgrading your Ruby installation on OSX: https://rvm.io (Any Platform - Including OSX Snow Leopard)

To get started, open a Terminal Window and issue the following command:

\curl -L https://get.rvm.io | bash -s stable --ruby

( you will need to trust the RVM Dev Team that the command is not malicious - if you're a paranoid penguin like me, you can always go read the source: https://github.com/wayneeseguin/rvm )

rvm list known

( shows you the latest available versions of Ruby )

rvm install ruby-1.9.3-p362

For a specific version, followed by

rvm use ruby-1.9.3-p362

or if you just want the latest (current) version:

rvm install current && rvm use current

( installs the current stable release - at time of writing 1.9.3-p362 - pls update this wiki when new versions released )

Note on Compiling Ruby: In my case I also had to install Homebrew Link to get the gems I needed (RSpec) which in turn forces you to install Xcode (if you haven't already) https://itunes.apple.com/us/app/xcode/id497799835 AND/OR install the GCC package from: https://github.com/kennethreitz/osx-gcc-installer to avoid errors running "make".

  • Examples: https://rvm.io/workflow/examples/
  • Screencast: http://screencasts.org/episodes/how-to-use-rvm

Note on erros: if you get the error "RVM is not a function" while trying this command, visit: How do I change my Ruby version using RVM? for the solution.

This might be a dupe of: How to update Ruby to 1.9.x on Mac?

like image 1
3 revs, 3 users 96% Avatar answered Nov 13 '22 10:11

3 revs, 3 users 96%