1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Install Ruby on OS X


Ruby is pre-installed on Apple OS X Leopard and Tiger. However, depending on the version of OS X your computer is running, there may be a more recent version available and your Ruby interpreter may need to be upgraded. To upgrade Ruby, it's recommended you use a package manager like the Fink project. When using Fink, be sure to install the ruby, ruby-dev and ri pacakges.

Difficulty: Easy
Time Required: 15 minutes
Here's How:
  1. Click on Applications -> Utilities -> Terminal to open a Terminal window.
  2. Type and run the command ruby -v and the version number of your Ruby interpreter should be reported back to you. Getting an error message or no message at all means that Ruby is not installed properly.
  3. Compare version number of your Ruby interpreter to the to the current version listed on the Ruby download page. If the installed version is significantly lower, you should upgrade Ruby.

  4. Download Fink from the Fink Project website, either for upgrade or for initial installation.
  5. Follow the directions on the Fink website to install and configure Fink.
  6. In the terminal window, run the command sudo apt-get update to update Fink's package list
  7. In the terminal window, run the command sudo apt-get install ruby18 ruby18-dev to install Ruby.
  8. Create a new text file with a Text Editor application. Copy and paste the code from the box below into the editor and save it as test.rb.
    #!/usr/bin/env ruby

    puts "Hello world!"
  9. In the terminal window, navigate to the directory to which you saved the test.rb file.
  10. Run the command chmod +x test.rb.
  11. Run the command ./test.rb. If you see the message Hello world! displayed, Ruby is installed correctly.
  1. About.com
  2. Technology
  3. Ruby
  4. Tutorials
  5. Installing Ruby
  6. How to Install Ruby on OS X>

©2014 About.com. All rights reserved.