I need to upgrade gems to 1.8 i tried installing the respective debian packages but it seems its not getting upgraded

anujm@test:~$ dpkg -l |grep -i rubygem ii rubygems 1.3.5-1ubuntu2 package management framework for Ruby libraries/applications ii rubygems-lwes 0.8.2-1323277262 LWES rubygems ii rubygems1.8 1.3.5-1ubuntu2 package management framework for Ruby libraries/applications ii rubygems1.9 1.3.5-1ubuntu2 package management framework for Ruby libraries/applications anujm@test:~$ anujm@test:~$ gem gem gem1.8 gem1.9 anujm@test:~$ sudo gem1.8 install serve ERROR: Error installing serve: multi_json requires RubyGems version >= 1.3.6 anujm@test:~$ 
1

9 Answers

Install rubygems-update

gem install rubygems-update update_rubygems gem update --system 

run this commands as root or use sudo.

13

You can update all gems by just performing:

sudo gem update

4

Or:

gem update `gem outdated | cut -d ' ' -f 1` 
3

I found other answers to be inaccurate/outdated. Best is to refer to the actual documentation.

Short version: in most cases gem update --system will suffice.

You should not blindly use sudo. In fact if you're not required to do so you most likely should not use it.

You can update gem to any specific version like this,

gem update --system 'version' gem update --system '2.3.0' 
1

I wouldn't use the debian packages, have a look at RVM or Rbenv.

1

For me it sufficed to simply run

gem update 
2

To update just one gem (and it's dependencies), do:

 bundle update gem-name 

But to update just the gem alone (without updating it's dependencies), do

 bundle update --source gem-name 
4

If you're using RVM, the command below helped me a lot when upgrading from a very very old rubygems (eg 1.3.7) that defies the more current update commands mentioned in the other responses in this thread.

rvm rubygems <version> 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy