ruby/rubygems · error · Gem::DependencyRemovalException

Uninstallation aborted due to dependent gem(s)

Error message

Uninstallation aborted due to dependent gem(s)

What it means

Error "Uninstallation aborted due to dependent gem(s)" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/uninstaller.rb:163

        uninstall_gem list[index]
      else
        say "Error: must enter a number [1-#{list.size + 1}]"
      end
    else
      uninstall_gem list.first
    end
  end

  ##
  # Uninstalls gem +spec+

  def uninstall_gem(stub)
    spec = stub.to_spec

    @spec = spec

    unless dependencies_ok? spec
      if abort_on_dependent? || !ask_if_ok(spec)
        raise Gem::DependencyRemovalException,
          "Uninstallation aborted due to dependent gem(s)"
      end
    end

    Gem.pre_uninstall_hooks.each do |hook|
      hook.call self
    end

    remove_executables @spec
    remove_plugins @spec
    remove @spec

    specification_record.remove_spec(stub)

    regenerate_plugins

    Gem.post_uninstall_hooks.each do |hook|

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Uninstall the dependent gems first, then retry
  2. Or force it with `gem uninstall --force` (may break dependents)

When it happens

Trigger: Thrown at lib/rubygems/uninstaller.rb:163 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/cb15d8c2676f6b02. Report an issue: GitHub.