How to Update Gems in Ruby for Windows

How to update gems in Ruby for Windows?

First run (with administrator privileges):

gem update --system

Then run the update for activesupport.
I have that error one time, because i was behind a proxy, in that case, put:

gem update --http-proxy http://web.proxy.uri --system 

Installing RubyGems in Windows

I recommend you just use rubyinstaller

It is recommended by the official Ruby page - see https://www.ruby-lang.org/en/downloads/

Ways of Installing Ruby

We have several tools on each major platform to install Ruby:

  • On Linux/UNIX, you can use the package management system of your
    distribution or third-party tools (rbenv and RVM).
  • On OS X machines, you can use third-party tools (rbenv and RVM).
  • On Windows machines, you can use RubyInstaller.

How to upgrade rubygems

Install rubygems-update

gem install rubygems-update
update_rubygems
gem update --system

run this commands as root or use sudo.

Gem update on Windows - is it broken?

Gems, as of version 1.3.2, will now skip gems that fail to build, so update Rubygems to the latest version and the problem discussed here should be solved.

gem update --system

The following solution is now deprecated, but I leave it here for the record.

I started a thread on this issue on the Ruby Forum (it's a front end to the mailing list). There's some interesting discussion; it's worth a read. There's even a very hacky solution to this problem on there:

`gem.bat outdated`.split(/\n/).map{|z|z.scan(/^[^[:space:]]+/)}.flatten.each{|z| `gem.bat update #{z}`}

It calls the gem outdated command and builds a list of all of the outdated gems. It then iterates over the list and calls gem update for each individual outdated gem. If one fails, it just moves onto the next.

Various ways to update Ruby gems

The Gemfile is what you change to add/remove/update the gems (or just the versions of gems) running in your app. Gemfile.lock is the file that's automatically updated by bundler. In fact, you shouldn't try to manually update Gemfile.lock: first, because it's auto-generated, and second it's not intended to be altered by hand, and you're likely to confuse bundler if you alter it yourself.

To answer you list:

  1. bundle install installs any new/updated gems and dependencies - but if they are already installed, nothing is done
  2. bundle update runs through your installed gems, and grabs the newest, allowed versions, as defined in your Gemfile
  3. gem install my_gem.gem bypasses bundler, and installs the gem at the system level (i.e. outside your application's code bundle)
  4. gem update my_gem.gem bypasses bundler, and updates the gem at the system level (i.e. outside your application's code bundle)

So, one set of commands installs (if not already installed), one set of command updates to latest versions the gems that are already installed, one set of commands does these things within the scope of your app only (your application code bundle), and one set of commands does these things at the system level.

Git is not relevant to your question here.

How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

I wasn't able to get mine working from the command-line switch but I have been able to do it just by setting my HTTP_PROXY environment variable. (Note that case seems to be important). I have a batch file that has a line like this in it:

SET HTTP_PROXY=http://%USER%:%PASSWORD%@%SERVER%:%PORT%

I set the four referenced variables before I get to this line obviously. As an example if my username is "wolfbyte", my password is "secret" and my proxy is called "pigsy" and operates on port 8080:

SET HTTP_PROXY=http://wolfbyte:secret@pigsy:8080

You might want to be careful how you manage that because it stores your password in plain text in the machine's session but I don't think it should be too much of an issue.

How to install a gem or update RubyGems if it fails with a permissions error

You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

means exactly that, you don't have permission to write there.

That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.

Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.

Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.



Related Topics



Leave a reply



Submit