Loading...

Use ruby bundler behind a proxy

:heavy_exclamation_mark: This post is older than a year. Consider some information might not be accurate anymore. :heavy_exclamation_mark:

How to install the ruby bundler behind a proxy with sudo.

To use ruby bundler behind a proxy, define the proxy host in env variables http_proxy and https_proxy.

For instance

export http_proxy=http://10.0.2.2:3128
export https_proxy=https://10.0.2.2:3128

However if you need to sudo, because you have no write permission on the ruby gems folder, sudo does not preserve the http_proxy env variable. Therefore add following line in /etc/sudoers

Defaults        env_keep = "http_proxy ftp_proxy"

before this line:

Defaults        env_reset

After this you can install the bundler gem.

tan@omega:~/sources/my-awesome-site$ sudo gem install bundler
Fetching: bundler-1.14.6.gem (100%)
Successfully installed bundler-1.14.6
Parsing documentation for bundler-1.14.6
Installing ri documentation for bundler-1.14.6
Done installing documentation for bundler after 4 seconds
1 gem installed
Please remember the terms for blog comments.