/usr/bin/gems reports "Gem::manage_gems is deprecated"

drbrain | Fri, 16 Jan 2009 00:49:00 GMT

Posted in

I was looking through my search keywords and found that a lot of people were searching for:

/usr/bin/gem:10:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.

To fix this you need to remove /usr/bin/gem and symlink it to the proper gem executable.

Since RubyGems 1.0 the gem executable has been installed with a name matching your ruby executable. Often when you install Ruby through a packaging system the ruby executable is installed with a version appended like "ruby18" and a symlink named "ruby" points to the real ruby. For the "gem" executable you need to do this yourself.

To prevent problems like this in the future, read RubyGems release notes when you upgrade. RubyGems now prints them out after gem update --system and you can always find the RubyGems release notes posted as news items on RubyForge.

First, determine where the real gem executable is. You can figure out what the ruby executable's real name is like this:

$ gem env | grep 'RUBY EXEC'
  - RUBY EXECUTABLE: /usr/bin/ruby18

So your gem executable should really live at 'gem18'. Try it:

$ gem18 env | grep 'RUBY EXEC'
  - RUBY EXECUTABLE: /usr/bin/ruby18

To be extra sure, compare the full gem18 env output and gem env output.

To fix the warning, remove the gem executable and replace it with a symlink to gem18.

sudo rm /usr/bin/gem
sudo ln -s /usr/bin/gem18 /usr/bin/gem

Now the warning should be gone.

Remember, to prevent problems like this in the future, read RubyGems' output when you upgrade. RubyGems also prints the release notes when you run gem update --system now.

PS: If you're seeing rake give this warning, that's an entirely different issue. Jim Weirich has a fixed rake in his release queue and it should be out before Gem::manage_gems goes away. comments

Comments RSS FEED

…so, why isn’t the installer fixing this by itself? I don’t get the issue here.

David Palm said 4 days later

The installer doesn’t fix this because you could have ruby 1.8 installed as “ruby” and ruby 1.9 installed as “ruby19” under the same prefix. If you upgrade RubyGems for 1.9 relinking “gem” to “gem19” would prevent you from managing gems for your 1.8 install.

Eric Hodel said 5 days later

Comments are disabled