在Mac中使用 brew services start redis 命令启动、停止Redis服务报错

一、问题现象

启动Redis服务命令:

brew services start redis

异常信息如下:

Error: uninitialized constant Homebrew::Service::System
/opt/homebrew/Library/Homebrew/macos_version.rb:150:in `const_missing'
/opt/homebrew/Library/Taps/homebrew/homebrew-services/cmd/services.rb:61:in `services'
/opt/homebrew/Library/Homebrew/brew.rb:86:in `<main>'

停止Redis服务命令:

brew services stop redis

异常信息同上。

二、解决办法

删除 homebrew-services 目录,并升级,详细步骤如下:

1、删除homebrew-services 目录

rm -rf /opt/homebrew/Library/Taps/homebrew/homebrew-services

2、升级

brew tap homebrew/services

升级结果如下(结果中有个Error,可忽略):

Running `brew update --auto-update`...
Error: Failed to download https://formulae.brew.sh/api/cask.jws.json!
Installing from the API is now the default behaviour!
You can save space and time by running:
  brew untap homebrew/core
  brew untap homebrew/cask
==> Downloading https://formulae.brew.sh/api/cask.jws.json
############################################################################################################################################################################## 100.0%
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> New Casks
kuaitie

==> Tapping homebrew/services
Cloning into '/opt/homebrew/Library/Taps/homebrew/homebrew-services'...
remote: Enumerating objects: 2564, done.
remote: Counting objects: 100% (317/317), done.
remote: Compressing objects: 100% (163/163), done.
remote: Total 2564 (delta 180), reused 216 (delta 149), pack-reused 2247
Receiving objects: 100% (2564/2564), 711.51 KiB | 1.52 MiB/s, done.
Resolving deltas: 100% (1180/1180), done.
Tapped 1 command (45 files, 886.1KB).

升级成功。

3、验证升级结果

brew services list

结果:

Name  Status User File
redis none   

再次使用brew services start redisbrew services stop redis 尝试启动、停止Redis服务:

==> Successfully started `redis` (label: homebrew.mxcl.redis)
Stopping `redis`... (might take a while)
==> Successfully stopped `redis` (label: homebrew.mxcl.redis)

问题解决。

  • 5
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值