Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I installed Ruby with the command apt-get install ruby1.9.1, but when I enter ruby in the console, nothing happens.

I have to use the command


ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux]

But how do I call it with ruby and not ruby1.9.1? And how do I install Rails?

share|improve this question
What happens if you do "which ruby", does it show as being installed? Does "ruby -v" show the right version number? –  Nathaniel Bannister Jun 1 '11 at 20:10
Install: sudo apt-get install ruby1.9.1-full ruby -v –  BILL Jun 1 '11 at 20:13
Program 'ruby' is not installed. –  BILL Jun 1 '11 at 20:13
When you type "sudo apt-get install ruby1.9.1-full" in a terminal does anything happen? –  slotishtype Jun 1 '11 at 20:24
I'm a little confused by your update. If you want to install rails please use RVM - rvm.beginrescueend.com - to install rails and any other gems. It is a package manager and will save you a lot of time. –  slotishtype Jun 1 '11 at 21:10

2 Answers 2

Method 1 – railsready

If you don't want to do everything manually, you can use the railsready script, which will install for you:

  • An updated system (Linux only)
  • Ruby 1.9.3 latest patch level (installed to /usr/local/bin/ruby) or RVM running 1.9.3 latest patch level
  • Imagemagick
  • libs needed to run Rails (sqlite, mysql, etc)
  • Bundler, Passenger, and Rails gems
  • Git

Just enter the following:

wget --no-check-certificate https://raw.github.com/joshfng/railsready/master/railsready.sh && bash railsready.sh

… and you're done.

Method 2 – Manual install and RVM

As @slotishtype has mentioned, do yourself a favor and install Ruby over RVM. It manages Ruby versions better, you don't need to sudo anything, and you'll be able to get more recent versions of Ruby.

How to install RVM

You need git for that, so if you don't have it, install it with sudo apt-get install git before. Also, @nixterminus has a blog post on that subject, written for Ubuntu 11.04. It features some other dependencies that you might need to install before:

sudo apt-get install build-essential bison openssl \
     libreadline6 libreadline6-dev curl git-core \
     zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 \
     libsqlite3-dev sqlite3 libxml2-dev libxslt-dev \
     autoconf libc6-dev ncurses-dev

Now, run the RVM installer:

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

Then, do the following to load RVM as a function:

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
source .bash_profile


In order to install Rubies, you have to install some additional Ubuntu packages. Enter the following:

rvm notes

This will give you instructions on what to install through apt-get.

Installing Rubies

Now let's get to installing the correct Ruby versions. I suggest you use the latest one. To find a list of all rubies, enter rvm list known. Here, I assume the latest version 1.9.3. This may take a while, be patient:

rvm install 1.9.3

Then, set it as the default Ruby version for your user:

rvm use 1.9.3 --default

Now you can install Rails over gem:

gem install rails

Method 3 – rbenv

rbenv is an alternative to RVM that follows a slightly different approach and is less intrusive with regards to the shell. It is incompatible with RVM, so uninstall that if you want rbenv.

Here's how do install it:

git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile

Finally, restart the shell:

exec $SHELL

Now you can install Ruby versions manually by compiling them into $HOME/.rbenv/versions/, or use ruby-build to get a rbenv install command similar to RVM.

share|improve this answer
Also, if you are using RVM do not use sudo. –  slotishtype Jun 2 '11 at 11:05
FYI - in the apt-get install step, you have lib1g above when this should be zlib1g. I also installed rvm with apt-get. This sets things up nicely and doesn't require you to edit your bashrc. I'm not sure if this is the best approach as I haven't tried $rvm get latest yet. –  spinlock Apr 3 '12 at 17:08
@slhck StackExchange won't let me make the edit to the apt-get install step - edits have to be more than 6 chars and we only need to change 1. And, I'm not a fan of sudo apt-get install ruby-rvm so far. I'm getting weird bugs due to permissions (i.e. $rvm install 1.9.3 complains because it's trying to write to a directory owned by root). It looks like keeping rvm in userspace is the best option. –  spinlock Apr 3 '12 at 18:22
I feel like rbenv (and ruby-build) should be mentioned here for completeness. It's an alternative to RVM with a cleaner method of hooking into your shell (but is practically not necessarily very different). –  JamesGecko Apr 3 '12 at 18:43
I just did sudo apt-get install ruby-rvm -- is there still a need to do the crazy bash stuff to beginrescueend, whatever that is? –  Jeff Atwood Jul 18 '12 at 20:09

There are multiple ways to install ruby on ubuntu, but installing form the repositories is (currently) not popular. To cleanly get a non-suffixed ruby, you should build ruby yourself or use rvm.

share|improve this answer

protected by Community Jun 9 '11 at 14:13

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.