open - running a ruby gem

Viewing a Gem's Source Code (4)

I usually open a gem by running this command from the console

EDITOR=<your editor> bundle open <name of gem>

Ruby dabbler/newbie here who's not familiar with the ecosystem, so apologies if this is one of those super duh questions.

Is there a way to view all the files and/or source code installed by a gem? That is, I just ran

$ gem install sass

And the sass gem is now a part of my local system

$ gem list --local
sass (3.1.16, 3.1.2)

I want to know what the gem install command put on my system. Is there a command I can run to see all the files installed by the gem?

After some googling, man gem and gem help commands, I discovered the contents command.

$ gem contents sass

However, when I run this command with the aforementioned sass gem, I get the following results


However, this list seems incomplete as I know there are files in


Why does contents not show the files from lib?

Is it possible for a gem installer to install files outside of the gems folder?

Is there a command that can show everything installed by a gem?

In addition to gem contents, another command you might find useful is gem environment. If you have multiple paths for your gem installations, they will all be listed under the "GEM PATHS" label.

There are two really good ways to do this. There is another gem which allows you to open the gem and edit. This gem is call gem-open

gem install gem-open 


gem open sass

Another way is to generate your own rdocs.

gem rdoc sass

You can then look at your rdocs by

gem server

Also if you are using rvm, you can type rvm info and it will show GEM_HOME location. This will be where all your gems source code is.

cd gems/sass-3.1.2/


This is the way I mostly do this now, when using bundler.

cd $(bundle show sass) 

This will be the version of sass in your Gemfile.