Maintaining Environment Variables with sudo
Especially useful if you need to use proxies. E.g., this will fail since
sudo user doesn’t know about the
sudo curl -L https://get.rvm.io | bash -s stable --ruby
The solution is to
visudo, find this
and add this for each variable you want available.
Defaults env_keep += "variable1 variable2"
In the case of proxies,
Defaults env_keep += "http_proxy https_proxy ftp_proxy"