gem command silently does nothing - ruby

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.

Related

How to change gem environment for RUBY VERSION

I'm pretty new to Ruby and pod installation. Currently I have Ruby installed through RVM. However I'd like to install a pod through bundler by bundle exec pod install.
I keep getting the following error that my current version of Ruby is different from Gemfile specified. My current version of Ruby via RVM is same with Gemfile version. (So if I do pod install it won't cause any issues).
My gem env shows different Ruby Version.
How can I go about changing that? Where does gem env live? I saw some instructions here to install a RubyGem. But I'm having trouble following this. Any advice helps!
➜ ios git:(main) bundle exec pod install
Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5
➜ ios git:(main) gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3.1
- RUBY VERSION: 2.6.8 (2021-07-07 patchlevel 205) [universal.x86_64-darwin21]
- INSTALLATION DIRECTORY: /Users/myusername/.gem
- USER INSTALLATION DIRECTORY: /Users/myusername/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /Users/myusername/.gem/bin
- SPEC CACHE DIRECTORY: /Users/myusername/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-21
- GEM PATHS:
- /Users/myusername/.gem
- /Users/myusername/.gem/ruby/2.6.0
- /Library/Ruby/Gems/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/

How to install ruby gem without sudo?

Configuring a new machine (Mac OS Mojave - Version 10.14.2).
After installing ruby with rbenv. I'm trying to install some gem and running :
gem install rake bundler rspec rubocop pry pry-byebug hub colored octoki
But its give me the following error :
ERROR: While executing gem ... (TypeError)
incompatible marshal file format (can't be read)
format version 4.8 required; 60.33 given
Here is my Gem env :
RubyGems Environment:
- RUBYGEMS VERSION: 2.7.6
- RUBY VERSION: 2.5.3 (2018-10-18 patchlevel 105) [x86_64-darwin18]
- INSTALLATION DIRECTORY: /Users/elise/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
- USER INSTALLATION DIRECTORY: /Users/elise/.gem/ruby/2.5.0
- RUBY EXECUTABLE: /Users/elise/.rbenv/versions/2.5.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/elise/.rbenv/versions/2.5.3/bin
- SPEC CACHE DIRECTORY: /Users/elise/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/elise/.rbenv/versions/2.5.3/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-18
- GEM PATHS:
- /Users/elise/.rbenv/versions/2.5.3/lib/ruby/gems/2.5.0
- /Users/elise/.gem/ruby/2.5.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- :sources => ["http://gems.rubyforge.org/", "http://gems.github.com"]
- :benchmark => false
- "gem" => "--no-document"
- REMOTE SOURCES:
- http://gems.rubyforge.org/
- http://gems.github.com
- SHELL PATH:
- /Users/elise/.rbenv/versions/2.5.3/bin
- /usr/local/Cellar/rbenv/1.1.1/libexec
- ./bin
- ./node_modules/.bin
- /Users/elise/.rbenv/shims
- /Users/elise/.rbenv/bin
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/sbin
Does anyone know where this bug comes from?
Thanks for the help.
You have only enable very old (and not maintained) remote gem sources in your gem configuration. This might be caused by some old migrated configuration or by following some very old and outdated advice.
To fix this, you first need to remove the outdated gem sources and then add the only one which should be currently used. For that, you can run the following command from your Terminal:
gem sources --remove http://gems.github.com/
gem sources --remove http://gems.rubyforge.org/
gem sources --add https://rubygems.org/
You have to remove all the gem sources you have and add https://rubygems.org/ instead. Note that http://gems.rubyforge.org/ and http://gems.github.com are permanently dead and should be removed. You can list your sources by running:
gem sources
You should get something like this:
*** CURRENT SOURCES ***
//gems.rubyforge.org/
//gems.github.com
1) Delete all sources:
gem sources -r http://gems.rubyforge.org/
gem sources -r http://gems.github.com
2) Add the right source:
gem sources -a https://rubygems.org/
Also, never sudo gem install
Hope this helps!

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?
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

bundle install using old rubygems version

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.

How to fix rubygem not found after successful installation?

I have installed the rubygems-mirror gem (successfully it would seem), but when I execute the gem I get the following error:
$ gem mirror
ERROR: Install the rubygems-mirror gem for the mirror command
EDIT: The installation was done using a gem install command, and I have setup the ~/.gem/.mirrorrc file as a cut/paste from the gem documentation, save the target directory.
Both doing an listing of ~/.gems/ruby/gems and running gem list show I have rubygems-mirror version 1.1.0 on my system. Here is my gem list:
$ gem list rubygems-mirror
*** LOCAL GEMS ***
rubygems-mirror (1.1.0)
$ ls ~/.gem/ruby/gems/rubygems-mirror-1.1.0
CHANGELOG.rdoc lib Manifest.txt Rakefile README.rdoc test
And here is my gem environment:
$ gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14
- RUBY VERSION: 2.0.0 (2014-11-13 patchlevel 598) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/localadm/.gem/ruby
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /home/localadm/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /home/localadm/.gem/ruby
- /usr/share/gems
- /usr/local/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
I've never had such an issue with a gem before, I'm a little confused at what to do here. To make things even more confusing, I can run gem mirror --help and receive the correct help text for the mirror gem as output.
UPDATE: It seems I am able to use a work-around. I have cloned the git source repo, and seem to be able to execute $ rake mirror:update successfully. I'm sitting at about 2000/819236 gems downloaded, but so far so good.
Still would like to figure out how I can run the mirror simply with $ gem mirror as it should work.

Resources