Install
gem install <gem>
Install the latest version
gem install <gem> -v "~> 1.2"
Install a version matching a constraint
gem install <gem> --user-install
Install into your home directory
Binaries then land in the user gem bin dir; add it to PATH
(gem env shows the path).
gem install <gem> --no-document
Skip generating docs (much faster)
gem install <gem> --prerelease
Allow prerelease versions
gem install <gem> -s <url>
Fetch from another source
gem install -g Gemfile
Install the gems a Gemfile lists
gem install <name>.gem
Install a local .gem file
gem install <gem> --conservative
Keep already-installed dependencies
gem fetch <gem>
Download the .gem file without installing
gem exec <cmd>
Run a gem's executable, installing if needed
List & search
gem list
List installed gems
gem list <regexp>
Filter installed gems by name
gem list -d
Include description and details
gem list <gem> -i
Is it installed? Prints true or false
gem search <regexp>
Search remote gems by name
gem search <regexp> -ae
Exact name, all versions
gem list -r <regexp>
List remote gems
gem info <gem>
Version, license, homepage, install path
gem contents <gem>
List an installed gem's files
gem which <file>
Path of a requireable file
gem dependency <gem>
Show a gem's dependencies
gem dependency <gem> -R
Show what depends on it
gem specification <gem>
Show the full gemspec
gem specification <gem> <field>
Show a single gemspec field
Update & remove
gem outdated
List gems with newer versions
gem update
Update all installed gems
Older versions stay installed; run gem cleanup to remove them.
gem update <gem>
Update one gem
gem update --system
Update RubyGems itself
gem update --system <version>
Move RubyGems to a given version
gem uninstall <gem>
Remove a gem
gem uninstall <gem> -v <version>
Remove one version
gem uninstall <gem> -a
Remove all versions without asking
gem uninstall <gem> -x
Also remove its executables
gem uninstall <gem> -I
Ignore dependency checks
gem cleanup
Remove old versions of gems
gem cleanup -n
Dry run: show what would go
gem pristine <gem>
Restore a gem to its packaged state
gem pristine --all
Restore every installed gem
gem stale
Gems by last file access
Build & publish
gem build <name>.gemspec
Package a gem into a .gem file
gem build <name>.gemspec -o <file>
Choose the output file name
gem build <name>.gemspec --strict
Fail on gemspec warnings
gem signin
Sign in and store an API key
gem push <name>-<version>.gem
Upload a gem to rubygems.org
gem push <file> --otp <code>
Push with a one-time MFA code
gem push <file> --host <url>
Push to another gem server
gem owner <gem>
List the owners of a gem
gem owner <gem> -a <email>
Add an owner
gem yank <gem> -v <version>
Pull a pushed version from the index
A yank cannot be undone and the version number cannot be
reused.
gem signout
Sign out of all sessions
gem unpack <gem>
Extract a gem into the current folder
gem open <gem>
Open a gem's source in your editor
gem rebuild <gem> <version>
Check that a published gem is reproducible