There are many reasons that I have always wanted to learn Rails. The first is that it’s written in Ruby, a language with elegant syntax that can bring joy to developers. Second, Rails is a convention over configuration framework, it forces developers to follow best practice, agile development flow to be able to get the most out of it. Despite all that, I’ve never been able to be determined enough to learn it fully and use it in my work. But now the chance has come, let’s get started with an OSX environment ready for Rails.
First, we downloading and installing some dependencies so that ruby can be compiled in our OSX system. Of course, you can use the system ruby come with OSX, but I can guarantee that it will bring to you in the future. We will need to install the Xcode Command Line Tools. Either download it directly from Apple website, or open Xcode, go to
Preferences->Downloads, download it from here or if you are using OSX 10.9 type the following command in the terminal
Now, installing the needed compiler to build ruby from source using Homebrew (In case you don’t know what Homebrew is and you are using Mac OSX, I suggest you go immediately to its website and read the docs to install it)
The second thing we must do is installing a ruby version manager to manage and install ruby. In Ruby world, RVM, rbenv, chruby are the 3 most popular version manager. I used rvm, but it’s just too heavy so I switch to rbenv and have been happy with it so far (I haven’t tried chruby yet but have heard some good things about it). Installing rbenv is really easy with Homebrew
In case, brew does not add the rbenv bootstrap command to your
.zshrc, do it yourself
Default, rbenv will create a
.rbenv folder in your home folder and use it to hold ruby installations and gems but I prefer to use Homebrew’s directories so I do as Homebrew’s instruction and add the following to my
.zprofile (.bashrc, .zshrc… in your case)
We also must install ruby-build so that rbenv can download and install ruby
Yay, we are ready to install ruby with rbenv
Next is installing some necessary gems (for me)
I also installed some useful rbenv plugins using brew (the main reason that I use brew’s directories for rbenv: rbenv plugins installed with brew work nicely with brew’s directories).
Congratulation, we are all set now. Let create our first rails app.