Skip to content

Commit 5b19563

Browse files
committed
utils: create GEM_HOME when installing Gems.
It may not exist before Gem installation which means that the resulting installed gem will not be found in the PATH.
1 parent 77b9ef8 commit 5b19563

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Library/Homebrew/utils.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ def install_gem_setup_path!(name, version = nil, executable = name)
189189
Gem.clear_paths
190190
Gem::Specification.reset
191191

192+
# Create GEM_HOME which may not exist yet so it exists when creating PATH.
193+
FileUtils.mkdir_p Gem.bindir
194+
192195
# Add Gem binary directory and (if missing) Ruby binary directory to PATH.
193196
path = PATH.new(ENV["PATH"])
194197
path.prepend(RUBY_BIN) if which("ruby") != RUBY_PATH

0 commit comments

Comments
 (0)