Semboku
Semboku

Reputation: 71

Rubygems command not found

Centos 7

I have installed ruby 2.1.2 and rubygems but when I run rubygems --version I get the error rubygems: command not found.

My $PATH is /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/lib/ruby/gems/2.1.0:/root/.gem/ruby/2.1.0

gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 2.6.11
  - RUBY VERSION: 2.1.2 (2014-05-08 patchlevel 95) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.1.0
  - USER INSTALLATION DIRECTORY: /root/.gem/ruby/2.1.0
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - SPEC CACHE DIRECTORY: /root/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.1.0
     - /root/.gem/ruby/2.1.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /sbin
     - /bin
     - /usr/sbin
     - /usr/bin
     - /root/bin
     - /root/ruby-2.1.2
     - /usr/bin/gem

yum list installed shows rubygems.noarch

What do I need to do to get rubygems working?

Upvotes: 0

Views: 2135

Answers (1)

aqfaridi
aqfaridi

Reputation: 739

To install ruby and rubygems on centOS, Run on Terminal

sudo yum install ruby
sudo yum install rubygems

To check version of of ruby and rubygems, Run

ruby -v
gem -v

Note: gem --version is same as gem -v

Update the gems list using :

sudo gem update
sudo gem update --system

Now, you can install any gem, using command

gem install <gem_name>

For instance, To install rails on centOS, Run

sudo gem install rails

Upvotes: 1

Related Questions