RubyGems

The RubyGems package manager.

gem emits no machine-readable format, so installed, outdated and search listings are parsed from its text output. A gem can keep several versions installed side by side (molinillo (0.5.4, 0.4.5, 0.2.3)); mpm reports the highest as the installed version.

Note

All operations target the default gem scope (controlled by GEM_HOME). On system Ruby this means system-level gems, which may require elevated privileges for write operations. Per-scope targeting (system vs user gems) is tracked in #1725.

Tip

Installs require sudo on system ruby. I (@tresni) recommend doing something like:

$ sudo dseditgroup -o edit -a -t user wheel

And then do visudo to make it so the wheel group does not require a password. There is a line already there for it, you just need to uncomment it and save.

Platforms

  • 🅱️ BSD

  • 🐧 Linux

  • 🍎 macOS

  • ⨂ Unix

  • 🪟 Windows

Operations

Operation

Supported

Notes

installed

outdated

search

extended search backfilled by mpm

install

upgrade

upgrade_all

remove

sync

cleanup

Ecosystem

  • Accepted purl types: pkg:gem, pkg:rubygems

Usage

$ mpm --gem installed
$ mpm --gem search "query"
$ mpm --gem upgrade --all
$ mpm install pkg:gem/hello
$ mpm --dry-run --gem upgrade --all

Every example above accepts --dry-run, which simulates the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.

Deselect the manager for a single run with --no-gem, disable it from your configuration, or tune its invocation attributes with per-manager overrides.

Command line

  • CLI names, in lookup order: gem

  • Arguments forced after each call: --quiet

The version is extracted from the output of gem --version with:

r"(?P<version>\S+)"

Privilege escalation

mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.

See privilege escalation for the full policy.

Cooldown

State of RubyGems’s release-age gating, from the cooldown support table:

  • Status: 🚧 Proposed (Bundler PR open)

  • Mechanism: --cooldown / BUNDLE_COOLDOWN / per-source cooldown:

  • Reference: ruby/rubygems#9576

With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --allow-unsupported-managers opts back in.

Reference traces

Raw native outputs captured in the manager source: the reference mpm’s parsers were written against. If you know RubyGems well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ gem list --quiet
bigdecimal (default: 1.4.1)
bundler (default: 1.17.2)
CFPropertyList (2.3.6)
cmath (default: 1.0.0)
csv (default: 3.0.9)
date (default: 2.0.0)
fileutils (1.4.1, default: 1.1.0)
io-console (0.5.6, default: 0.4.7)
ipaddr (default: 1.2.2)
molinillo (0.5.4, 0.4.5, 0.2.3)
nokogiri (1.5.6)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
sqlite3 (1.3.7)
test-unit (2.0.0.0)
$ gem outdated --quiet
did_you_mean (1.0.0 < 1.0.2)
io-console (0.4.5 < 0.4.6)
json (1.8.3 < 2.0.1)
minitest (5.8.3 < 5.9.0)
power_assert (0.2.6 < 0.3.0)
psych (2.0.17 < 2.1.0)