📝 Edit on GitHub
Manage
Managing gems for Ruby and Jekyll projects
Check environment
$ gem env
$ bundle env
List installed gems
$ bundle list
Gems included by the bundle:
* addressable (2.7.0)
* ...
Names of directories:
$ ls vendor/bundle/ruby/2.6.0/gems
addressable-2.7.0 i18n-0.9.5 ...
...
Find gem locally
For a gem installed locally such as minima
theme.
Show path:
$ bundle show minima
<PATH_TO_REPO>/vendor/bundle/ruby/2.6.0/gems/minima-2.5.1
Open VS Code in that directory. Use open
to use your file browser.
$ code $(bundle show minima)
Gem CLI
Calling gem
from the shell.
See also plugins page.
Help
$ gem COMMAND --help
$ gem help COMMAND
Install
$ gem install GEMNAME
$ gem install GEMNAME --user-level
Update
Upgrade target gem.
$ gem update GEMNAME
Usage: gem update GEMNAME [GEMNAME ...] [options]
Upgrade many gems.
$ gem update
$ gem update --system
gem help update
Usage: gem update GEMNAME [GEMNAME ...] [options]
Options:
--system Update the RubyGems system software
Ruby gem command
Calling gem
from inside Ruby code including a Gemfile
.
See Gem versions page.
Bundler command
Gemfile should like this:
gem 'foo'
gem 'bar', '~> 2.5'
Then Bundler will use that.
$ bundle install
Install from GitHub
gem 'bar', git: 'https://github.com/foo/bar'