Joshua Spence
Joshua Spence

Reputation: 772

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.

Upvotes: 8

Views: 4420

Answers (2)

Fumisky Wells
Fumisky Wells

Reputation: 1199

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.

Upvotes: 0

Dave Schweisguth
Dave Schweisguth

Reputation: 37607

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

Upvotes: 9

Related Questions