Everywhere All articles Download Buy — $19

Where apps hide your files

Finding where gem install puts things

Updated 2026-10-28 · 5 min read

Where a gem lands depends on which Ruby is running, and a Mac can have several. One command, gem env, prints the exact folders for the Ruby your Terminal uses right now.

The location

Ask RubyGems, because the answer changes with your Ruby:

gem env

Look at the INSTALLATION DIRECTORY and GEM PATHS lines. For the Ruby that ships with macOS, on the Mac used for this guide (Ruby 2.6.10 at /usr/bin/ruby), they were:

/Library/Ruby/Gems/2.6.0
/Users/<you>/.gem/ruby/2.6.0
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0

The first is where gem install writes, the second is used with --user-install, and the third, inside the read-only system Ruby, holds the gems Apple ships with it. Print just the main folder with gem env gemdir. Open it in Finder with Go > Go to Folder (⇧⌘G), or use open "$(gem env gemdir)".

Which Ruby is yours

The location follows the Ruby, so first find out which one you are running:

which -a ruby
ruby -v
RubyWhere its gems go
macOS system Ruby (/usr/bin/ruby)/Library/Ruby/Gems/<ruby-version> for system installs, ~/.gem/ruby/<ruby-version> for --user-install.
rbenv~/.rbenv/versions/<version>/lib/ruby/gems/<ruby-version>, one set per Ruby.
RVM~/.rvm/gems/ruby-<version>, plus a separate @global set.
Homebrew Ruby/opt/homebrew/lib/ruby/gems/<ruby-version> on Apple silicon, /usr/local/lib/ruby/gems/<ruby-version> with Intel Homebrew. Gem commands go in its bin subfolder.

The rbenv and RVM rows follow each tool's one-folder-per-Ruby layout, and the Homebrew row comes from the ruby formula's own notes. None of the three had a Ruby installed on the Mac used here, so run gem env to confirm the folder for yours.

What is inside a gem folder

Inside the main gem folder you will find these subfolders, as seen in the system Ruby's folder on the Mac used here:

FolderWhat it holds
gemsThe installed gems, one folder per name and version, such as bundler-1.17.2.
specificationsOne small gemspec file per gem.
cacheThe downloaded .gem files.
extensionsCompiled native extensions.
docGenerated documentation.
build_infoBuild records.

Executables from gems go to the EXECUTABLE DIRECTORY that gem env prints, /usr/local/bin for the system Ruby here.

Why gem install says permission denied

The system gem folder is /Library/Ruby/Gems/..., owned by root. A plain gem install with the system Ruby therefore fails with a permissions error. There are three ways out. Installing with sudo works but mixes root-owned files into the system; installing to your home folder is cleaner:

gem install <name> --user-install

That uses the USER INSTALLATION DIRECTORY from gem env. The best fix is to install a Ruby of your own with rbenv, RVM or Homebrew, where gems go into folders you own and no sudo is needed. Remember that a user-install executable lives in ~/.gem/ruby/<version>/bin, which must be on your PATH.

Finding a gem's own files

You do not need to browse folders to find one gem. These print paths and read nothing else:

gem contents <name>
gem which <name>
gem list <name>

gem contents lists every file a gem installed, and gem which prints the path of the file that require would load. They are the quickest way to open a gem's source in your editor when you want to read or debug it.

Bundler and project gems

A project with a Gemfile usually installs into the shared gem folder above. If it sets a path, for example bundle config set --local path vendor/bundle, gems go inside the project instead. Check that one setting with bundle config get path. Be careful with the full bundle config listing and the global ~/.bundle/config file: they can hold credentials for private gem servers in plain text, so never paste them anywhere public. Bundler's documentation says a future Bundler 5 will default to a .bundle folder inside the project.

Space and cleanup

The system Ruby's gem folder was 122 MB on the Mac used here. See yours with du -sh "$(gem env gemdir)". To remove a gem the supported way:

gem uninstall <name>
gem cleanup

gem cleanup removes older versions of each gem, skipping any that another installed gem still needs. Preview it first with gem cleanup -n, which only reports what would go (newer RubyGems also accept --dry-run; the copy bundled with macOS knows only -n and --dryrun). For the system Ruby these commands need sudo, because the folder belongs to root. Do not delete folders under gems in Finder, because the matching specifications file stays behind and RubyGems still believes the gem exists.

Backing up or moving

Do not copy gem folders to a new Mac. Native extensions are compiled for one architecture and Ruby version. Instead, list your gems with gem list and reinstall them, or rely on each project's Gemfile.lock and run bundle install.

Why search misses these files

Spotlight and Finder searches leave out /Library/Ruby, and the user folders are hidden dot-folders. Gem files also sit many levels deep, so even a folder you open yourself shows a long list.

Finding a gem next time

Everywhere finds files in hidden folders and system locations, so typing a gem and version, such as bundler-1, lists every copy of it across the system Ruby, rbenv and Homebrew, and typing .gemspec finds specification files. Press ⌘↵ to reveal one. It matches file names only, so gem list remains the place to check versions.

Common questions

Where does gem install put gems on a Mac?

It depends on your Ruby. Run gem env and read INSTALLATION DIRECTORY. The system Ruby uses /Library/Ruby/Gems/<version>, and --user-install uses ~/.gem/ruby/<version>.

Where are gems stored with rbenv?

In the Ruby version's own folder under ~/.rbenv/versions. Each Ruby you install with rbenv keeps a separate set of gems.

Why do I get a permission error from gem install on a Mac?

The system Ruby's gem folder belongs to root. Use gem install <name> --user-install, or install your own Ruby with rbenv, RVM or Homebrew.

How do I list or remove installed gems?

gem list shows them and gem uninstall <name> removes one. gem cleanup -n previews the removal of old versions without deleting anything.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Version 2.20.3 · macOS 13+ · 4.7 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Buy a licence Articles Privacy Support