docs/dev-tools/backends/gem.md
The gem backend installs Ruby command-line applications from RubyGems into
separate tool directories. Keep application gems in your project's Gemfile and
install them with Bundler. The code for this is inside of the mise repository at ./src/backend/gem.rs.
This backend needs Ruby and its gem command. Gems with native extensions also
need the compiler and libraries required by that gem.
Declare Ruby and RuboCop in the same project:
mise use [email protected] gem:rubocop
mise exec -- rubocop --version
This writes both entries to mise.toml. Add -g for global configuration.
[tools]
ruby = "3.4"
"gem:rubocop" = "latest"
mise's wrappers set GEM_HOME for the selected tool. A RuboCop configuration
that uses project-specific plugins may be better run with bundle exec rubocop
from a Gemfile that declares those plugins.
If the Ruby version used by a gem package changes (whether managed by mise or the system), you may need to reinstall the gem. This can be done with:
mise install -f gem:rubocop
Reinstall under the Ruby version you intend to use. On Unix, mise-managed Ruby shebangs follow a minor-version path so patch upgrades can keep working; moving to another minor version or changing native-extension compatibility can still require a reinstall.
Set these with mise settings set [VARIABLE]=[VALUE] or by setting the environment variable listed.
The following tool-options are available for the gem backend—these
go in [tools] in mise.toml.
install_envSet environment variables for the gem install command. For gems that build
native extensions, MAKEFLAGS controls parallel make jobs:
[tools]
"gem:rubocop" = { version = "latest", install_env = { MAKEFLAGS = "-j4" } }