Tony Beninate
Tony Beninate

Reputation: 1985

Can't use rubygems

I think I need to do a fresh uninstall/install of rails, but I am unable to do so because my "gem" command is no longer working. When I type 'gem' I get the following error, but as you see, I have usr/local/bin in my PATH

caemlyn:rubygems-1.8.6 tonybeninate$ gem
-bash: /usr/local/bin/gem: /usr/local/bin/ruby: bad interpreter: No such file or directory
caemlyn:rubygems-1.8.6 tonybeninate$ which gem
/usr/local/bin/gem

caemlyn:rubygems-1.8.6 tonybeninate$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec

For what it's worth, I am on Lion now; Please help. Thank you.

UPDATE Thanks to the suggestions I am a lot closer now. I installed rails 3.0.7 with no hitch! However, when I try to run rails, I get the following error:

caemlyn:PhotoBlog tonybeninate$ rails -v
Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

But it's clearly there:

caemlyn:PhotoBlog tonybeninate$ which rails
/Users/tonybeninate/.rvm/gems/ruby-1.8.7-p352/bin/rails

Thoughts?

Never mind, after following this a little more closely I got things working https://rvm.beginrescueend.com/gemsets/basics/

Thanks for the help guys.

Upvotes: 0

Views: 2495

Answers (2)

Ben Taitelbaum
Ben Taitelbaum

Reputation: 7403

My guess is that the gem binary is linked to a ruby version that no longer works (maybe it was linked to some libraries that were updated in lion). Do you have similar issues with irb or the ruby interpreter itself?

My suggestion would be to do the following:

  1. upgrade XCode so that you have the developer tools, if you haven't already done this. Uninstall the previous version via sudo /Developer/Library/uninstall-devtools --all before installing the latest

  2. Clear out any system gems you have installed.

  3. Install rvm and use this to manage ruby, rubygems, and gemsets.

  4. Make sure that your path is correctly using rvm version of ruby and rubygems over anything already installed on your system. rvm info

Upvotes: 1

dwmcc
dwmcc

Reputation: 1074

Have you tried RVM? As far as I remember, RVM will install gems for you, and the version it installs should be working.

Link: https://rvm.io

Upvotes: 1

Related Questions