How to install gem through proxy with authorization

I am behind a corporate proxy server and he needs authorization to use it. When I try to use the -p http://ip.of.my.proxy:3128 option -p http://ip.of.my.proxy:3128 , it throws error 407. Is there a workaround?

+8
ruby proxy rubygems gem
source share
3 answers

It may help you: How to upgrade Ruby Gems due to proxy (ISA-NTLM)

+3
source share

This solution works for me in an analog situation (corporate network behind an authorized proxy):

  • Create a .gemrc file under your HOME (in my case C: \ Documents and Settings \ my_username \ .gemrc
  • Write this single line inside the previous file:

http_proxy: http://<YOUR_USER>:<YOUR_PASSWORD>@<YOUR_PROXY_HOST>:<YOUR_PROXY_PORT>

+9
source share

This is how I understood it. Hope this works for you too.

  • Fill in the proxy server in the proxy server settings (depends on your system).
  • Once you're done with the proxy settings, just do it (assuming the Linux system)
 sudo -i gem install GEM_NAME 

Please note that the authorizationi.e username and password must be filled in the proxy settings for the system.

If you are not a root user or want to install the gem locally (if using RVM), do not use sudo then.

+1
source share

All Articles