# Howto gem thru a proxy

**URL:** <https://www.ruby-forum.com/t/howto-gem-thru-a-proxy/85551>\
**Category:** Ruby\
**Created:** [February 14, 2007, 3:10pm UTC](https://www.ruby-forum.com/t/howto-gem-thru-a-proxy/85551 "2007-02-14T15:10:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [February 14, 2007, 3:10pm UTC](https://www.ruby-forum.com/t/howto-gem-thru-a-proxy/85551/1 "2007-02-14T15:10:32Z")

</div>

high

my problem was the following:

H:\>gem search bla --remote

\*\*\* REMOTE GEMS \*\*\*  
ERROR: While executing gem … (Errno::EBADF)  
Bad file descriptor - connect(2)

a long time i could not figure out, why this happens - though i had  
the intention, it must be, because i only can go thru a proxy to the i-  
net. so, here is finally the solution, if you suffer the same  
circumstances.

1. find out, what your proxy url is (in your functioning browsers  
options you will find something like a [sol.org](http://terra.sol.org/proxy.pac);  
donwload this, open in an editor an find your proxy-server url)

2. assuming your proxys url is: [http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080), set  
an environment variable called http\_proxy to that url:

open a shell/command-window an do:

REALOS\> export http\_proxy=[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
NOOS\> set http\_proxy=[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
ANYOS\> gem install fxri

thats it

have fun!

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 27, 2009, 2:42pm UTC](https://www.ruby-forum.com/t/howto-gem-thru-a-proxy/85551/2 "2009-03-27T14:42:35Z")

</div>

unknown wrote:

> high
> 
> my problem was the following:
> 
> H:\>gem search bla --remote
> 
> \*\*\* REMOTE GEMS \*\*\*  
> ERROR: While executing gem … (Errno::EBADF)  
> Bad file descriptor - connect(2)

> 1. find out, what your proxy url is (in your functioning browsers  
> options you will find something like a [sol.org](http://terra.sol.org/proxy.pac);  
> donwload this, open in an editor an find your proxy-server url)
> 
> 2. assuming your proxys url is: [http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080), set  
> an environment variable called http\_proxy to that url:
> 
> open a shell/command-window an do:
> 
> REALOS\> export http\_proxy=[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
> NOOS\> set http\_proxy=[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
> ANYOS\> gem install fxri
> 
> thats it
> 
> have fun!

hi,  
i tried the above solution. but still i get the same error

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 27, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/howto-gem-thru-a-proxy/85551/3 "2009-03-27T16:55:50Z")

</div>

Does this work for you:

gem query --remote --name-matches doom -p  
[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
where:  
“[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)” is :

I took it from here:  
[http://docs.rubygems.org/read/book/1](http://docs.rubygems.org/read/book/1)

and:  
[http://docs.rubygems.org/read/chapter/13#page51](http://docs.rubygems.org/read/chapter/13#page51)

–Axel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [March 28, 2009, 3:02pm UTC](https://www.ruby-forum.com/t/howto-gem-thru-a-proxy/85551/4 "2009-03-28T15:02:29Z")

</div>

unknown wrote:

> high
> 
> my problem was the following:
> 
> H:\>gem search bla --remote
> 
> \*\*\* REMOTE GEMS \*\*\*  
> ERROR: While executing gem … (Errno::EBADF)  
> Bad file descriptor - connect(2)
> 
> a long time i could not figure out, why this happens - though i had  
> the intention, it must be, because i only can go thru a proxy to the i-  
> net. so, here is finally the solution, if you suffer the same  
> circumstances.
> 
> 1. find out, what your proxy url is (in your functioning browsers  
> options you will find something like a [http://terra.sol.org/proxy.pac](http://terra.sol.org/proxy.pac);  
> donwload this, open in an editor an find your proxy-server url)
> 
> 2. assuming your proxys url is: [http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080), set  
> an environment variable called http\_proxy to that url:
> 
> open a shell/command-window an do:
> 
> REALOS\> export http\_proxy=[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
> NOOS\> set http\_proxy=[http://terra.sol.proxy.org:8080](http://terra.sol.proxy.org:8080)  
> ANYOS\> gem install fxri
> 
> thats it
> 
> have fun!

To install gems behind a proxy server just append at the end " -p  
[http://proxy.myserver.lan:8080](http://proxy.myserver.lan:8080)",  
where proxy.myserver.lan is your proxy address (check this from your  
browser settings).

For example to install the “rails” gem behind  
“[http://proxy.myserver.lan:8080](http://proxy.myserver.lan:8080)” i’ll use:  
##########

# gem install rails -p [http://proxy.myserver.lan](http://proxy.myserver.lan)

#########
