How to install Ruby on Rails on Mac OSX Mavericks

By:, On:

Installing Command Line Tools

All the below commands we will type in Terminal. To open terminal you can open search on your mac and simply type "terminal". The first search result should be the right one. Once you open it you should be welcomed by a black screen of the terminal. We are going to use it a lot.


*Note: Are you in China? make sure you have your VPN on if you want to play the videos.

Step 1: Install Line Tools

To install command line tools type:

$ xcode-select --install

This command will install tools that are necessary to set up other elements that will allow us to run Ruby on Rails on our computer. This step is very important

Step 2: Install Homebrew

Homebrew is a special program we will use to install packages on our machine.

In terminal write:

bash


$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
$ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
$ source ~/.bash_profile

Next check if everything is configured correctly:


$ brew doctor

Brew is being updated constantly so we will have to run the update


$ brew update

You should run this command every time before using brew

Step 3: Install RVM, Ruby and Rails

We will use RVM - a Ruby version manager to install Ruby and Rails. All in one go, so this may take a while. Simply run:


$ \curl -sSL https://get.rvm.io | bash -s stable --rails

Let's see if everything is properly installed by listing all versions of Ruby that we have on our machine:


$ rvm list

If you're using the latest version (at the time of writing this - it was 2.1.0) you are good to go. If not, you can run:


$ rvm use 2.1.1 --default

Or whichever is the latest.

Now, you're ready to create apps in Ruby on Rails!

If you login you will be able to mark this tutorial as finished to track your progress



Comments

  • On: Lukasz Muzyka wrote:

  • On: Frank wrote:

    Thanks for posting this!!
  • On: Mark wrote:

    Up and running :) Next step: Learn and start building! Tnx for getting it all at one place :)
  • On: Philip Lohrmann wrote:

    So simple and I have a problem, probably because my internet connection dropped out, got the following - what to do next? fatal: unable to access 'https://github.com/Homebrew/homebrew/': transfer closed with outstanding read data remaining I tried installing again: -e:69: warning: Insecure world writable dir /usr in PATH, mode 040777 It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup -bash: brew: command not found
  • On: Lukasz Muzyka wrote:

    Hi Philip, Learning to code in China is an extra difficult task. If you're using VPN - try to turn it off. If you haven't been using VPN - try turing it on. If you use Astrill, and most expats in Shangahi do, than try using "stealth mode" if you still can't install things. Try to install brew one more time following instructions from the begining, and let me know if the error persists.
  • On: Philip Lohrmann wrote:

    I found an uninstall script from someone at the homebrew site and ran it, then retried from beginning - I think it worked but when I ran brew doctor I got the following warning > Warning: You have an outdated version of /usr/bin/install_name_tool installed. This will cause binary package installations to fail. This can happen if you install osx-gcc-installer or RailsInstaller. To restore it, you must reinstall OS X or restore the binary from the OS packages. Probably an unrelated issue, but is this something I should try to address before continuing?
  • On: Philip Lohrmann wrote:

    I found an uninstall script from someone at the homebrew site and ran it, then retried from beginning - I think it worked but when I ran brew doctor I got the following warning > Warning: You have an outdated version of /usr/bin/install_name_tool installed. This will cause binary package installations to fail. This can happen if you install osx-gcc-installer or RailsInstaller. To restore it, you must reinstall OS X or restore the binary from the OS packages. Probably an unrelated issue, but is this something I should try to address before continuing?
  • On: Almas Kairatuly wrote:

    Whoops, the Homebrew installer has moved! Please instead run:

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

    Also, please ask wherever you got this link from to update it to the above. Thanks!

  • On: Daniel wrote:

    I got that same problem Whoops, the Homebrew installer has moved! Please instead run:

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

    Also, please ask wherever you got this link from to update it to the above. Thanks!

    please anyone help

Comment

You can login to comment