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

2019-01-01 12:00发布

The firewall I'm behind is running Microsoft ISA server in NTLM-only mode. Hash anyone have success getting their Ruby gems to install/update via Ruby SSPI gem or other method?

... or am I just being lazy?

Note: rubysspi-1.2.4 does not work.

This also works for "igem", part of the IronRuby project

18条回答
孤独寂梦人
2楼-- · 2019-01-01 12:14

This totally worked:

gem install --http-proxy http://COMPANY.PROXY.ADDRESS $gem_name
查看更多
妖精总统
3楼-- · 2019-01-01 12:16

I am working behind a proxy and just installed SASS by downloading directly from http://rubygems.org.

I then ran sudo gem install [path/to/downloaded/gem/file]. I cannot say this will work for all gems, but it may help some people.

查看更多
伤终究还是伤i
4楼-- · 2019-01-01 12:17

For the Windows OS, I used Fiddler to work around the issue.

  1. Install/Run Fiddler from www.fiddler2.com
  2. Run gem:

    $ gem install --http-proxy http://localhost:8888 $gem_name
    
查看更多
皆成旧梦
5楼-- · 2019-01-01 12:17

Create a .gemrc file (either in /etc/gemrc or ~/.gemrc or for example with chef gem in /opt/chef/embedded/etc/gemrc) containing:

http_proxy: http://proxy:3128

Then you can gem install as usual.

查看更多
永恒的永恒
6楼-- · 2019-01-01 12:18

If you are having problems getting authenticated through your proxy, be sure to set the environment variables in exactly the format below:

set HTTP_PROXY=some.proxy.com
set HTTP_PROXY_USER=user
set HTTP_PROXY_PASS=password

The user:password@ syntax doesn't seem to work and there are also some badly named environment variables floating around on Stack Overflow and various forum posts.

Also be aware that it can take a while for your gems to start downloading. At first I thought it wasn't working but with a bit of patience they started downloading as expected.

查看更多
只若初见
7楼-- · 2019-01-01 12:19

If you want to use SOCKS5 proxy, you may try rubygems-socksproxy https://github.com/gussan/rubygems-socksproxy.

It works for me on OSX 10.9.3.

查看更多
登录 后发表回答