An older version of Ruby ships with OSX by default, the version is 1.8.7 which is now officially retired by its developers.
To upgrade to the latest stable version of Ruby, you going to need Xcode and Homebrew installed first, Xcode does the heavy lifting for compiling programs and Homebrew works as the package manager making sure any apps it installs plays nicely with the existing operating system
brew install ruby
Add latest Ruby to the shell path
With 2 versions of Ruby now installed you need to prioritise the latest one in your shell path, in either ~/.bash_profile or ~/.bashrc add in
Do the path line looks something like this
Reload the shell
ruby --version ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
To update Ruby, just run:
gem update --system
That’s it, the latest version is now installed whilst the older version is still on the OS the path points to the newer version and any gems will need to be reinstalled.