LoginSignup
6
0

More than 3 years have passed since last update.

bundle installとbundle updateの違い

Last updated at Posted at 2019-09-15

はじめに

Railsチュートリアルを進めていく中で、両者のコマンドの違いがいまいち理解出来なかったので、備忘録として投稿します。

両者の違い

  • bundle install ケース別によって動きが変わるため、以下図にまとめました。 スクリーンショット 2019-09-15 14.40.01.png

2019/9/17 追記
条件分岐の「Gemfileに変更あり」はより正確には「gem ごとに Gemfile の記述と Gemfile.lock の記述に差異がある」とご指摘をいただいたので、追記します。

  • bundle update Gemfileを元にGemをインストールする。 各Gemのバージョンと依存関係にあるGemとバージョンが最新になる。 インストール後、Gemfile.lockを更新する。

本番環境でbundle updateは原則使用しない。
bundle updateを行うと各Gemとバージョンが最新化され、開発環境と同じ動作にならなくなる可能性があるため。

用途

  • bundle install
    新規開発スタート...必要なGemをインストールするため。
    本番環境へデプロイ...開発環境と同じGemをインストールするため。
  • bundle update
    開発環境でGemを追加・更新...インストールするGem及び依存関係にあるGemを最新化させるため。

参考記事

6
0
2

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
6
0