8

I am trying to install ruby on windows 7 behind a proxy.

I have looked at various forums and have set (i think) the http_proxy successfully (see below)

SET HTTP_PROXY=http:username:password@http://proxyhere.com:8080

however, i now get the following error trying to install a gem:

SocketError: getaddrinfo: No such host is known.

Any ideas?

Adi
  • 4,034
  • 13
  • 56
  • 78
  • A possible duplication of this [thread](http://stackoverflow.com/questions/5319212/how-to-update-gems-in-ruby-for-windows) – rb512 May 17 '12 at 10:42

2 Answers2

12

The HTTP_PROXY syntax needs to be URI:

SET HTTP_PROXY=scheme://user:pass@host:port/path

scheme could be http or https and on some cases path could be absent.

No browser (or RubyGems) will accept as valid URL the one you provided.

So in your case:

SET HTTP_PROXY=http://username:password@proxyhere.com:8080/

Hope that helps

Luis Lavena
  • 10,348
  • 1
  • 37
  • 39
  • And what if I what to remove the proxy settings while working on a network without proxy? What should I do? – ben Sep 10 '14 at 15:58
  • @ben if proxy is already set, you need to do: `SET HTTP_PROXY=` which will unset the environment variable. You can also check your permanent environment variable settings (Google is your friend on how to change that) – Luis Lavena Sep 10 '14 at 16:12
5

At work i have a proyx also, SET HTTP_PROXY=http://proxyhere.com:8080 works there, so try it without usename/password. It depends on the type of proxy i presume.

You could also use:

gem install --http-proxy http://proxyhere.com:8080 $gem_name

See this for more info How do I update Ruby Gems from behind a Proxy (ISA-NTLM)

Sylhare
  • 5,907
  • 8
  • 64
  • 80
peter
  • 41,770
  • 5
  • 64
  • 108