ruby/rubygems · error · Gem::InstallError

#{@gem} is not installed in GEM_HOME, try:

Error message

#{@gem} is not installed in GEM_HOME, try:

What it means

Error "#{@gem} is not installed in GEM_HOME, try:" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/uninstaller.rb:131

    list, other_repo_specs = list.partition do |spec|
      @gem_home == spec.base_dir ||
        (@user_install && spec.base_dir == @user_dir)
    end

    list.sort!

    if list.empty?
      return unless other_repo_specs.any?

      other_repos = other_repo_specs.map(&:base_dir).uniq

      message = ["#{@gem} is not installed in GEM_HOME, try:"]
      message.concat other_repos.map {|repo|
        "\tgem uninstall -i #{repo} #{@gem}"
      }

      raise Gem::InstallError, message.join("\n")
    elsif @force_all
      remove_all list

    elsif list.size > 1
      gem_names = list.map(&:full_name_with_location)
      gem_names << "All versions"

      say
      _, index = choose_from_list "Select gem to uninstall:", gem_names

      if index == list.size
        remove_all list
      elsif index && index >= 0 && index < list.size
        uninstall_gem list[index]
      else
        say "Error: must enter a number [1-#{list.size + 1}]"
      end
    else

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Follow the suggested command in the output (add the shown -I path or fix GEM_HOME)
  2. Or uninstall from the gem home where it is actually installed

When it happens

Trigger: Thrown at lib/rubygems/uninstaller.rb:131 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruby/rubygems@86cbb817a3 (2026-08-23). Data as JSON: /api/errors/22796b6bdd57f00c. Report an issue: GitHub.