ruby-install
ruby-install copied to clipboard
proxy support
On OSX Maverick (10.9.1), using bash shell 3.2.51(1), and ruby-install 0.4.0
I love ruby-install but does not seem to work with proxy.
I have my http_proxy and https_proxy correctly and can do a curl manually and get the files.. but does not seem to work when running "ruby-install ruby 2.1.1"
I get bunch of timeout. So I suspect those ENV variable are not passed/defined in the shell executed by ruby-install
Did you export those variables, so they will be passed to all sub-processes?
I did . I exported both http_proxy and https_proxy. Which is why I dont know why it timeout.
Doing a curl in that same terminal to those URL works though. But when ruby-install tries, it is timing out
Here is a sample. And I had set the variables using export
% echo $http_proxy
http://one.proxy.att.com:8080
Emmanuel ~/apis ☺ 2.1.0p0
% echo $https_proxy
http://one.proxy.att.com:8080
Emmanuel ~/apis ☺ 2.1.0p0
% ruby-install ruby 2.1.1
Installing ruby 2.1.1 into /Users/Emmanuel/.rubies/ruby-2.1.1 ... Installing dependencies for ruby 2.1.1 ... ==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0.1f.mavericks.bottle.tar.gz
curl: (7) Failed connect to downloads.sf.net:443; Operation timed out Error: Failed to download resource "openssl" Download failed: https://downloads.sf.net/project/machomebrew/Bottles/openssl-1.0.1f.mavericks.bottle.tar.gz Warning: Bottle installation failed: building from source. ==> Downloading https://www.openssl.org/source/openssl-1.0.1f.tar.gz
curl: (28) Connection timed out after 5148 milliseconds Trying a mirror... ==> Downloading http://mirrors.ibiblio.org/openssl/source/openssl-1.0.1f.tar.gz
curl: (7) Failed connect to mirrors.ibiblio.org:80; Operation timed out Error: Failed to download resource "openssl" Download failed: http://mirrors.ibiblio.org/openssl/source/openssl-1.0.1f.tar.gz Error: readline-6.2.4 already installed Error: libffi-3.0.13 already installed ==> Upgrading 3 outdated packages, with result:
Could you just double check that they are listed not only in set | grep -aE "http_proxy|https_proxy"
but also in env | grep -aE "http_proxy|https_proxy"
?
I could not reproduce this for on Fedora 19 with bash 4.2 when forcing it to use wget
or curl
:
wget
$ export http_proxy=http://one.proxy.att.com:8080
$ ./bin/ruby-install --no-install-deps ruby
>>> Installing ruby 2.1.0 into /home/hal/.rubies/ruby-2.1.0 ...
>>> Downloading http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.bz2 into /home/hal/src ...
--2014-02-25 17:08:48-- http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.bz2
Resolving one.proxy.att.com (one.proxy.att.com)... failed: Name or service not known.
wget: unable to resolve host address ‘one.proxy.att.com’
curl
$ export http_proxy=http://one.proxy.att.com:8080
$ ./bin/ruby-install --no-install-deps ruby
>>> Installing ruby 2.1.0 into /home/hal/.rubies/ruby-2.1.0 ...
>>> Downloading http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.bz2 into /home/hal/src ...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0curl: (5) Could not resolve proxy: one.proxy.att.com; Name or service not known
!!! Download of http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.0.tar.bz2 failed!
The proxy variables are being passed to curl
/wget
. Perhaps you also need to specify a user/password for the proxy?
They seem to be correct for env and set
set | grep -aE "http_proxy|https_proxy" http_proxy=http://one.proxy.att.com:8080 https_proxy=http://one.proxy.att.com:8080
env | grep -aE "http_proxy|https_proxy" http_proxy=http://one.proxy.att.com:8080 https_proxy=http://one.proxy.att.com:8080
And I don t need user or password when I do it manually.
I can see the google page correctly if I do
curl www.google.com -v
<html itemscope="" itemtype="http://schema.org/WebPage"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta itemprop="image" content="/images/google_favicon_128.png"><title>Google</title><script> ...
I wonder what running (env | grep -i http_proxy)
shows? I suspect the variables are set, but not actually being passed to sub-processes. Also, where are you setting these variables?
So I set them manually in my terminal. And I suspect the same. That somehow the subprocess are not seeing them. Just don t make sense why. Only thing I can add is that I am on Maverick and Bash.
(env | grep -i http_proxy)
http_proxy=http://one.proxy.att.com:8080
+1
As a workaround, we could add a --proxy
option and explicitly pass that to wget
/curl
.
that would work for me!
me too! Thanks.
I have the same problem. Any workarounds ?
If anyone wants to submit a PR to pass proxy options to both curl
and wget
, I'd accept it!
I hit this issue when ruby-install tries to install via brew. Calling brew directly works.
Installing everything manually with brew and then continuing works.
I think this is due to the following lines:
https://github.com/postmodern/ruby-install/blob/bb5328a6cf28bf1dbe21cc60d0de30e53afea1a1/share/ruby-install/util.sh#L96-L100
sudo -E
(preserve environment) might help, but will fail if the user is not allowed to preserve the environment.
As an addition to @skade comment, I tried to preserve proxy settings via sudoers file (/private/etc/sudoers
). You'll need to add your settings to env_keep
section.