96

I have installed gem on Ubuntu 10.10 32 bit with

apt-get install gem -y

But when I try to run

gem install something.gem

I get the error of the command not being found.

bash: gem: command not found

I installed gem, is there any reason it is saying it can't find the command?

These files were install by gem package

http://pastie.org/3483416

timgeb
  • 76,762
  • 20
  • 123
  • 145
awmusic12635
  • 1,241
  • 2
  • 11
  • 13
  • It says /usr/local/rvm/gems/ruby-1.9.3-p125/bin:/usr/local/rvm/gems/ruby-1.9.3-p125@global/bin:/usr/local/rvm/rubies /ruby-1.9.3-p125/bin:/usr/local/rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/ga mes – awmusic12635 Feb 28 '12 at 16:56

15 Answers15

142

Try the following:

sudo apt-get install rubygems
Rubens
  • 14,478
  • 11
  • 63
  • 92
Thomas
  • 1,421
  • 2
  • 9
  • 2
52

Are you wanting ruby gems? If so, you need to install libgemplugin-ruby and then the ruby 'gem' program will be in your path:

aptitude install libgemplugin-ruby
01100110
  • 2,294
  • 3
  • 23
  • 32
  • 7
    wich mirror do you use to find this package? I cant find here with the default raspbian sources.list. – gog Dec 17 '14 at 12:17
23

The following command installs ruby gem for ubuntu:

apt-get install libgemplugin-ruby

I did it after ruby was installed.

akjoshi
  • 15,374
  • 13
  • 103
  • 121
Druvision
  • 1,463
  • 1
  • 15
  • 16
22

Installing this package allows you to use gem command on Debian 8:

apt-get install rubygems-integration

To install a gem package you might also need:

apt-get install ruby ruby-dev
jsnjack
  • 2,630
  • 2
  • 21
  • 21
  • 1
    Although the code is appreciated, it should always have an accompanying explanation. This doesn't have to be long, but it is expected. – peterh Oct 30 '15 at 17:28
16

On Debian, Ubuntu or Linux Mint:

$ sudo apt-get install rubygems ruby-dev

On CentOS, Fedora or RHEL:

$ sudo yum install rubygems ruby-devel
Yash Vekaria
  • 2,285
  • 24
  • 24
10

FWIW, the equivalent package for RHEL/Fedora/CentOS/etc and SuSE/OpenSuSE appears to be called 'rubygems'.

David Arnold
  • 420
  • 5
  • 11
9

The following command may help you

sudo apt-get install ruby

Akash Jain
  • 894
  • 2
  • 10
  • 23
7

On Ubuntu 14.04,

apt-get install ruby ruby-dev

this will install gem for you.

Yushan ZHANG
  • 523
  • 5
  • 18
6

On CentOS 7 you can do:

yum -y install rubygems-devel

That worked for me.

trincot
  • 317,000
  • 35
  • 244
  • 286
thedude
  • 597
  • 5
  • 5
6

I had the same problem. What I did was:

sudo apt-get update

And then reinstall ruby-full

sudo apt-get install ruby-full
3

check that rvm is a function type rvm | head -1

Connor Leech
  • 18,052
  • 30
  • 105
  • 150
  • Worked for me. I was getting error while the command output was: **rvm is /home/zesaver/.rvm/bin/rvm**. Then I added to my .bashrc: **[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session as a function** . And reopened my terminal. Now the answer was: **rvm is a shell function**. And gem command started to work. – zesaver Mar 02 '16 at 10:03
3

I know this is kind of late for a response. But I did run into this error and I found a solution here: https://rvm.io/integration/gnome-terminal

You just have to enable 'Run command as login shell' under the terminal preferences.

castrike
  • 31
  • 2
1

The following command will give you the list of files that the gem package installed:

dpkg -L gem

that should help you troubleshoot.

martinhans
  • 1,133
  • 8
  • 18
1

try

$ /usr/bin/pd-gem

or

$ pd-gem

perreal
  • 94,503
  • 21
  • 155
  • 181
0

On Centos 8:

eventually, download the file of the application:

wget https://rubygems.org/downloads/asciidoctor-2.0.16.gem

then execute:

yum install -y rubygems ruby-devel
gem install asciidoctor

More: I tried positively also in a container (using the appropriate RUN and COPY statements before the commands).

Thomas C.
  • 1
  • 1