Posts Tagged ‘symbolic link’

undefined method `manage_gems’ for Gem:Module (NoMethodError)

March 16, 2010 5 comments

OK,  if you are looking for a solution to the above error hopefully this post might help you.  This happens normally if you upgrade your gems.

(Please note – I’m talking about ubuntu here, If you are on  windows then try Ubuntu :D)

Then ruby gems will create a new file called ‘gem1.8’ and it will conflict with your older ‘gem’ file. You can find both these files in /usr/bin

So when ever you say gem list (or something with gem) it gives the error ‘/usr/bin/gem:11: undefined method `manage_gems’ for Gem:Module (NoMethodError)’

As a workaround ,  I have done following and it worked for me. My solution was to create a symbolic between ‘gem’ file and ‘gem1.8’ file.

Here’s how I did it,

first copy your ‘gem’ file (as a backup)

cp /usr/bin/gem /<my other path>/

Now delete the ‘gem’ file

sudo rm -f /usr/bin/gem

OK, now create the symbolic link

ln -s /usr/bin/gem1.8 /usr/bin/gem

Thats it, now time something like

gem list and it should work.

Hope this quick note will help 😀