Installing Ruby on MacOS X

Installing RVM for ruby is a better choice than using homebrew on MacOS X. You can install Ruby through terminal by running the following if you have homebrew installed. Homebrew is an application manager for MacOS X. Some have opted for homebrew ruby + rbevn combo:

brew install ruby

Homebrew is good…..I just found the gem executions path is a bit confused with homebrew installed ruby. The alternative is to use ruby version manager (RVM) instead by:

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

You may see common errors when you type any commands from a fresh install like “shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory. Just

cd / 

Once installed you can add in a few good gems for Ruby such as:

  • Sinatra (Web framework for Ruby, which influenced Flask.py web framework for python)
  • Thin (Web HTTP server for Ruby)
  • Shotgun (Auto reload web apps for development. Good for Sinatra)
  • HAML (html templating for ruby apps. similar to jinja)
  • Passenger (Platform for Node / Ruby / Python Apps)

For those interested in cross compatibility with Java Ruby. try Jruby. You can install using RVM command:

rvm install jruby 

Once you have installed ruby via RVM. You can install gems such as listed above by:

gem install [package]

 For those interested in running an app platform for nginx with passenger, try:

rvmsudo passenger-install-nginx-module