Installing Ruby, Rails, and Rubygems

Aug 28, 2007

Getting your first ruby on rails stack up and running can be a bit of a chore, here's a quick guide on how to do it on a linux box but the instructions should be equally good for OS X users.

Installing Ruby

Now depending on your OS, you've got a few options on how to get ruby up and running. The easiest way is to use the built-in package management system. This will give you the latest known stable version of ruby for your environment, and hopefully reduce or remove any potential conflicts with other installed software. The downside is that quite often the packaged version are a few releases behind the currently advertised stable version just due to the time it takes for the linux distribution manages to bundle them up.

Installing Ruby from yum/apt-get

If you've got a package manager, just enter whichever of the following commands is the most appropriate:

sudo yum install ruby irb rdoc ruby-devel

sudo apt-get ruby irb rdoc ruby-devel


Installing Ruby from Source

If you've decided to take the from source option, then you'll need to do the following:

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p72.tar.gz

tar zxvf ruby-1.8.7-p72.tar.gz

cd ruby-1.8.7-p72

./configure

make

sudo make install


Installing ruby gems

Gem is the package system for ruby, and it's the easiest way to install most of your ruby dependencies (including rails). So grab it from sourceforge:

wget http://rubyforge.org/frs/download.php/43985/rubygems-1.3.0.tgz

tar zxvf rubygems-1.3.0.tgz

cd rubygems-1.3.0

sudo ruby ./setup.rb


Installing Ruby on Rails

Now getting rails installed is a breeze, all you need to do is:

sudo gem install rails


You may need to install your native database driver bindings too, if so:

sudo gem install mysql

sudo gem install postgres


Hi, I'm Glenn! 👋 I'm currently Director of Product @ HashiCorp, and we're hiring! If you'd like to come and work with me and help make Terraform Cloud even more amazing we have multiple positions opening in Product ManagementDesign, and Engineering & Engineering Management across a range of levels (i.e., junior through to senior). Please send in an application ASAP so we can get in touch.