19

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?

awendt
  • 13,195
  • 5
  • 48
  • 66
Obromios
  • 15,408
  • 15
  • 72
  • 127

3 Answers3

34

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.

awendt
  • 13,195
  • 5
  • 48
  • 66
  • 1
    If I do ```brakeman _3.3.3_ --version``` it still returns 3.1.2, so am I really running 3.3.3? – Obromios Aug 12 '16 at 07:48
  • 1
    I have tried this on another system, and it does work. There must be something strange with my brakeman installation. I have upvoted your answer. – Obromios Aug 12 '16 at 22:23
  • 2
    To clarify, you can do this for **all** other gems. Try `gem which brakeman` to see that the file you're executing from the command line is really just a shim (script) generated by RubyGems; that shim takes the `_3.3.3_` argument and uses it to determine which version of brakeman to call. – Ryan Lue Feb 01 '18 at 03:33
4

I can't reproduce this issue, but I can think of a few reasons why this might happen:

  • Bundler artifacts (perhaps in .bundle/) pointing to the old version. Try running in a different directory and see if it still happens
  • A bug in RubyGems (try gem update --system)
  • During install, it asked if you wanted to replace the brakeman binary and you selected "no"
  • If you are using a Ruby version manager, maybe one version is on a different path than another (like a system gem versus one managed by rvm)
  • Any number of GEM_PATH, bundler, gem, rvm weirdness that sometimes occurs

In any case, if I were you I'd gem uninstall brakeman, remove all versions, and install fresh. If you are using rvm, start with a fresh gemset or rvm gemset empty the current one.

Justin
  • 1,561
  • 10
  • 12
1

I had a similar problem: I uninstalled a certain gem version, but the version still showed up.

TL;DR: rbenv rehash did the trick. (Only valid for rbenv users, obviously)

Brerx
  • 11
  • 1
  • 3