闲置了一年多的 mac mini 重新用起来,发现 nginx 挂了。
执行 brew services 报错:
$ brew services
Error: uninitialized constant Homebrew::Service
/opt/homebrew/Library/Homebrew/formula.rb:1267:in `service'
/opt/homebrew/Library/Homebrew/formula.rb:1238:in `plist_name'
/opt/homebrew/Library/Homebrew/formula.rb:1250:in `launchd_service_path'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formula_wrapper.rb:58:in `service_file'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formula_wrapper.rb:92:in `plist?'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:12:in `select'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:12:in `available_services'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:17:in `services_list'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/lib/service/commands/list.rb:13:in `run'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/cmd/services.rb:102:in `services'
/opt/homebrew/Library/Homebrew/brew.rb:97:in `public_send'
/opt/homebrew/Library/Homebrew/brew.rb:97:in `<main>'
If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
https://github.com/homebrew/homebrew-services/issues/new
解决方案
cd /opt/homebrew/Library/Taps/homebrew/
rm -rf homebrew-services/
brew tap homebrew/services
PS: 第三步需要挂代理,否则下载不下来。