Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 221637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:03:07+00:00 2026-05-11T19:03:07+00:00

I recently upgraded to Ubuntu 9.04 and I have issues using gems. I installed

  • 0

I recently upgraded to Ubuntu 9.04 and I have issues using gems.
I installed Ruby, Rubygems and Rails using apt-get.
The rails command does work.

I then installed capistrano and other gems, such as heroku.
In order to do that, I used the command:

sudo gem install XXX

When I want to use the cap command it does not work:

bash: cap: command not found

It is the same with the other gem commands.

Do I have something particular to do so that the gem commands work?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:03:08+00:00Added an answer on May 11, 2026 at 7:03 pm

    Where are my Gems?

    You can find where your gems are stored using the gem environment command. For example:

    chris@chris-laptop:~$ gem environment
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.3.2
    
      - RUBY VERSION: 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]
      - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
      - RUBY EXECUTABLE: /usr/bin/ruby1.8
      - EXECUTABLE DIRECTORY: /usr/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86-linux
      - GEM PATHS:
         - /usr/lib/ruby/gems/1.8
         - /home/chris/.gem/ruby/1.8
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
    

    If you look at the “GEM PATHS:” section you can see that gems can be stored in two places on my laptop: /usr/lib/ruby/gems/1.8 or in the .gem directory in my home dir.

    You can also see that executables are stored in EXECUTABLE DIRECTORY which in this case is /usr/bin.

    Because /usr/bin is in my path this lets me run cap, merb, rails etc.

    Updating your PATH

    If for some reason your EXECUTABLE DIRECTORY isn’t on your path (for example if it is /var/lib/gems/1.8/bin) then you need to update your PATH variable.

    Assuming that you are using the bash shell. You can do this quickly for the current session by typing the following at the shell prompt; let’s pretend that you want to add /var/lib/gems/1.8/bin to the path:

    export PATH=$PATH:/var/lib/gems/1.8/bin
    

    and press return. That appends the new directory to the end of the current path. Note the colon between $PATH and /var/lib/gems/1.8/bin

    To set the value for all sessions you will need to edit either your .profile or .bashrc file and add the same line to the end of the file. I usually edit my .bashrc file for no reason other than that’s what I’ve always done. When finished, save the file and then refresh your environment by typing:

    bash
    

    at the shell prompt. That will cause the .bashrc to get reread.

    At any point you can check the current value of $PATH by typing

    echo $PATH
    

    at the shell prompt.

    Here’s a sample from one of my own servers, where my username is “chris” and the machine name is “chris-laptop”:

    chris@chris-laptop:~$ 
    chris@chris-laptop:~$ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
    chris@chris-laptop:~$ 
    chris@chris-laptop:~$ export PATH=$PATH:/var/lib/gems/1.8/bin
    chris@chris-laptop:~$ 
    chris@chris-laptop:~$ echo $PATH
    /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin
    chris@chris-laptop:~$ 
    

    My Gem won’t load!

    “Ruby gems won’t load even though installed” highlights a common problem using multiple different versions of Ruby; Sometimes the Gem environment and Gem path get out of sync:

    rb(main):003:0> Gem.path
    
    => ["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"]
    irb(main):004:0> exit
    

    Any Ruby process here is looking only in one place for its Gems.

    :~/$ gem env
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.3.7
      - RUBY VERSION: 1.9.1 (2009-05-12 patchlevel 129) [x86_64-linux]
      - INSTALLATION DIRECTORY: /opt/ruby1.9/lib/ruby/gems/1.9.1
      - RUBY EXECUTABLE: /opt/ruby1.9/bin/ruby1.9
      - EXECUTABLE DIRECTORY: /opt/ruby1.9/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-linux
      - GEM PATHS:
         - /opt/ruby1.9/lib/ruby/gems/1.9.1
         - /home/mark/.gem/ruby/1.9.1
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
      - REMOTE SOURCES:
         - http://rubygems.org/
    

    Look carefully at the output of gem environment:

      - GEM PATHS:
         - /opt/ruby1.9/lib/ruby/gems/1.9.1
    

    This isn’t the same path as returned by Gem.path:

    ["/opt/ruby1.9/lib/ruby1.9/gems/1.9.1"]
    

    It’s hard to say what exactly caused lib/ruby to change to lib/ruby1.9 but most likely the developer was working with multiple Ruby versions. A quick mv or ln will solve the problem.

    If you do need to work with multiple Ruby versions then you really should be using rvm.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently upgraded VS 2005 to VS 2008. Unfortunately I have a very basic
I recently upgraded one of my applications to Rails 2.2.2. Having done that, I've
Recently, I upgraded my solution to 4.0 and everything seems to have upgraded smoothly
I recently upgraded a VS2005 web deployment project to VS2008 - and now I
I recently upgraded to Subversion 1.5, and now I cannot commit my code to
I recently upgraded my oracle client to 10g (10.2.0.1.0). Now when I try to
I recently upgraded a c# windows service to run as a 64 bit .net
I recently upgraded from Delphi 4 to Delphi 2009. With Delphi 4 I had
I recently upgraded to Eclipse Ganymede from Europa and now I'm finding that when
I recently upgraded a Web Application Project (as well as some dependent projects) from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.