Trying to Install Ruby Gems On Windows Though a Proxy Server
- 15th June , 2007 by Sam in Ruby on Rails
- 0 comments
As with most larger businesses we have a corporate firewall which can lead to small annoyances, such as not being able to connect to rubyforge.org to download new gems. I recently had a new hard drive installed at work so, of course, I had to spend too much time reinstalling all of my development tools. Visual Studio 2005 takes way too long, btw.
Yesterday, I spent a good hour trying to get Rails with the standard gem install rails –include-dependencies. No luck due to our firewall. So I checked the ruby gems doc to find the correct install parameters. Still no luck. No matter which combination I tried to tell gem to look remotely through the proxy server it still wouldn’t go. So I asked the Google to help out and after reading through blog entries and message boards I stumbled upon one that talked about setting environment variables in linux. Well, I’m a windows guy so that didn’t help much but it gave me the idea to try and set a Windows environment variable. What the hell, right?
So, I added a User Variable for my account called http_proxy with the value of http://<proxyserveraddress>:8080, rebooted, ran plan old vanillia gem install rails –include-dependencies, and magically, it worked. See below the fold for details.
- Right click on My Computer and select Properties from the menu.
- Select the Advanced tab.
- Select the Environment Variable button.

- Select the New button in the User variables section.
- Give the new variable a name of http_proxy.
- Give the new variable a value of http://<proxyserveraddress>:8080 and replace <proxyserveraddress> with the name or IP address of your corporate proxy server.

- “OK” out of the three windows
- Reboot
- Run gem install rails –include-dependencies from the command line.
- Sit back and let the install fly.
You could also set a system wide environment variable if you wanted. Your choice.

