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've spent most of my career working with or at startups. I'm currently the Director of Product @ Ockam where I'm helping developers build applications and systems that are secure-by-design. It's time we started securely connecting apps, not networks.

Previously I led the Terraform product team @ HashiCorp, where we launched Terraform Cloud and set the stage for a successful IPO. Prior to that I was part of the Startup Team @ AWS, and earlier still an early employee @ Heroku. I've also invested in a couple of dozen early stage startups.