-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
I am using an Intel Macbook, and I installed ruby through Homebrew.
I never installed any gems without the --user-install flag. I installed boop: gem install --user-install boop
Then I tried uninstalling boop: gem uninstall --user-install boop
I got the following output:
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory @ rb_check_realpath_internal - /usr/local/lib/ruby/gems/3.4.0
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/uninstaller.rb:52:in 'File.realpath'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/uninstaller.rb:52:in 'Gem::Uninstaller#initialize'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:202:in 'Class#new'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:202:in 'Gem::Commands::UninstallCommand#uninstall'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:188:in 'Gem::Commands::UninstallCommand#uninstall_gem'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:183:in 'block in Gem::Commands::UninstallCommand#uninstall_specific'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:175:in 'Array#each'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:175:in 'Gem::Commands::UninstallCommand#uninstall_specific'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/commands/uninstall_command.rb:136:in 'Gem::Commands::UninstallCommand#execute'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/command.rb:326:in 'Gem::Command#invoke_with_build_args'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/command_manager.rb:253:in 'Gem::CommandManager#invoke_command'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/command_manager.rb:194:in 'Gem::CommandManager#process_args'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/command_manager.rb:152:in 'Gem::CommandManager#run'
/usr/local/Cellar/ruby/3.4.7/lib/ruby/3.4.0/rubygems/gem_runner.rb:57:in 'Gem::GemRunner#run'
/usr/local/opt/ruby/bin/gem:12:in '<main>'
Then I tried creating the /usr/local/lib/ruby/gems/3.4.0 directory and didn't put anything in it. I was able to successfully uninstall boop from by user directory.
Is there a way to be able to uninstall user-installed gems without creating /usr/local/lib/ruby/gems/3.4.0? I know /usr/local/lib/ruby/gems/3.4.0 is automatically created when installing gems without --user-install, but it seems weird to me that uninstalling user-installed gems is not possible without first installing a gem globally.
Make sure you're using the latest version of both RubyGems by running gem update --system.
Here is my gem env output:
RubyGems Environment:
- RUBYGEMS VERSION: 3.7.2
- RUBY VERSION: 3.4.7 (2025-10-08 patchlevel 58) [x86_64-darwin23]
- INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/3.4.0
- USER INSTALLATION DIRECTORY: /Users/joseph.rosloniec/.gem/ruby/3.4.0
- CREDENTIALS FILE: /Users/joseph.rosloniec/.local/share/gem/credentials
- RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
- GIT EXECUTABLE: /usr/bin/git
- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/3.4.0/bin
- SPEC CACHE DIRECTORY: /Users/joseph.rosloniec/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/3.4.7/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-23
- GEM PATHS:
- /usr/local/lib/ruby/gems/3.4.0
- /Users/joseph.rosloniec/.gem/ruby/3.4.0
- /usr/local/Cellar/ruby/3.4.7/lib/ruby/gems/3.4.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => true
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /Users/joseph.rosloniec/.user-python-env/bin
- /Users/joseph.rosloniec/.gem/ruby/3.4.0/bin
- /usr/local/opt/ruby/bin
- /usr/local/bin
- /System/Cryptexes/App/usr/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin
- /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin
- /var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin