Test that Homebrew's bin is in the path.

This commit is contained in:
Adam Vandenberg 2010-04-08 17:50:51 -07:00
parent 3c78d5cf91
commit fa06ea6e17

View File

@ -108,7 +108,7 @@ def check_user_path
seen_prefix_sbin = false seen_prefix_sbin = false
seen_usr_bin = false seen_usr_bin = false
paths = ENV['PATH'].split(":") paths = ENV['PATH'].split(':').collect{|p| File.expand_path p}
paths.each do |p| paths.each do |p|
if p == '/usr/bin' if p == '/usr/bin'
@ -118,9 +118,10 @@ def check_user_path
/usr/bin is in your PATH before Homebrew's bin. This means that system- /usr/bin is in your PATH before Homebrew's bin. This means that system-
provided programs will be used before Homebrew-provided ones. This is an provided programs will be used before Homebrew-provided ones. This is an
issue if you install, for instance, Python. issue if you install, for instance, Python.
Consider editing your .bashrc to put: Consider editing your .bashrc to put:
#{HOMEBREW_PREFIX}/bin #{HOMEBREW_PREFIX}/bin
ahead of /usr/bin. ahead of /usr/bin in your $PATH.
EOS EOS
end end
@ -130,12 +131,26 @@ def check_user_path
seen_prefix_sbin = true if p == "#{HOMEBREW_PREFIX}/sbin" seen_prefix_sbin = true if p == "#{HOMEBREW_PREFIX}/sbin"
end end
unless seen_prefix_bin
puts <<-EOS.undent
Homebrew's bin was not found in your path. Some brews depend
on other brews that install tools to bin.
You should edit your .bashrc to add:
#{HOMEBREW_PREFIX}/bin
to $PATH.
EOS
end
unless seen_prefix_sbin unless seen_prefix_sbin
puts <<-EOS.undent puts <<-EOS.undent
Some brews install binaries to sbin instead of bin, but Homebrew's Some brews install binaries to sbin instead of bin, but Homebrew's
sbin was not found in your path. sbin was not found in your path.
Consider editing your .bashrc to add sbin to PATH:
Consider editing your .bashrc to add:
#{HOMEBREW_PREFIX}/sbin #{HOMEBREW_PREFIX}/sbin
to $PATH.
EOS EOS
end end
@ -152,6 +167,7 @@ def check_pkg_config
`./configure` may have problems finding brew-installed packages using `./configure` may have problems finding brew-installed packages using
this other pkg-config. this other pkg-config.
EOS EOS
end end
end end