Install Rails 3.1 on Windows, Mac and Linux

This is yet another guide.So much have been written. Probably replicates other guides which I have not checked. But this is updated for Rails 3.1.1.

This guide will constantly be updated as needed.

Install Rails 3.1 on Windows

Download and install Rubyinstaller. Suggested version is Ruby 1.9.2. Ruby 1.8.7 will no longer supported soon.

Bryan Bibat came up with Rails FTW which is lighter than RubyInstaller. In fact, he also wrote a book for beginners which you can download via github.

The current version is now Rails 3.1 so doing “gem install rails” will install version 3.1. Based on experience, however, I would suggest install Rails 3.1.1.

gem install rails --pre

Install Rails 3.1 on Ubuntu/Debian

The first requirement to install is RVM. You can always refer to RVM documentation. RVM has its dependencies too.

It’s easier to install now that Rico Sta. Cruz made ServerWizard which allows you to install several dependencies for development and production environment:

Serverwizard gives me this when I click on “Ruby version manager.”

sudo bash < <(wget "http://serverwizard.heroku.com/script/rvm" -q -O -)

Make sure that the “rvm” command works. And you have updated your dotfile .bash_profile or .bashrc to contain:

nano ~/.bash_profile 
Add: 
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
source ~/.bash_profile

And this should work:

rvm install 1.9.2
rvm 1.9.2 --default

Install Rails 3.1 on a Mac

I currently use OS X Lion for my Macbook Pro.So I’m a lot more certain about these steps I’m writing than the steps for Windows and Linux.

The first step is to install Xcode for OS X Lion.

Before you install Rails, make sure you have either MySQL or PostgreSQL installed. SQLite is OK but in production, we normally use MySQL or PostgreSQL.

If you will use MySQL, it can be downloaded and I installed version 5.1.58 because I did encounter issues for the latest version.

After installing these, you can install homebrew. On the terminal, these commands should work:

/usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
sudo chown -R $USER /usr/local

Homebrew can install git, imagemagick and other dependencies for a common Rails application.

  brew install git

PostgreSQL can be installed via homebrew and I recommend doing so.

  brew install postgresql 

Read and follow the instructions. If you missed it (closed the terminal or something), try:

  brew info postgresql 

Now you can install RVM.

bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

rvm install 1.9.2
rvm 1.9.2 --default
gem install rails --pre