Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 628 Vote(s) - 3.49 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where are the GEMs when Ruby compiled manually in Mac OS X 10.6.8?

#1
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:

- What is the "old" gem path, where `gem install sinatra` puts the sinatra gem?
- What is the "new" gem path, which is set when I build Ruby manually?
- How do I change it so Ruby finds my gems again?
Reply

#2
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:
> -

[To see links please register here]


(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.
Reply

#3
Your "old" gems would be relative to the Ruby that came bundled with the Mac because the `gem` command is included with Ruby 1.8.7, which is stock on Snow Leopard. If your `which ruby` shows `/usr/bin/ruby`, your gem environments should be similar to:

- GEM PATHS:
- /Library/Ruby/Gems/1.8
- /Users/greg/.gem/ruby/1.8
- /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8

If you are using RVM you *might* be able to tell it to [copy your gems](

[To see links please register here]

) from the `system` gemset to one under RVM's control. I haven't tried doing that as I install RVM immediately and let it handle all my Ruby installation and then I ignore the system's installation.

If your `which ruby` shows `/usr/local/bin/ruby` then the `gem env` command should reflect the changed path for the version you compiled from source.

I'm curious *WHY* you would build it manually, when [`RVM`](

[To see links please register here]

) is available to handle all the [configuration and installation](

[To see links please register here]

), and largely remove any concerns about *where* things are and whether you've just stomped on the system's installed version.

When RVM has installed a Ruby version, it will all be in `~/.rvm` and your Gems will be nicely located there too. You'll be able to [manage the gems](

[To see links please register here]

) as [gemsets](

[To see links please register here]

), relative to each version of Ruby, and switch back and forth instantly. Or, even better, you can run a command/program in each version of Ruby you have installed to test them using [`rvm ruby 'some command'`](

[To see links please register here]

).

Notice in the above `gem env` output that gems are in three separate areas on the disk. Under RVM's control they're in RVM's sandbox:

- GEM PATHS:
- /Users/greg/.rvm/gems/ruby-1.9.2-p0
- /Users/greg/.rvm/gems/ruby-1.9.2-p0@global

That makes it trivial for me to back them up, or blow them away if I want to.

I used to compile my rubies from source on my Macs and Linux boxes. I use RVM for that now. It's so much better than doing it by hand.
Reply

#4
I believe the standard gem install path on OS X is:

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through