Problems running the executable for a gem installed under RVM

I recently had some problems trying to run the executable for a gem I had installed using gem with an RVM setup. I didn’t really know where to start, but after a bit of searching around I finally solved my problem, here are the steps that helped me out of this situation.

First make sure your gem is correctly installed. You can do this by typing:

gem query

Which will list all installed gems.

If you want to get more info on a specific installed gem you can do the following command:

gem specification <gemname>

If the gem is installed correctly and everything seems to be in order, the next step is to check your gem environment with the following command:

gem env

This command should give you the Ruby version used by your gem environment and the paths where the gems and their executables are located.

You can compare this version to the one used by RVM:

which ruby

You can see which version of Ruby RVM is currently configured to use. Both version should match. If they don’t, switch the current version used by RVM using:

rvm use <ruby-version>

Here you may have some problems running this last command if you are using the gnome standard terminal. If this is your case, in your terminal go to: Profiles -> Edit Profiles -> Title and Command, and check “Run command as login shell”.

Once this is done, if the problem still persists make sure that the path EXECUTABLE DIRECTORY shown under gem env is in your PATH environment variable.

6 thoughts on “Problems running the executable for a gem installed under RVM

  1. I recently had a similar problem with another installation of Linux. In the original post, I encountered the problem because I had many version of Ruby.

    This time I had only one version but the EXECUTABLE DIRECTORY from gem env wasn’t in my $PATH.


    To add it (replace with your actual dir).

    1. Hey man, thx for the post. Unfortunately it’s not working for me though. “gem env” and “which ruby” commands have diferent values. I can’t manage to use “rvm use ” command.

      My outputs are as follow:

      EXECUTABLE DIRECTORY: /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/bin

      “which ruby”:

      So i tried executing the command:
      rvm use /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/bin

      but the following error message is displayed:

      Could not determine which Ruby to use; /home/ubuntu/.rvm/gems/ruby-1.9.3-p484/bin should contain .rvmrc or .versions.conf or .ruby-version or .rbfu-version or .rbenv-version, or an appropriate line in Gemfile. ( see: ‘rvm usage’ )

      I have no idea what i should do. Any sugestions would be much appreciated.


      1. Hi, sorry for not replying earlier.

        I believe you do not need to specify the whole path when using rvm use. To see which versions of Ruby are available and what they are called you can do “`rvm list“` which will list all available versions.

        You can then do “`rvm use“` with one of the following versions.

  2. Hi, I’m having trouble with this! I try and install ‘rspec’ using “sudo gem install rspec”. It installs 5 gems, and the documentation, but when I run “gem specification rspec”, “No gem matching ‘rspec (>=0)’found” is returned. relatively new ubuntu user here, and I’m just trying to get this sorted so I can get back to work. Any help will be much appreciated!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s