This page is not available in every language. Missing translations are disabled in the language selector.

Quick reference

RubyGems CLI Cheatsheet

A quick reference guide for RubyGems CLI: building, installing, publishing, yanking gems, search queries, and environment inspection.

· Published

RubyGems is the official package management framework and registry for Ruby libraries.

Building & Publishing Gems

# Build .gem binary from specification
gem build my_gem.gemspec

# Install built gem locally
gem install my_gem-1.0.0.gem

# Push gem to RubyGems.org registry
gem push my_gem-1.0.0.gem

# Remove / yank a specific version from index
gem yank my_gem -v 1.0.0

Managing Installed Gems

# Search remote registry for gems
gem search '^rails' --remote

# List all locally installed gems
gem list

# Check which version of a gem is currently active
gem which rake

# Update specific gem
gem update bundler

# Clean up old gem versions
gem cleanup

Environment & Configuration

# Display RubyGems environment details and gem path
gem env

# Gem cache and installation directory
gem env home

References

Related topics