Skip to content

Fix gem uninstall --user-install crash when GEM_HOME does not exist - #9749

Open
hsbt wants to merge 1 commit into
masterfrom
uninstall-missing-gem-home
Open

Fix gem uninstall --user-install crash when GEM_HOME does not exist#9749
hsbt wants to merge 1 commit into
masterfrom
uninstall-missing-gem-home

Conversation

@hsbt

@hsbt hsbt commented Aug 2, 2026

Copy link
Copy Markdown
Member

gem uninstall GEM --user-install crashes with Errno::ENOENT when Gem.dir does not exist, which happens when every gem on the machine was installed with --user-install. Gem::Uninstaller#initialize called File.realpath on Gem.dir unconditionally. Skip the realpath resolution when the directory is missing, as already done for Gem.user_dir on the next line.

Fixes #9149

Generated with Claude Code

Gem::Uninstaller#initialize called File.realpath on Gem.dir, which
raises Errno::ENOENT when only user-installed gems exist. Skip the
realpath resolution when the directory is missing, as already done
for Gem.user_dir.

#9149

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't uninstall gems installed with --user-install if /usr/local/lib/ruby/gems/3.4.0 does not exist

1 participant