Read more

Fix Rubygems binary error: undefined method `activate_bin_path' for Gem:Module (NoMethodError)

Henning Koch
December 19, 2016Software engineer at makandra GmbH

So you're getting an error like this:

undefined method `activate_bin_path' for Gem:Module (NoMethodError)
Illustration UI/UX Design

UI/UX Design by makandra brand

We make sure that your target audience has the best possible experience with your digital product. You get:

  • Design tailored to your audience
  • Proven processes customized to your needs
  • An expert team of experienced designers
Read more Show archive.org snapshot

Here is what happened:

  • You installed a recent version of Rubygems
  • You installed some gems that install a binary (like bundle, rake or rails) with code that only works with modern Rubygems versions
  • You downgraded Rubygems to an older versions, which doesn't change any binaries
  • When calling binaries with the old Rubygems version, it cannot process the line Gem.activate_pin_path(...) that was written out by the new Rubygems version.

In general, try to upgrade/downgrade Rubygems to the version you want before installing any gems. This way you won't run into the issue above.

Fixing an existing Ruby installation (preferred method)

Simply run

gem pristine --all

Fixing an existing Ruby installation (fallback method)

  • Uninstall all gems (including bundler) or remove and re-install the Ruby version
  • Upgrade/downgrade to the version you want using gem update --system="x.y.z".
  • Install a recent version of bundler using gem install bundler.
  • Install the gems you want using bundle install or gem install.

Also see: When upgrading/downgrading RubyGems and Bundler on a server, you must clear bundled gems

Posted by Henning Koch to makandra dev (2016-12-19 18:47)