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?
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
Related
I get error when trying to run any gem installed using ruby from brew install ruby
Here is slather example but this is same for any gem I tried (Jekyll, CocoaPods, Nokogiri etc.)
/Library/Ruby/Site/2.3.0/rubygems.rb:275:in `find_spec_for_exe': can't find gem slather (>= 0.a) with executable slather (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.3.0/rubygems.rb:252:in `bin_path'
from /usr/local/bin/slather:22:in `<main>'
gem is installed properly but for unknown reason ruby tries to use paths for system version.
I have read to not use rvm and rbenv and only brew version but this also do not work as above
ruby -v: ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 3.1.2
- RUBY VERSION: 2.6.5 (2019-10-01 patchlevel 114) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/[user]/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
- SPEC CACHE DIRECTORY: /Users/[user]/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.5/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /usr/local/lib/ruby/gems/2.6.0
- /Users/[user]/.gem/ruby/2.6.0
- /usr/local/Cellar/ruby/2.6.5/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/opt/ruby/bin
- /Users/[user]/.fastlane/bin
- /Users/[user]/.fastlane/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
any help appreciated
Out of absolutely nowhere (not an exaggeration: I deployed two hours before this exception started happening), cap production deploy stopped working and is throwing this error:
Your Ruby version is 2.2.5, but your Gemfile specified 2.5.3
bundle stderr: Nothing written
Except I'm using 2.5.3, as specified in both gemfile and in .ruby-version.
This is what's in my gemfile:
source 'https://rubygems.org'
ruby '2.5.3'
I'm using rvm. ruby -v returns ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18], and ruby is set to global. I've tried running gem update bundler, gem install bundler followed by bundle install, bundle, and deleted gemfile.lock.
$ bundle env
Bundler 1.17.1
Platforms ruby, x86_64-darwin-18
Ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]
Full Path /Users/mirai/.rvm/rubies/ruby-2.5.3/bin/ruby
Config Dir /Users/mirai/.rvm/rubies/ruby-2.5.3/etc
RubyGems 2.7.8
Gem Home /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b
Gem Path /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-
b2b:/Users/mirai/.rvm/gems/ruby-2.5.3#global
User Path /Users/mirai/.gem/ruby/2.5.0
Bin Dir /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b/bin
$ which -a bundle
/Users/mirai/.rvm/rubies/ruby-2.5.3/bin/bundle
/usr/local/bin/bundle
Edit: Output of $ gem env:
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.8
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/mirai/.rvm/gems/ruby-2.5.3#mirai-b2b
- USER INSTALLATION DIRECTORY: /Users/mirai/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /Users/mirai/.rvm/rubies/ruby-2.5.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b/bin
- SPEC CACHE DIRECTORY: /Users/mirai/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/mirai/.rvm/rubies/ruby-2.5.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b
- /Users/mirai/.rvm/gems/ruby-2.5.3#global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/"]
- "update" => "--env-shebang"
- "benchmark" => false
- "install" => "--env-shebang"
- "gem" => "-n/usr/local/bin"
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- SHELL PATH:
- /Users/mirai/.rvm/gems/ruby-2.5.3#greentea-b2b/bin
- /Users/mirai/.rvm/gems/ruby-2.5.3#global/bin
- /Users/mirai/.rvm/rubies/ruby-2.5.3/bin
- /Users/mirai/.rvm/bin
- /usr/local/opt/openssl/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/local/bin
- /opt/local/sbin
- /usr/local/MacGPG2/bin
- /opt/X11/bin
I'm using AWS. bundle exec cap production deploy throws the same error.
I'm having what appears to be the exact same problem seen in a 1-month old question that no one has touched. I installed rbenv using homebrew, installed ruby 2.3.1 using rbenv install 2.3.1, installed jekyll and bundler using gem install jekyll and gem install bundler, then within a jekyll project, I typed bundle install. I got the error Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation. When I run gem env, I see this:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.6
- RUBY VERSION: 2.3.1 (2016-04-26 patchlevel 112) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/lindsb/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/lindsb/.rbenv/versions/2.3.1/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/bin
- SPEC CACHE DIRECTORY: /Users/lindsb/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/lindsb/.rbenv/versions/2.3.1/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-15
- GEM PATHS:
- /Users/lindsb/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0
- /Users/lindsb/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/lindsb/.rbenv/versions/2.3.1/bin
- /usr/local/Cellar/rbenv/1.0.0/libexec
- /Users/lindsb/.local/bin
- /usr/local/sbin
- /usr/local/bin
- /Users/lindsb/.rbenv/shims
- /Users/lindsb/.local/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /opt/X11/bin
- /Library/TeX/texbin
I don't understand why bundler complains about Rubygems being below 2.1.0 when my Rubygems version is 2.6.6.
There is a Gemfile and a Gemfile.lock in the project directory. Gemfile looks like this:
source 'https://rubygems.org'
# jekyll
gem "jekyll", "3.1.1"
gem "redcarpet"
# compiling less
gem 'therubyracer'
gem 'less'
# minifying
gem 'jekyll-press'
# octokit
gem 'octokit'
gem 'netrc'
Hi I am learing Rails and encountered the same issue and I don't know what the root cause it is. But when I try reinstall bundler again
gem install bundler
and then run
bundle install
everything goes fine now.
I don't know exactly what the issue was, but when I removed Gemfile.lock and reran bundle install everything worked fine. There were probably just some bad constraints or something in Gemfile.lock.
I need to use Twitter's twurl command. In so doing I have installed Ruby and then Gem under Linux.
I've downloaded the latest version of twurl but when I attempt to use it to do an install it silently does nothing. I've also tried installing the oauth gem, but the same result. Gem must work because I can do a build using the gemspec file and it creates a gem file.
cam:~/twurl-master$ sudo gem build twurl.gemspec
sh: git: command not found
/usr/local/lib/site_ruby/1.8/rubygems/core_ext/kernel_require.rb:55: command not found: git ls-files
sh: git: command not found
WARNING: description and summary are identical
WARNING: See http://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: twurl
Version: 0.9.2
File: twurl-0.9.2.gem
cam:~/twurl-master$ ls
COPYING Gemfile INSTALL README Rakefile bin lib test twurl-0.9.2.gem twurl.gemspec
cam:~/twurl-master$ sudo gem install twurl
cam:~/twurl-master$ sudo gem install twurl --remote
cam:~/twurl-master$ sudo gem list t
*** LOCAL GEMS ***
cam:~/twurl-master$ sudo gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.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
- SPEC CACHE DIRECTORY: /home/cam/.gem/specs
- RUBYGEMS PLATFORMS:
- ruby
- x86-linux
- GEM PATHS:
- /usr/lib/ruby/gems/1.8
- /home/cam/.gem/ruby/1.8
- 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
- /usr/sbin
- /usr/bin
- /sbin
- /bin
- /usr/X11R6/bin
cam:~/twurl-master$
I am at a loss as to know what to do. I've searched on Google but nobody else seems to have this particular problem. No error message is highly unhelpful...
I'm not sure what is the issue and if that's related, but just in case, twurl gem also requires the gem oauth-0.4.7.
I'm trying to install cocoapods on Mac
Successfully installed cocoapods-0.25.0
1 gem installed
But
$ pod install
-bash: pod: command not found
Ruby was installed using brew
$ which ruby
/usr/local/bin/ruby
$ which gem
/usr/local/bin/gem
Here is output of gem environment
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 2.0.0 (2013-06-27 patchlevel 247) [x86_64-darwin12.5.0]
- INSTALLATION DIRECTORY: /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/Cellar/ruby/2.0.0-p247/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/Cellar/ruby/2.0.0-p247/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-12
- GEM PATHS:
- /usr/local/Cellar/ruby/2.0.0-p247/lib/ruby/gems/2.0.0
- /Users/nt/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "install" => "--no-rdoc --no-ri"
- "update" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
What I should export or add to .bash_profile to get pod install working?
If you are using rbenv like I am, after installing a gem you have to run rbenv rehash to get a link in the shims directory.
My bad, this line in .bash_profile helped
export PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/bin