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.
- Click on Applications -> Utilities -> Terminal to open a Terminal window.
- 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.
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.
- Download Fink from the Fink Project website, either for upgrade or for initial installation.
- Follow the directions on the Fink website to install and configure Fink.
- In the terminal window, run the command sudo apt-get update to update Fink's package list
- In the terminal window, run the command sudo apt-get install ruby18 ruby18-dev to install Ruby.
- 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.
puts "Hello world!"
- In the terminal window, navigate to the directory to which you saved the test.rb file.
- Run the command chmod +x test.rb.
- Run the command ./test.rb. If you see the message Hello world! displayed, Ruby is installed correctly.