Setting up Ubuntu Jaunty for Ruby and Rails development

Getting Ruby setup on Ubuntu – Jaunty

UPDATED: Added RSpec for Rails as well

Here are some quick steps to get you up and running with Ruby on Ubuntu, Take about 15 minutes depending on your internet connection.

Step 1: The first thing you need to do is update the packages in Ubuntu open the terminal window (Applications Menu | Accessories | Terminal) and type in the following commands.
   sudo aptitude update
   sudo aptitude dist-upgrade

Step 2: The next package will insure you have everything you need in order to build ruby packages on your system.
    sudo aptitude install build-essential

Step 3: Type in the following command to install Ruby NOTE: this is all ONE command

    sudo aptitude install ruby1.8-dev ruby1.8 ri1.8 rdoc1.8 irb1.8 libreadline-ruby1.8 libruby1.8 libopenssl-ruby

Step 4: Type in the following command to install SQLite3 NOTE: ONE command

    sudo aptitude install sqlite3 libsqlite3-ruby1.8

Step 5: Install Ruby Gems NOTE: Multiple commands
   tar xvzf rubygems-1.3.2.tgz
   cd rubygems-1.3.2
   sudo ruby setup.rb

!! You should get an error stating that Ruby command not found !!

Step 6: creating the ruby symlink (symlink stands for symbolic link, windows user can think of it like a shortcut)
   sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby

Step 7: Install ruby gems NOTE: you should be in the directory rubygems-1.3.2 when you run this command

    sudo ruby setup.rb

Step 8: We need to create the remaining symlinks for ruby utilities NOTE: Multiple commands

    sudo ln -s /usr/bin/gem1.8 /usr/local/bin/gem
    sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc
    sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri
    sudo ln -s /usr/bin/irb1.8 /usr/local/bin/irb

Installing Rails

Step 9: Install Rails

    sudo gem install rails –no-rdoc –no-ri

Step 10: Create a test project NOTE: Multiple commands

    cd ~
    mkdir apps
    cd apps
    mkdir rails_apps
    cd rails_apps
    rails testapp

Step 9: Start Webrick web server in your testapp directory


Step 11: Open up Firefox and navigate to http://localhost:3000, you should see a page with the text:

    Welcome aboard
    You’re riding Ruby on Rails!

Step 12: Install Rspec
    gem install rspec

Installing source control

Step 13: Install subversion

    sudo aptitude install subversion

Step 14: Install Git because you are going to use plugins from GitHub

    sudo aptitude install git-core

Step 15: Install Git-svn

    sudo aptitude install git-svn

Step 16: Add SVN Like Shortcuts to Git

    git config –global status
    git config –global commit
    git config –global checkout
    git config –global branch

Step 17: configure the global user for Git
    git config –global “Put your full name here”
    git config –global

Step 18: colorize the output for Git
    git config –global color.branch auto
    git config –global color.diff auto
    git config –global color.interactive auto
    git config –global color.status auto


Installing RSpec for Rails

I want to put a disclaimer here that this is my preferred way of installing RSpec from GitHub. It is not the only way.

Step 19: Navigate to the root of your Rails project. I am assuming that in this case it will be “testapp”

Step 20: Install Rspec for Rails from GitHub as Git submodules. NOTE: Multiple commands

git submodule add git:// vendor/plugins/rspec

git submodule add git:// vendor/plugins/rspec-rails

Step 21: Run the rspec generators, this will enable the rspec_* controller, scaffold, model generators

ruby script/generate rspec

This is going to drive you nuts if you have to remember to do this for every rails project you create so I created a simple bash script.  Actually the contains more than the bash script it also has the aliases that I use for Rails development.

Step 22: Navigate to your home diretory

cd ~

Step 23: Create the .rails_aliases file

gedit .rails_aliases

Step 24: In gedit copy the following text to the .rails_aliases file

alias ror-doc-spec=’open -a Firefox doc/plugins/rspec-rails/index.html’
alias ror-doc=’open -a Firefox’
alias ror-scaffold=’ruby script/generate rspec_scaffold’
alias ror-controller=’ruby script/generate rspec_controller’
alias ror-model=’ruby script/generate rspec_model’
alias ror-git-customerror=’script/plugin install git://’
alias ror-console=’ruby script/console’
alias rapps=’cd ~/apps/rails_apps’
alias ror-serv=’ruby script/server’
alias ror-logtail=’tail -f log/development.log’

# Configures a rails app to use rspec
        git submodule add git:// vendor/plugins/rspec
        git submodule add git:// vendor/plugins/rspec-rails
        ruby script/generate rspec

Step 25: Save the file and close gedit

Step 26: Open your .bashrc file from the terminal window

gedit .bashrc

Step 27: Add the reference to your .rails_aliases file in your .bashrc at the top of the file add the following line:

source ~/.rails_aliases

Step 28: Save the file and exit gedit

Now if you want to add RSpec to any rails project you simply navigate to the root of a rails project and type:


If you want to add a controller with RSpec specs you simply have to type:

ror-controller BlogPost title:string author:string content:text …

Hope this helps! Happy coding!

About Joe Ocampo

My personal philosophy is simple: "Have a good strategy that sets the environment for success through the enablement of the whole. Be agile but with a mind towards pragmatism. Delegate to the best qualified individuals, but don’t be afraid to involve yourself in all parts of a job. Treat everyone with respect, humility, and with a genuine pursuit towards excellence." Respected business and technical leader with expertise in directing organization towards effective results driven outcomes. Proven ability to perform and communicate from both technical and business perspectives. Strong technical and business acumen developed through experience, education and training. Provides the ability to utilize technology, harness business intelligence and execute strategically by optimizing systems, tools and process. Passionate about building people, companies and software by containing cost, maximizing operational throughput and capitalize on revenue. Looks to leverage the strengths of individuals and grow the organization to their maximum potential by harnessing the power of their collective whole and deliver results. Co-Founder of
This entry was posted in rails, Ruby, ubuntu. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

13 Responses to Setting up Ubuntu Jaunty for Ruby and Rails development

  1. schambers says:

    There is a new editor for ubuntu/linux that accepts textmate bundles. its called redcar editor:

    I personally use gedit with the gmate mod to make it more like textmate

  2. I would recommend grabbing the rspec-rails gem as well. It has some specialised test helpers for testing controllers and so on.

  3. Joe Ocampo says:


    Redcar has tremendous potential for Textmate users switching to Linux but it is still to Alpha for me. But definitely on the radar.

  4. Joe Ocampo says:

    @Garry I was going to add that but ….oh hell never mind I will just update it.


  5. Sean Biefeld says:

    Excellent post, this will help me greatly!

  6. gnubuntux says:

    There’s a metapackage called “ruby-full” … just do
    sudo apt-get install ruby-full

  7. Cool. What the heck is “Ruby and Rails”. You don’t even give the rest of us a clue as to what it is! I still don’t know what it is after reading the article and the posts.

  8. Thanks for the heads up on redcar.

  9. Blah says:

    Its very annoying how you have broken up the aptitude install steps instead of combining them into one

  10. NP says:

    @Theodore – The title says Setting up Ubuntu Jaunty for Ruby and Rails development. If you don’t know what ubuntu, jaunty or ruby on rails is then GOOGLE it! The article did what it set out to do!

    Good article and thanks!

  11. Abner says:

    Installing rspec fails

    $ git submodule add git:// vendor/plugins/rspec

    fatal: Not a git repository

  12. Berthold says:

    Thank you thank you thank you.

    Portable Ubuntu needs this bad! Although for some reason, rake has to be installed separately, but at least I can update gems now, and *finally* get to work…

  13. madameButterf1y says:

    Regarding fail message:

    Installing rspec fails

    $ git submodule add git:// vendor/plugins/rspec

    fatal: Not a git repository

    solution: run this command while inside the testapp directory

    git init