Cannot upgrade RubyGems 1.2 - ruby

Why is the following happening, and how can I sort it?
On OS X Leopard (v10.5.6):
$ ./script/server
Rails requires RubyGems >= 1.3.1 (you have 1.2.0). Please `gem update --system` and try again.
$ sudo gem update --system
Updating RubyGems
Nothing to update

I haven't hit this issue myself but I've seen this as a possible solution:
$ sudo gem install rubygems-update
Successfully installed rubygems-update-1.3.0
1 gem installed
$ sudo update_rubygems
This should let you install the updating via the specific updater gem.
Referenced here: updating rubygems

Related

Difference between `update_rubygems` and `gem update --system`

What is the difference between this command:
gem update --system
And these commands:
gem install rubygems-update
update_rubygems
gem update --system
I would've assumed that the former would be all that is required in order to update to the latest version of RubyGems, but I have found many references (including https://stackoverflow.com/a/13626200/1369417) which recommend the latter.
gem install rubygems-update; update_rubygems was needed in some old versions of rubygems, but gem update --system is all that's needed for the foreseeable future.
rubygems 1.1 and 1.2 had bugs that prevented gem update --system from working the first time, so you had to use those first two commands to upgrade at all. There would be no reason to run gem update --system immediately thereafter, because rubygems would already be updated, but doing so would demonstrate that you would be able to run that command in the future.
Versions of rubygems before 1.5.2 did not accept a version argument following gem update --system, so you had to use the first two commands you give to install an arbitrary version of rubygems. You wouldn't want to run gem update --system immediately thereafter; it would undo what you'd just done.
More here: https://github.com/rubygems/rubygems/blob/master/UPGRADING.md
When I execute both , apparent difference is:
update_rubygems - update gem to the current update_rubygems version.
gem update --system (without version option) - update to latest version.
For example, when the following situations:
gem: 3.0.6
update_rubygems: 3.2.17
latest gem: 3.3.8
then,
$ sudo update_rubygems --no-document
...
$ gem -v
3.2.17
while
$ sudo gem update --system --no-document
...
$ gem -v
3.3.8
That's current result as of today.

How to upgrade rubygems

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:~$
Install rubygems-update
gem install rubygems-update
update_rubygems
gem update --system
run this commands as root or use sudo.
You can update all gems by just performing:
sudo gem update
Or:
gem update `gem outdated | cut -d ' ' -f 1`
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'
For me it sufficed to simply run
gem update
I wouldn't use the debian packages, have a look at RVM or Rbenv.
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
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>

dev_appserver.rb cannot start after rubygems update on Ubuntu 10.04

I had rubygems 1.3.5 (or 1.3.6?) installed and then made a sudo gem update after a long while again. Some gems complained they needed a newer gems version. Because sudo gem update --system is deactivated on Ubuntu I followed these steps: How can I get RubyGems 1.3.6 on Ubuntu 10.4
But now I cannot start the dev_appserver.rb anymore, it says:
=> Bundling gems
ERROR: While executing gem ... (RuntimeError)
Unknown command bundle
I also tried to do sudo gem update and sudo gem update --system again a few times but everything is up-to-date now. Here is a list of my gems: http://pastebin.com/cFaTCyF5
It's a bit of a hack around but I can't really tell what's going on properly from what you sent but I know a few people have been having problems after running gem update --system lately. Find out what version you've just installed with
gem list
Look for the update, should look something like this: rubygems-update-1.5.0
Then try rolling back your rubygems version
sudo gem uninstall rubygems-update -v 1.5.0
sudo gem install rubygems-update -v 1.4.2 <-- try a different version
gem install --system 1.3.7 worked in my case

RubyGems - my system can't seem to find any remote gems to install

Trying to install the 'less' gem. I type sudo gem install less as instructed at http://lesscss.org/, and I get the following error:
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find less (> 0) in any repository
Alright, so I figure maybe I just need to update RubyGems. Trying 'gem update --system' gets me
Updating RubyGems...
Attempting remote update of rubygems-update
ERROR: While executing gem ... (Gem::InstallError)
rubygems-update requires builder >= 0
Arrgh. Alright, then let's try 'sudo gem install builder':
ERROR: While executing gem ... (Gem::GemNotFoundException)
Could not find builder (> 0) in any repository
Seems that no matter what gem I try to install, it can't be found in any repository. I check my environment, and rubyforge is listed:
RubyGems Environment:
- VERSION: 0.9.4 (0.9.4)
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/1.8
- GEM PATH:
- /usr/local/lib/ruby/gems/1.8
- REMOTE SOURCES:
- http://gems.rubyforge.org
Any idea what's going on? I'm on OSX 10.4, and I installed Ruby 1.8.6 before this.
I think rubygems 1.3.x requires ruby 1.8.7 so you might install that first. Then update rubygems to 1.3.7. via gem update --system
The version of rubygems bundled in osx uses gemforge as its offical source of gems - this has since been replaced with gemcutter. You should be able to do
sudo gem update --system
To upgrade to update the latest version of ruby gems, which will then use gemcutter as the sources link
That's a really old version of rubygems! How did you install this?
Is it a manual install? If so, perhaps you could try a manual upgrade the same way.
Do the following:
sudo gem update --system
to update your install of RubyGems. Then, add the Github gem repository to your sources. I suggest github because you'll find a lot of useful things there:
sudo gem sources -a http://gems.github.com

How do you downgrade rubygems?

I have rubygems 1.3.1 installed but I want to go back to 1.2.0. What's the command to downgrade rubygems?
This worked for me when downgrading from 1.5.2 to 1.4.2 because of old rails version:
sudo gem update --system 1.4.2
More information about downgrading/upgrading rubygems: https://github.com/rubygems/rubygems/blob/master/UPGRADING.md
Updated November 2011: Now that RVM's out, try running rvm install rubygems <version>.
If you're using RVM, then you can do this to remove current ruby gems, then upgrade/downgrade rubygems:
rvm install rubygems 1.4.2
This just worked for me on OSX to get from 1.5.0 back to 1.4.2
sudo gem uninstall -v '1.5.0' rubygems-update
sudo gem update --system --local
I had a similar problem in an old Rails 3 stack. When these type of issues occur, my recommendation is to go onto the production server that the application is currently running in and check out which rubygems version it is using:
gem -v
For me, it was using 1.8.24. So all I needed to do is downgrade my current rubygems which was generated from "rvm install 1.9.3", when I installed the old ruby for this app. I ran the following command:
$ rvm install rubygems 1.8.24 --force
And it worked. Note I am running Ubuntu 14.04 and the server I am using is also Ubuntu.
I used this command to go back to the gem version that my ruby version needed:
rvm rubygems current
If it gives checksum errors try
rvm rubygems current --verify-downloads 1
That did the trick for me.

Resources