Configure your proxy configuation in your bash_profile

Kevin ABRIOUX
1 min readJul 18, 2019

In some case, when you want to use gem, it could be possible you are behind a proxy.

To avoid this case, you need to set your proxy’s information in your bash_profile.

Go to your home’s folder

cd ~/

Create your bash_profile

touch .bash_profile

Now you can edit your bash_profile and add this function

enableproxy() {
export HTTP_PROXY=http://my.proxy.here:port.number
export HTTPS_PROXY=http://my.proxy.here:port.number
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTPS_PROXY
git config — global http.proxy http://my.proxy.here:port.number
git config — global https.proxy http://my.proxy.here:port.number
}
#Delete this line to proxy usage
enableproxy

Don’t forget to replace http://my.proxy.here:port.number with your own proxy’s URL

Back in your terminal, reload .bash_profile

. .bash_profile

That’s it

--

--