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

一、问题现象

启动Redis服务命令:

bash 复制代码
brew services start redis

异常信息如下:

bash 复制代码
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服务命令:

bash 复制代码
brew services stop redis

异常信息同上。

二、解决办法

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

1、删除homebrew-services 目录

bash 复制代码
rm -rf /opt/homebrew/Library/Taps/homebrew/homebrew-services

2、升级

bash 复制代码
brew tap homebrew/services

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

bash 复制代码
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、验证升级结果

bash 复制代码
brew services list

结果:

bash 复制代码
Name  Status User File
redis none   

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

bash 复制代码
==> Successfully started `redis` (label: homebrew.mxcl.redis)
bash 复制代码
Stopping `redis`... (might take a while)
==> Successfully stopped `redis` (label: homebrew.mxcl.redis)

问题解决。

相关推荐
芳草萋萋鹦鹉洲哦2 小时前
【vue3+tauri+rust】如何实现下载文件mac+windows
windows·macos·rust
计算机毕设定制辅导-无忧学长5 小时前
西门子 PLC 与 Modbus 集成:S7-1500 RTU/TCP 配置指南(一)
服务器·数据库·tcp/ip
KK溜了溜了5 小时前
JAVA-springboot 整合Redis
java·spring boot·redis
程序员柳5 小时前
基于微信小程序的校园二手交易平台、微信小程序校园二手商城源代码+数据库+使用说明,layui+微信小程序+Spring Boot
数据库·微信小程序·layui
梦在深巷、6 小时前
MySQL/MariaDB数据库主从复制之基于二进制日志的方式
linux·数据库·mysql·mariadb
IT乌鸦坐飞机6 小时前
ansible部署数据库服务随机启动并创建用户和设置用户有完全权限
数据库·ansible·centos7
IT_10246 小时前
Spring Boot项目开发实战销售管理系统——数据库设计!
java·开发语言·数据库·spring boot·后端·oracle
祁思妙想7 小时前
八股学习(三)---MySQL
数据库·学习·mysql
惊骇世俗王某人7 小时前
1.MySQL之如何定位慢查询
数据库·mysql
秦歌6668 小时前
向量数据库-Milvus快速入门
数据库·milvus