Search code examples
rubygemsrvmgemset

RVM: List all gems in current gemset ignoring global & default


Looking for something like gem list within an RVM gemset but to have it ignore gems in the global and default gemsets so I can see, easily, exactly what gems are in the active gemset (and only the active gemset).


Solution

  • for global:

    rvm @global do gem list
    

    for other gemsets:

    GEM_PATH=$GEM_HOME gem list
    

    @global is a gemset that all other gemsets inherit for given ruby, it does not inherit for m itself so it's safe to select it and run gem list in it's context.

    For all other gemsets you can use the fact that gem list displays gems from all paths available in GEM_HOME and GEM_PATH, resetting GEM_PATH to be equal GEM_HOME will make only one path available - the one from GEM_HOME so gem list will only show gems in the selected gemset, ignoring all other gemsets (at this time the @global, but RVM 2.0 will support multiple gemsets inheritance).