aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/extend/os
diff options
context:
space:
mode:
authorMike McQuaid2017-05-27 13:34:59 +0100
committerMike McQuaid2017-05-27 13:34:59 +0100
commit945cfc7cb7b9d979a82ecb5a10d5ed35f8e5745a (patch)
tree0be7422eb61272bdb0233b5dd72977e58165bc3d /Library/Homebrew/extend/os
parentfb33acbbe47162adf90e92cbb6b244f26a5a346e (diff)
downloadbrew-945cfc7cb7b9d979a82ecb5a10d5ed35f8e5745a.tar.bz2
diagnostic: move some more macOS doctor checks.
Move some `brew doctor` checks that are pretty macOS specific so they are only run on macOS.
Diffstat (limited to 'Library/Homebrew/extend/os')
-rw-r--r--Library/Homebrew/extend/os/mac/diagnostic.rb71
1 files changed, 71 insertions, 0 deletions
diff --git a/Library/Homebrew/extend/os/mac/diagnostic.rb b/Library/Homebrew/extend/os/mac/diagnostic.rb
index ff936c75a..58d8c633d 100644
--- a/Library/Homebrew/extend/os/mac/diagnostic.rb
+++ b/Library/Homebrew/extend/os/mac/diagnostic.rb
@@ -307,6 +307,77 @@ module Homebrew
We recommend only installing stable releases of XQuartz.
EOS
end
+
+ def check_filesystem_case_sensitive
+ dirs_to_check = [
+ HOMEBREW_PREFIX,
+ HOMEBREW_REPOSITORY,
+ HOMEBREW_CELLAR,
+ HOMEBREW_TEMP,
+ ]
+ case_sensitive_dirs = dirs_to_check.select do |dir|
+ # We select the dir as being case-sensitive if either the UPCASED or the
+ # downcased variant is missing.
+ # Of course, on a case-insensitive fs, both exist because the os reports so.
+ # In the rare situation when the user has indeed a downcased and an upcased
+ # dir (e.g. /TMP and /tmp) this check falsely thinks it is case-insensitive
+ # but we don't care because: 1. there is more than one dir checked, 2. the
+ # check is not vital and 3. we would have to touch files otherwise.
+ upcased = Pathname.new(dir.to_s.upcase)
+ downcased = Pathname.new(dir.to_s.downcase)
+ dir.exist? && !(upcased.exist? && downcased.exist?)
+ end
+ return if case_sensitive_dirs.empty?
+
+ volumes = Volumes.new
+ case_sensitive_vols = case_sensitive_dirs.map do |case_sensitive_dir|
+ volumes.get_mounts(case_sensitive_dir)
+ end
+ case_sensitive_vols.uniq!
+
+ <<-EOS.undent
+ The filesystem on #{case_sensitive_vols.join(",")} appears to be case-sensitive.
+ The default macOS filesystem is case-insensitive. Please report any apparent problems.
+ EOS
+ end
+
+ def check_homebrew_prefix
+ return if HOMEBREW_PREFIX.to_s == "/usr/local"
+
+ <<-EOS.undent
+ Your Homebrew's prefix is not /usr/local.
+ You can install Homebrew anywhere you want but some bottles (binary packages)
+ can only be used with a /usr/local prefix and some formulae (packages)
+ may not build correctly with a non-/usr/local prefix.
+ EOS
+ end
+
+ def check_which_pkg_config
+ binary = which "pkg-config"
+ return if binary.nil?
+
+ mono_config = Pathname.new("/usr/bin/pkg-config")
+ if mono_config.exist? && mono_config.realpath.to_s.include?("Mono.framework")
+ <<-EOS.undent
+ You have a non-Homebrew 'pkg-config' in your PATH:
+ /usr/bin/pkg-config => #{mono_config.realpath}
+
+ This was most likely created by the Mono installer. `./configure` may
+ have problems finding brew-installed packages using this other pkg-config.
+
+ Mono no longer installs this file as of 3.0.4. You should
+ `sudo rm /usr/bin/pkg-config` and upgrade to the latest version of Mono.
+ EOS
+ elsif binary.to_s != "#{HOMEBREW_PREFIX}/bin/pkg-config"
+ <<-EOS.undent
+ You have a non-Homebrew 'pkg-config' in your PATH:
+ #{binary}
+
+ `./configure` may have problems finding brew-installed packages using
+ this other pkg-config.
+ EOS
+ end
+ end
end
end
end