From b3c6c3f591806976ec9f327cd4745cfcedcee7b9 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 16 Sep 2009 19:28:42 +0100 Subject: [PATCH] Warning for bin dirs not in the PATH Eg. sbin may be part of the formula, but that isn't in the default Mac PATH. Also will avoid bug reports for users who forget to amend their PATH and stick Homebrew somewhere different. --- Library/Homebrew/install.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Library/Homebrew/install.rb b/Library/Homebrew/install.rb index 72fb2a1fa7..3b06cf8bc2 100755 --- a/Library/Homebrew/install.rb +++ b/Library/Homebrew/install.rb @@ -50,6 +50,19 @@ def install f raise "Nothing was installed to #{f.prefix}" unless f.installed? + # warn the user if stuff was installed outside of their PATH + paths = ENV['PATH'].split(':').collect{|p| File.expand_path p} + [f.bin, f.sbin].each do |bin| + if bin.directory? + rootbin = (HOMEBREW_PREFIX+bin.basename).to_s + bin = File.expand_path bin + unless paths.include? rootbin + opoo "#{rootbin} is not in your PATH" + puts "You can amend this by altering your ~/.bashrc file" + end + end + end + begin Keg.new(f.prefix).link rescue Exception