ruby/rubygems · error · Gem::InstallError
pre-install hook#{location} failed for #{spec.full_name}
Error message
pre-install hook#{location} failed for #{spec.full_name} What it means
Error "pre-install hook#{location} failed for #{spec.full_name}" thrown in ruby/rubygems.
Source
Thrown at lib/rubygems/installer.rb:322
Gem::Specification.add_spec(spec) unless @install_dir
load_plugin unless options[:install_plugin] == false
run_post_install_hooks
spec
rescue Errno::EACCES => e
# Permission denied - /path/to/foo
raise Gem::FilePermissionError, e.message.split(" - ").last
end
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 selfView on GitHub (pinned to 86cbb817a3)
Solutions
- Fix or remove the failing pre-install hook (see the reported hook location)
- Re-run with `-V` for verbose output to see why the hook failed
When it happens
Trigger: Thrown at lib/rubygems/installer.rb:322 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/9760c3272e095895.
Report an issue: GitHub.