1. 2017-04-19 - Use ruby bundler behind a proxy; Tags: Use ruby bundler behind a proxy
    Loading...

    Use ruby bundler behind a proxy

    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