davetron5000
davetron5000

Reputation: 24841

Gem path used by rake different than system path on OS X

> gem env gempath
/Users/davec/.gem/ruby/1.8:/opt/local/lib/ruby/gems/1.8

> head Rakefile
require 'rubygems'
puts Gem.path
require 'rake/clean'
require 'rake/testtask'
require 'rcov'
require 'rcov/rcovtask'

> rake
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
/Library/Ruby/Gems/1.8
rake aborted!
no such file to load -- rcov
/Users/davec/Projects/matrix/rakefile:5
(See full trace by running task with --trace)

If I go into irb, or create a .rb script, I can require gems that I've installed.

I have the latest rubygems-update, rake, and rcov.

Anyone seen this before? It seems like something is amiss and I'd like to avoid setting GEM_PATH or hacking /etc/gemrc (which doesn't exist at the moment)

Upvotes: 2

Views: 3542

Answers (1)

Simone Carletti
Simone Carletti

Reputation: 176402

/opt/local/lib is generally the path configured by macports. Did you install RubyGems via macports?

Also ensure which gem doesn't return the /opt/local path.

If so, I would suggest to remove any macports ruby package and install RubyGems from source. Also, Leopard should come with RubyGems installed (AFAIK).

Upvotes: 1

Related Questions