ruby/rubygems · error · Gem::InstallError

post-build hook#{location} failed for #{spec.full_name}

Error message

post-build hook#{location} failed for #{spec.full_name}

What it means

Error "post-build hook#{location} failed for #{spec.full_name}" thrown in ruby/rubygems.

Source

Thrown at lib/rubygems/installer.rb:334

  def run_pre_install_hooks # :nodoc:
    Gem.pre_install_hooks.each do |hook|
      next unless hook.call(self) == false
      location = " at #{$1}" if hook.inspect =~ /[ @](.*:\d+)/

      message = "pre-install hook#{location} failed for #{spec.full_name}"
      raise Gem::InstallError, message
    end
  end

  def run_post_build_hooks # :nodoc:
    Gem.post_build_hooks.each do |hook|
      next unless hook.call(self) == false
      FileUtils.rm_rf gem_dir

      location = " at #{$1}" if hook.inspect =~ /[ @](.*:\d+)/

      message = "post-build hook#{location} failed for #{spec.full_name}"
      raise Gem::InstallError, message
    end
  end

  def run_post_install_hooks # :nodoc:
    Gem.post_install_hooks.each do |hook|
      hook.call self
    end
  end

  ##
  #
  # Return an Array of Specifications contained within the gem_home
  # we'll be installing into.

  def installed_specs
    @installed_specs ||= begin
      specs = []

View on GitHub (pinned to 86cbb817a3)

Solutions

  1. Fix or remove the failing post-build hook (see the reported hook location)
  2. Re-run with `-V` for verbose output to see why the hook failed

When it happens

Trigger: Thrown at lib/rubygems/installer.rb:334 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/49e86a2167fa5e1b. Report an issue: GitHub.