aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2010-03-31 15:55:44 -0700
committerAdam Vandenberg2010-04-06 08:22:29 -0700
commita37d53aa890e7cf0e21fa1b71ebf74c009efce21 (patch)
treee55f087f08284559adb5ed82dda6d719069511d4
parent169aa682e0eeebba3ea236e3c6076412707b21b4 (diff)
downloadbrew-a37d53aa890e7cf0e21fa1b71ebf74c009efce21.tar.bz2
Add path check.
-rw-r--r--Library/Homebrew/brew_doctor.rb39
1 files changed, 39 insertions, 0 deletions
diff --git a/Library/Homebrew/brew_doctor.rb b/Library/Homebrew/brew_doctor.rb
index 290fd0203..4e9edd52b 100644
--- a/Library/Homebrew/brew_doctor.rb
+++ b/Library/Homebrew/brew_doctor.rb
@@ -103,6 +103,44 @@ def check_homebrew_prefix
end
end
+def check_user_path
+ seen_prefix_bin = false
+ seen_prefix_sbin = false
+ seen_usr_bin = false
+
+ paths = ENV['PATH'].split(":")
+
+ paths.each do |p|
+ if p == '/usr/bin'
+ seen_usr_bin = true
+ unless seen_prefix_bin
+ puts <<-EOS.undent
+ /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
+ issue if you install, for instance, Python.
+ Consider editing your .bashrc to put:
+ #{HOMEBREW_PREFIX}/bin
+ ahead of /usr/bin.
+
+ EOS
+ end
+ end
+
+ seen_prefix_bin = true if p == "#{HOMEBREW_PREFIX}/bin"
+ seen_prefix_sbin = true if p == "#{HOMEBREW_PREFIX}/sbin"
+ end
+
+ unless seen_prefix_sbin
+ puts <<-EOS.undent
+ Some brews install binaries to sbin instead of bin, but Homebrew's
+ sbin was not found in your path.
+ Consider editing your .bashrc to add sbin to PATH:
+ #{HOMEBREW_PREFIX}/sbin
+
+ EOS
+ end
+end
+
def brew_doctor
read, write = IO.pipe
@@ -117,6 +155,7 @@ def brew_doctor
check_for_other_package_managers
check_for_x11
check_share_locale
+ check_user_path
exit! 0
else