中三A105论坛

注册 登录
查看: 74|回复: 0

homebrew brew services list 报错解决

[复制链接]

169

主题

169

帖子

603

积分

高级会员

Rank: 4

积分
603
发表于 2024-8-17 00:34:03 | 显示全部楼层 |阅读模式
本帖最后由 gnn 于 2024-8-17 00:35 编辑

问题:
运行brew services list 报错,报错如下:
  1. Error: uninitialized constant Homebrew::Service
  2. /usr/local/Homebrew/Library/Homebrew/formula.rb:1267:in `service'
  3. /usr/local/Homebrew/Library/Homebrew/formula.rb:1238:in `plist_name'
  4. /usr/local/Homebrew/Library/Homebrew/formula.rb:1250:in `launchd_service_path'
  5. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formula_wrapper.rb:58:in `service_file'
  6. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formula_wrapper.rb:92:in `plist?'
  7. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:14:in `block in available_services'
  8. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:14:in `select'
  9. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:14:in `available_services'
  10. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/formulae.rb:25:in `services_list'
  11. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/lib/service/commands/list.rb:13:in `run'
  12. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/cmd/services.rb:129:in `services'
  13. /usr/local/Homebrew/Library/Homebrew/brew.rb:98:in `public_send'
  14. /usr/local/Homebrew/Library/Homebrew/brew.rb:98:in `<main>'
  15. If reporting this issue please do so at (not Homebrew/brew or Homebrew/homebrew-core):
  16.   https://github.com/homebrew/homebrew-services/issues/new
复制代码


解决方案:
删除以安装的homebrew/services
升级homebrew

具体步骤:
1)找到本机的homebrew/services 安装目录
  1. /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services
复制代码


2)删除 homebrew-services
  1. rm -rf /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services
复制代码


3)用brew tap命令升级 homebrew-services
  1. brew tap homebrew/services
复制代码
升级成功
  1. noway@Mac-mini homebrew % brew tap homebrew/services
  2. ==> Tapping homebrew/services
  3. Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services'...
  4. remote: Enumerating objects: 3088, done.
  5. remote: Counting objects: 100% (550/550), done.
  6. remote: Compressing objects: 100% (210/210), done.
  7. remote: Total 3088 (delta 356), reused 462 (delta 335), pack-reused 2538 (from 1)
  8. Receiving objects: 100% (3088/3088), 868.18 KiB | 310.00 KiB/s, done.
  9. Resolving deltas: 100% (1497/1497), done.
  10. Tapped 1 command (48 files, 1MB).
复制代码
验证brew services命令
  1. noway@Mac-mini homebrew % brew services list
  2. Name          Status  User  File
  3. emacs         none         
  4. postgresql@14 started noway ~/Library/LaunchAgents/homebrew.mxcl.postgresql@14.plist
  5. unbound       none
复制代码


回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

快速回复 返回列表 返回顶部