Installing Ruby in OSX

OSX is well know because it has, out of the box, things like a PHP interpreter and also a Ruby interpreter. The bad side about that is usually this versions are old.

In this post I’ll provide the steps to update your ruby version using homebrew.

Fist, install homebrew if you don’t have installed

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Then, use this commands to install ruby

brew install rbenv ruby-build

rbenv install 2.3.1
rbenv global 2.3.1
ruby -v

Finally, rbenv will change the ruby environment to your desired version. So, to select the right for ever, add this into your bash_profile or your zshrc

if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

That will select the right version for ruby.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.