diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index a919a0fbd8..d42b1520fb 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -424,10 +424,18 @@ class Checks __check_subdir_access "share/man" end + def check_access_homebrew_repository + unless HOMEBREW_REPOSITORY.writable_real? then <<-EOS.undent + The #{HOMEBREW_REPOSITORY} is not writable. + You should probably `chown` #{HOMEBREW_REPOSITORY} + EOS + end + end + def check_access_usr_local return unless HOMEBREW_PREFIX.to_s == "/usr/local" - unless File.writable_real?("/usr/local") then <<-EOS.undent + unless HOMEBREW_PREFIX.writable_real? then <<-EOS.undent The /usr/local directory is not writable. Even if this directory was writable when you installed Homebrew, other software may change permissions on this directory. Some versions of the @@ -435,6 +443,7 @@ class Checks You should probably change the ownership and permissions of /usr/local back to your user account. + sudo chown $(whoami):admin /usr/local EOS end end