I manually built Ruby 1.9.2 on Snow Leopard. Now I can’t find my old GEM files. I’m guessing they're in a different path now or something. So I have three questions:
gem install sinatra
puts the sinatra gem?If you use the Mac system Ruby, running gem install will try to save gems to the system Ruby directory /Library/Ruby/Gems/2.6. 0 . That directory is owned by root , the system superuser. Ordinary users are not allowed to write to it (and you really shouldn't alter this folder).
When you use the --user-install option, RubyGems will install the gems to a directory inside your home directory, something like ~/. gem/ruby/1.9. 1 . The commands provided by the gems you installed will end up in ~/.
RubyGems is a package manager for the Ruby programming language that provides a standard format for distributing Ruby programs and libraries (in a self-contained format called a "gem"), a tool designed to easily manage the installation of gems, and a server for distributing them.
Typing gem env
(Using your old Ruby install's gem command) at a command prompt gives something similar to:
> RubyGems Environment:
> - RUBYGEMS VERSION: 1.3.6
> - RUBY VERSION: 1.9.1 (2009-07-16 patchlevel 243) [i386-mingw32]
> - INSTALLATION DIRECTORY: C:/Ruby19/lib/ruby/gems/1.9.1
> - RUBY EXECUTABLE: C:/Ruby19/bin/ruby.exe
> - EXECUTABLE DIRECTORY: C:/Ruby19/bin
> - RUBYGEMS PLATFORMS:
> - ruby
> - x86-mingw32
> - GEM PATHS:
> - C:/Ruby19/lib/ruby/gems/1.9.1
> - C:/Users/Username/.gem/ruby/1.9.1
> - GEM CONFIGURATION:
> - :update_sources => true
> - :verbose => true
> - :benchmark => false
> - :backtrace => false
> - :bulk_threshold => 1000
> - REMOTE SOURCES:
> - http://rubygems.org/
(On Windows... I imagine Snow Leopard will have a similar format)
The GEM PATHS field is the interesting thing here. If you go to those directories listed, you should see a folder named cache. That will contain a list of .gem files corresponding to all the installed gems in that specific directory. You should just be able to call gem install *gemname*
on each of those gem files (using your new Ruby install's gem command).
EDIT: Mistakenly referred to INSTALLATION DIRECTORY instead of GEM PATHS. Greg reminded me that there are multiple locations known by a specific installation of Rubygems. All of those locations needs to be checked for gems used by that installation of Ruby.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With