2

I have just installed Ruby Enterprise Edition and am installing some gems for it. Stock Ruby 1.8.6 is also installed on the server.

I have added /opt/ruby-enterprise-1.8.6-20090201/bin to my PATH a head of /usr/bin where ruby and gem live.

which gem confirms this:

/opt/ruby-enterprise-1.8.6-20090201/bin/gem

However, when I install gems like this:

gem install some_gem

They end up in /usr/lib/ruby/gems/1.8/gems/ instead of /opt/ruby-enterprise-1.8.6-20090201/lib/ruby/gems/1.8/gems/.

But if I use /opt/ruby-enterprise-1.8.6-20090201/bin/gem install some_gem it does go into REE's gem directory.

I don't get it. Is there some config option I have to change? I am using sudo here. Maybe that has something to do with it?

Luke Francl
  • 31,028
  • 18
  • 69
  • 91

5 Answers5

12

There's a good explanation of what's going on here:

sudo changes PATH - why?

This assumes you're using Ubuntu. sudo does change the path under ubuntu.

The gem you have in /usr/bin/ is probably a symlink to /usr/bin/gem1.8. What I did was symlink ruby-enterprise's gem to /usr/bin/ree-gem like this:

sudo ln -s /opt/ruby-enterprise-1.8.6-20090201/bin/gem /usr/bin/ree-gem

then I just use:

sudo ree-gem install some_gem

to install gems specifically for ree. If you're not using the ruby 1.8.6 rubygem, you can symlink REE's gem to /usr/bin/gem instead:

sudo ln -s /opt/ruby-enterprise-1.8.6-20090201/bin/gem /usr/bin/gem

Community
  • 1
  • 1
Jack Chu
  • 6,791
  • 4
  • 38
  • 44
  • Wow, very interesting! I am using Ubuntu. I did not know that sudo on Ubuntu didn't change the path. That is bizare. – Luke Francl Feb 26 '09 at 18:44
0

I posted the solution I used on Ubuntu here: http://groups.google.com/group/emm-ruby/browse_thread/thread/d0c685bbd096823a#msg_effa7d6ad42c541c

There were some additional steps to get it working beyond what was described in the Ruby Enterprise Edition documentation.

Brian Armstrong
  • 19,707
  • 17
  • 115
  • 144
0

Here's an explanation for why it's setup like this for REE: http://www.rubyenterpriseedition.com/documentation.html#_how_ree_installs_itself_into_the_system

Nathan Bertram
  • 1,079
  • 11
  • 18
0

In addition to Jack Chu's helpful symlink above, might I suggest:

sudo ln -s /opt/ruby-enterprise/bin/rake /usr/bin/ree-rake

so you can sudo ree-rake gems:install

hoff2
  • 774
  • 3
  • 9
  • 25
0

A solution I used to a similar problem is to set up an alias to your REE gem command.

I.e.

alias reegem='/opt/ruby-enterprise-1.8.6-20090201/bin/gem'
Bo Jeanes
  • 6,294
  • 4
  • 42
  • 39