How to use bundler behind a proxy?

OSX & Linux

export http_proxy=http://user:password@host:port
export HTTP_PROXY=$http_proxy

If it’s using HTTPS, set it as well

export https_proxy=http://user:password@host:port
export HTTPS_PROXY=$https_proxy

If you use sudo, by default sudo does not preserves http proxy variable. Use -E flag to preserve it

$ sudo -E bundle install

to make sudo preserves environment variables by default:

https://memset.wordpress.com/2010/10/14/bash-http_proxy-from-a-user-environment-to-sudo-one/

Windows

As pointed by answers below, you can use SET instead

SET HTTP_PROXY=http://user:password@host:port
SET HTTPS_PROXY=%HTTP_PROXY%

Leave a Comment