LoginSignup
0

posted at

GemfileでグローバルインストールするGemを管理する

普段プロジェクトごとにGemfileを管理していますが、システム全体で使うGemもGemfileで管理したいと思い方法を調べました。

環境

Mac OS Big Sur 11.6
Bundler 2.2.32
Ruby 3.0.2
Gem 3.2.22

結論

好きな場所にGemfileを作成して

bundle install --system

これだけでシステム全体でGemが使えるようになります。

保存場所

自分の場合はrbenvを使いバージョン管理をしています。

そこで、 Gemfiles というフォルダを作り、その下でバージョンごとに管理することにしました。

好きな場所
Gemfiles
├── 2.6.3
│   └── Gemfile
│   └── Gemfile.lock
├── 2.6.6
│   └── Gemfile
│   └── Gemfile.lock
└── 3.0.2
    └── Gemfile
    └── Gemfile.lock

参考

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
What you can do with signing up
0