diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb index 73d11882fc907..794dde2b9f5ff 100644 --- a/Library/Homebrew/diagnostic.rb +++ b/Library/Homebrew/diagnostic.rb @@ -520,6 +520,26 @@ def check_brew_git_origin examine_git_origin(repo, Homebrew::EnvConfig.brew_git_remote) end + def check_git_fsmonitor_settings + return unless Utils::Git.available? + + fsmonitor = HOMEBREW_REPOSITORY.cd { `git config --get core.fsmonitor`.chomp } + return if fsmonitor != "true" + + <<~EOS + Suspicious Git fsmonitor settings found. + + The detected Git fsmonitor settings could interfere with Homebrew operations: + core.fsmonitor = #{fsmonitor} + + This setting might block the lock file during a `brew upgrade` operation, + leading to potential issues and interruptions. + + If you encounter problems, consider disabling fsmonitor in the Homebrew repository by running: + cd #{HOMEBREW_REPOSITORY} && git config core.fsmonitor false + EOS + end + def check_coretap_integrity core_tap = CoreTap.instance unless core_tap.installed?