Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have installed Ruby using RVM.

I did a gem install rspec command and it seemed to install rspec correctly. If I do a rspec I get a "The program 'rspec' is not currently installed" and I am suggested to apt-get it.

If I try to do a gem install rspec again, it shows that rspec was already installed. I tried to do sudo gem install rspec thinking it might be permission problem but then the terminal said that the gem program wasn't installed.

How can I run the programs I have "gem installed" in Ubuntu without resorting to doing an "apt-get"?

share|improve this question
up vote 2 down vote accepted

My problem was that the ruby version from my gem environment was different than from the ruby version from rvm.

I used the commands

gem env
which ruby

To diagnose the problem. This gave me the ruby version used by gem and rvm and then used

rvm use <ruby-version>

To match the two ruby versions.

I made a blog post with more details: Problems running the executable from a gem installed under rvm

share|improve this answer

When you use rbenv instead RVM you have option to run rbenv rehash, which will put gem binaries to path so you can use it. Also, you need to run rbenv rehash every time you install new gem that provides binaries.

share|improve this answer

I didn't appear to have rvm at all on Ubuntu 15.04. The solution was to install the rbenv package. Now everything I have installed through "gem install" can now be executed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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