LoginSignup
27

More than 5 years have passed since last update.

bundle install を並列実行するとかなり快適になった

Last updated at Posted at 2015-10-07

CircleCI のログを眺めてたら、便利なオプションを見つけました。
bundle install--jobs=4 をつけると並列処理してくれるみたいです。(Bundler v1.5 以上

bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 
The following gems are missing
 * autodoc (0.5.0)
 * jbuilder (2.3.1)
 * rspec-json_matcher (0.1.5)
Install missing gems with `bundle install`
Fetching gem metadata from https://rubygems.org/..........
Fetching gem metadata from https://rails-assets.org/..
Fetching version metadata from https://rubygems.org/...
Fetching version metadata from https://rails-assets.org/..
Fetching dependency metadata from https://rubygems.org/..
Fetching dependency metadata from https://rails-assets.org/..
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
Fetching gem metadata from https://rails-assets.org/..
Fetching version metadata from https://rails-assets.org/.
Using i18n 0.7.0
Using json 1.8.3
Using rake 10.4.2
Using CFPropertyList 2.3.1
Using minitest 5.7.0
(省略)

CPU コア数にあわせて --jobs オプションを指定すれば、bundle install が遅い問題を解消できて、きっと幸せになれるはず。

追記)Mac 上で、CPU コア数をもとに設定する

bundle config --global jobs `expr $(sysctl -n hw.ncpu) - 1`

上記のコマンドを実行すると

~/.bundle/config
BUNDLE_JOBS: '3'

と設定される。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
27