tags:

views:

1508

answers:

2

I have a performance problem with my ruby on my machine, which I think I have isolated to loading libraries (when #require is called), so I'm trying to work out whether ruby is searching too many folders for libraries.

When I run

$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.0
  - RUBY VERSION: 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/1.8
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-9
  - GEM PATHS:
     - /Library/Ruby/Gems/1.8
     - /Users/matt/.gem/ruby/1.8
     - /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
     - :sources => ["http://gems.rubyforge.org", "http://gems.github.com/"]
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
     - http://gems.github.com/

There's nothing much on /Users/matt/.gem, but there's tons in both /Library/Ruby and in /System/Library/Frameworks/Ruby.framework.

What gives? Is this normal?

Thanks in advance, folks.

+1  A: 

Yep. That all looks pretty standard to me. My mac running MacOS 10.5 similarly has nothing in ~/.gem/ruby/1.8/gems/ and quite a bit in the other two locations.

Gabe Hollombe
A: 

As Gabe mentioned, yes, this is normal.

A little more info:

/System/Library/Frameworks/Ruby.framework <-- used system wide for all users, usually owned by root. When you 'sudo gem install ...' the gem you're installing goes here...

/Users/matt/.gem <-- user 'matt' has his own gem directory. every user gets one.

When you just 'gem install' as 'matt' it will fall-back to your private gem dir. This gets created automatically the first time it's needed.

Eric Monti