RubyGems and ruby versions

Hello,

I am running Ruby 1.92 on Mac OSX, but for some reason rubygems is not
using the correct ruby version.

ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]

which ruby
/usr/local/bin/ruby

gem env
- RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174)
[universal-darwin10.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-10
  - GEM PATHS:
     - /Library/Ruby/Gems/1.8
     - /Users/denny/.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
  - REMOTE SOURCES:
     - http://rubygems.org/

I have tried reinstalling ruby and rubygems, but that didn't help. Any
ideas on how I can fix this?

Thank you!

--
Posted via http://www.ruby-forum.com/.

What does "which gem" say?

···

--
Posted via http://www.ruby-forum.com/.

I think I installed ruby from source, I don't quite remember. I now put
/usr/local/bin before /usr/bin in my path, which works. However, when I
try to run a rake tasks I get the following error:

rake db:seed
/usr/local/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find
executable rake for rake-0.8.7 (Gem::Exception)
  from /usr/local/bin/rake:19:in `<main>'

···

--
Posted via http://www.ruby-forum.com/.

Hey,
I'm new to linux and RoR.
I installed ruby from source. Created my first project and executed:
rake db:migrate and received this error.

Error:
/usr/local/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find
executable rake for rake-0.8.7 (Gem::Exception)
  from /usr/local/bin/rake:19:in `<main>'

Having searched extensively on this problem - I am yet to find a
solution. Can someone please help.

Thanks.

Additional info:

RubyGems Environment:
  - RUBYGEMS VERSION: 1.3.7
  - RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [i686-linux]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.9.1
  - RUBY EXECUTABLE: /usr/local/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/local/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86-linux
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/1.9.1
     - /home/mechanic/.gem/ruby/1.9.1
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

···

--
Posted via http://www.ruby-forum.com/.

Andreas S. wrote in post #950278:

What does "which gem" say?

which gem
/usr/bin/gem

···

--
Posted via http://www.ruby-forum.com/\.

Does this give you any clues? (If not, post the output for all to see)

which gem
which rake
gem env
gem list -d rake

If the last one doesn't show you the rake gem where you'd expect to find it, you might have to re-install the rake gem using the proper gem executable.

-Rob

Rob Biedenharn
Rob@AgileConsultingLLC.com http://AgileConsultingLLC.com/
rab@GaslightSoftware.com http://GaslightSoftware.com/

···

On Oct 14, 2010, at 5:40 PM, Denny Britz wrote:

I think I installed ruby from source, I don't quite remember. I now put
/usr/local/bin before /usr/bin in my path, which works. However, when I
try to run a rake tasks I get the following error:

rake db:seed
/usr/local/lib/ruby/1.9.1/rubygems.rb:340:in `bin_path': can't find
executable rake for rake-0.8.7 (Gem::Exception)
from /usr/local/bin/rake:19:in `<main>'

In Ruby1.9, rubygems is built-in even though there is still an external gem command.

How did you install 1.9.2? Did you use rvm?

In any case, you looked at the location of ruby, but not of gem:

which gem # uses your PATH
whereis gem # looks in typical directories

You must have /usr/bin earlier than /usr/local/bin on your PATH.

That ought to fix it.

-Rob

Rob Biedenharn
Rob@AgileConsultingLLC.com http://AgileConsultingLLC.com/
rab@GaslightSoftware.com http://GaslightSoftware.com/

···

On Oct 14, 2010, at 5:13 PM, Denny Britz wrote:

Andreas S. wrote in post #950278:

What does "which gem" say?

which gem
/usr/bin/gem

So I guess I can use /usr/local/bin/gem instead. But when I type a gem
name such as "rake" the system will still look in /usr/local/bin for it.
How can I change that?

···

--
Posted via http://www.ruby-forum.com/.