LinuxmacOSWindows

Where Does RubyGems Install Gems (GEM_HOME)?

RubyGems installs into GEM_HOME, defaulting to ~/.gem with executables in its bin folder needing PATH.

Last updated

RubyGems installs each gem version into a home directory, defaulting to a versioned folder under ~/.gem. Executables land in its bin subdirectory, which only works when that bin sits on PATH.

Version managers relocate all of this per Ruby, which is why gem lists differ between rubies. Run gem env home to print the effective directory instead of guessing across managers.

Where RubyGems stores this, by platform

Linux
~/.gem

Default GEM_HOME with ruby version subfolders and bin inside. Managers like rbenv and RVM redirect per Ruby. Confirm with gem env home and add its bin to PATH.

macOS
~/.gem

Same default on Mac. System Ruby writes elsewhere, which is why user installs should set GEM_HOME explicitly or use a manager.

Windows
%USERPROFILE%\.gem

Same layout on Windows. RubyInstaller pairs it with its own DevKit. gem env home prints the live path when managers interfere.

Frequently asked questions

how do i find where my gems are installed

Run gem env home. It prints the effective directory for the active Ruby, which moves under version managers.

why is my installed gem command not found

Its bin directory is not on PATH. Add the bin under gem env home to PATH and reopen the shell.

should i use sudo gem install

Prefer user installs into ~/.gem. Sudo writes to system paths and tangles permissions for later user installs.

Notice an outdated path? Let us know.