How to open installed gems in editor such Sublime Text or Text Mate or Atom?

I would like to do it from command line like:

open -a Sublime\ Text\ 2 something_here


If you use the Ruby that comes with 10.9, gems are installed in /Library/Ruby/Gems/2.0.0/:

open /Library/Ruby/Gems/2.0.0/gems/plist-3.1.0/lib/plist/parser.rb

If you use a Ruby installed with Homebrew, gems are installed in /usr/local/lib/ruby/gems/*/gems/.

| improve this answer | |
  • so, I need to search in directory /Library/Ruby/Gems/*? – gaussblurinc Mar 31 '14 at 13:03

If you are using bundler for your project, you can use bundle open to automatically open an installed gem in your editor as specified by the EDITOR environment variable. For example, EDITOR="subl -w" bundle open rake will open the version of rake your project is using in Sublime Text.

See http://bundler.io/v1.10/bundle_open.html

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .