3

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"?

Gilles
  • 153
  • 1
  • 9

3 Answers3

2

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

Gilles
  • 153
  • 1
  • 9
1

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.

Nebojsa
  • 9
  • 1
0

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.

Jens Erat
  • 4,993
  • 7
  • 31
  • 37
Spode
  • 1