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


    一、问题现象

    启动Redis服务命令:

    brew services start redis
    
    • 1

    异常信息如下:

    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 `
    '
    • 1
    • 2
    • 3
    • 4

    停止Redis服务命令:

    brew services stop redis
    
    • 1

    异常信息同上。

    二、解决办法

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

    1、删除homebrew-services 目录

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

    2、升级

    brew tap homebrew/services
    
    • 1

    升级结果如下(结果中有个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).
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22

    升级成功。

    3、验证升级结果

    brew services list
    
    • 1

    结果:

    Name  Status User File
    redis none   
    
    • 1
    • 2

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

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

    问题解决。

  • 相关阅读:
    win10下.net framework 3.5 | net framework 4 无法安装解决方案
    wo-gradient-card是一款采用uniapp实现的透明辉光动画卡片
    数据结构之图(概念)
    [机缘参悟-30]:鬼谷子-内揵篇-同理心,站在对方的立场,拉近与对方的心理距离
    System 对象解析
    pgsql时间处理的一些方式
    Vue检测数据的原理
    win11右键改回win10风格方法
    Stable Diffusion webui 源码调试(二)
    gitee 远程仓库
  • 原文地址:https://blog.csdn.net/shinyolive/article/details/133776462