How to run a specific version of a ruby gem

Obromios picture Obromios · Aug 12, 2016 · Viewed 12.7k times · Source

I am running brakeman outside of my Gemfile, so am not using bundler.

If I do gem list, I can see I have the following for brakeman

brakeman (3.3.3, 3.3.2, 3.1.4, 3.1.2)

But if I do brakeman --version, I get

brakeman 3.1.2

so I am not using the latest version. If I do gem update brakeman or

gem update brakeman, '3.3.3,

I get

Updating installed gems
Nothing to update

So how do I run brakeman version 3.3.3?

Answer

awendt picture awendt · Aug 12, 2016

If you have several gem versions installed and you want to invoke a specific version from the command-line, you could use:

brakeman _3.3.3_ [args go here]

This is not specific to brakeman, you can do this for most other gems as well.