# How to make "Installing Cookbook Gems:" faster

**URL:** <https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304>\
**Category:** Chef Infra (archive)\
**Created:** [August 9, 2017, 10:49am UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304 "2017-08-09T10:49:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://discourse.chef.io/u/Don)\
**Post date:** [August 9, 2017, 10:50am UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304/1 "2017-08-09T10:50:00Z")

</div>

Hi,

Whenever I run 'kitchen converge', the "Installing Cookbook Gems:" part takes pretty long time to pass.  
I tried using a proxy configuring .kitchen.yml as follow

> provisioner:  
> name: chef\_zero  
> chef\_omnibus\_url: [http://repo.example.net/install\_chef\_script.sh](http://repo.example.net/install_chef_script.sh)  
> http\_proxy: [http://proxy.example.net:8000](http://proxy.example.net:8000)  
> https\_proxy: [http://proxy.example.net:8000](http://proxy.example.net:8000)

and added following script in the install\_chef\_script.sh to make embedded ruby gem refers that file after installing chef client.

> sudo bash -c "cat \<\< EOF \> /opt/chef/embedded/etc/gemrc  
> gem: --no-ri --no-rdoc  
> benchmark: false  
> verbose: true  
> update\_sources: true  
> sources:  
> - [http://rubygems.org/](http://rubygems.org/)  
> backtrace: true  
> bulk\_threshold: 1000  
> EOF"

But after that, it still takes long time connecting the proxy server but downloading gem files using [https://rubygems.org/](https://rubygems.org/) which doesn't cache contents. I expect it will be faster when using http since the proxy(squid) caches contents when used with http.

Is there some way to configure 'sources' repos for embedded ruby gem to change the default one with 'http'? or Is there someone who knows better approach to solve this problem?

Please help  
Dongwon

---

<div class="post-metadata">

**Author:** ![coderanger](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/coderanger/32/5_2.png) [@coderanger](https://discourse.chef.io/u/coderanger)\
**Post date:** [August 9, 2017, 5:42pm UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304/2 "2017-08-09T17:42:38Z")

</div>

While you can technically use the `rubygems_url` config option in your client.rb or solo.rb to change this, I should point out that like most websites, [rubygems.org](http://rubygems.org) no longer allows non-HTTPS requests so you’ll just get redirected anyway. If you need to run an internal mirror, I would do that and then point `rubygems_url` at that instead.

---

<div class="post-metadata">

**Author:** ![Don](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Don](https://discourse.chef.io/u/Don)\
**Post date:** [August 9, 2017, 11:28pm UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304/3 "2017-08-09T23:28:36Z")

</div>

That’s good to know that http request is being redirected. I guess I should probably setup a local mirror as you said.  
Thank you for your advice!

---

<div class="post-metadata">

**Author:** ![grizzly](https://avatars.discourse-cdn.com/v4/letter/g/a9adbd/32.png) [@grizzly](https://discourse.chef.io/u/grizzly)\
**Post date:** [September 5, 2017, 6:21pm UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304/4 "2017-09-05T18:21:48Z")

</div>

How do you stop “Installing Cookbook Gems” running at all? If we know that then it’s possible to create a timestamp file that will restrict it to running eg once per day.

---

<div class="post-metadata">

**Author:** ![cheeseplus](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/cheeseplus/32/960_2.png) [@cheeseplus](https://discourse.chef.io/u/cheeseplus)\
**Post date:** [September 8, 2017, 8:36pm UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304/5 "2017-09-08T20:36:53Z")

</div>

There isn’t really a way to disable the installing of gems if they are set in `metadata.rb` of a cookbook as this is an in-built feature of chef-client. At least nothing short of making sure that no cookbooks in a given dependency tree utilize this feature so that it would be effectively a no-op.

---

<div class="post-metadata">

**Author:** ![Roland\_Moriz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/roland_moriz/32/857_2.png) [@Roland\_Moriz](https://discourse.chef.io/u/Roland_Moriz)\
**Post date:** [November 30, 2017, 4:21pm UTC](https://discourse.chef.io/t/how-to-make-installing-cookbook-gems-faster/11304/6 "2017-11-30T16:21:00Z")

</div>

FYI: Using Vagrant + VMWare Fusion I have super slow DNS resolving for SRV records which are used by rubygems. As you are using test-kitchen, maybe you have the same issue? Details at [https://github.com/chef/bento/issues/941](https://github.com/chef/bento/issues/941) - usually circumventing the VMWare Fusion DNS proxy by using Google DNS or any other speeds up any rubygems taks.
