# Gem on macbook SLOW

**URL:** <https://www.ruby-forum.com/t/gem-on-macbook-slow/131861>\
**Category:** Ruby\
**Created:** [March 13, 2008, 11:07pm UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861 "2008-03-13T23:07:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![ehuard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@ehuard](https://www.ruby-forum.com/u/ehuard)\
**Post date:** [March 13, 2008, 11:07pm UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861/1 "2008-03-13T23:07:07Z")

</div>

Hello,

i’ve got a brand new Macbook Pro.  
I’ve got ruby 1.8.6, as well as the usual gems.  
However, running gem install, or even rspec (which uses gem) takes a  
long time (2 minutes). I’ve tried debugging, and got as far as  
updated = @source\_index.update source\_uri  
in source\_info\_cache\_entry.rb, which seems to take a while (there  
might be other slow parts, that’s just one of them).  
It all works, but for rspec for instance it’s quite annoying to have  
to wait that long.  
I tried profiling but that didn’t yield anything that i could parse.

Any ideas or similar experience ?  
Thanks,

Elise

---

<div class="post-metadata">

**Author:** ![ehuard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@ehuard](https://www.ruby-forum.com/u/ehuard)\
**Post date:** [March 13, 2008, 11:46pm UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861/2 "2008-03-13T23:46:51Z")

</div>

On Thu, Mar 13, 2008 at 5:05 PM, Elise H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Any ideas or similar experience ?  
> Thanks,
> 
> Elise

What version of RubyGems are you running? This behavior has been  
improved in the newer versions (post 1.0, I believe).

hth,

Gordon

---

<div class="post-metadata">

**Author:** ![ehuard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@ehuard](https://www.ruby-forum.com/u/ehuard)\
**Post date:** [March 14, 2008, 12:08am UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861/3 "2008-03-14T00:08:36Z")

</div>

On Fri, Mar 14, 2008 at 07:05:24AM +0900, Elise H. wrote:

> to wait that long.  
> I tried profiling but that didn’t yield anything that i could parse.
> 
> Any ideas or similar experience ?

Yes. Ruby gems does not use keep alive connections when fetching data  
from the remote gem server. I worked with Eric to fix gems to use keep  
alive connections and it was about 10x faster (IIRC).

[http://rubygems.rubyforge.org/svn/trunk/lib/rubygems/remote\_fetcher.rb](http://rubygems.rubyforge.org/svn/trunk/lib/rubygems/remote_fetcher.rb)

You should see a huge speed improvement on the next release of Rubygems.

---

<div class="post-metadata">

**Author:** ![ehuard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@ehuard](https://www.ruby-forum.com/u/ehuard)\
**Post date:** [March 14, 2008, 12:55am UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861/4 "2008-03-14T00:55:30Z")

</div>

On Mar 13, 4:02 pm, Elise H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> to wait that long.  
> I tried profiling but that didn’t yield anything that i could parse.
> 
> Any ideas or similar experience ?  
> Thanks,
> 
> Elise

You might want to check out this thread:  
[http://groups.google.com/group/comp.lang.ruby/browse\_thread/thread/4fc65cdd3afbad00](http://groups.google.com/group/comp.lang.ruby/browse_thread/thread/4fc65cdd3afbad00)

I had the same problem, but only after updating to Leopard. In that  
thread I mention changing my DNS servers, but I’ve dropped that part  
of the solution. Basically, what I did was disable IPv6 (System  
Preferences → Network → Advanced → TCP/IP → Configure IPv6) and  
add “require ‘resolv-replace’” to my copy of gem at /usr/local/bin/gem  
(of course, that goes away after gem update --system).

HTH,  
Chris

---

<div class="post-metadata">

**Author:** ![ehuard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@ehuard](https://www.ruby-forum.com/u/ehuard)\
**Post date:** [March 14, 2008, 1:25pm UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861/5 "2008-03-14T13:25:54Z")

</div>

On 14 mar, 00:53, Chris S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > updated = @source\_index.update source\_uri
> 
> Chris  
> Thanks ! I’ll try that tonight. Failing that, i’ll check the  
> version, and upgrade if dated.  
> Best Regards,

Elise

---

<div class="post-metadata">

**Author:** ![ehuard](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/e95f7d/32.png) [@ehuard](https://www.ruby-forum.com/u/ehuard)\
**Post date:** [March 16, 2008, 5:41pm UTC](https://www.ruby-forum.com/t/gem-on-macbook-slow/131861/6 "2008-03-16T17:41:48Z")

</div>

On 14 Mar 2008, at 12:24, Elise H. wrote:

> > > long time (2 minutes). I’ve tried debugging, and got as far as  
> > > Elise  
> > > (of course, that goes away after gem update --system).
> > 
> > HTH,  
> > Chris
> 
> Thanks ! I’ll try that tonight. Failing that, i’ll check the  
> version, and upgrade if dated.  
> Best Regards,
> 
> Elise

Also, I have noticed that gem installs run significantly faster from a  
machine in the western hemisphere (inside anywhere in the US).

Is there a need for more EU mirrors presently? Are the mirrors geo-  
distributing correctly?
