美文网首页
Redis for Mac 开机自启动

Redis for Mac 开机自启动

作者: Sheldon_Yu | 来源:发表于2018-01-11 13:24 被阅读0次

    在/Library/LaunchDaemons下新建com.redis.plist

    com.redis.plist内容如下:

    <?xmlversion="1.0"encoding="UTF-8"?>
    <!DOCTYPEplist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plistversion="1.0">
    <dict>
            <key>Label</key>
            <string>com.redis</string>
            <key>RunAtLoad</key>
            <true/>
            <key>ProgramArguments</key>
            <array>
                    <string>/usr/local/bin/redis-server</string>
            </array>
    </dict>
    </plist>
    
    sudo launchctl load /Library/LaunchDaemons/com.redis.plist
    

    如果提示:

    /Library/LaunchDaemons/com.redis.plist: Path had bad ownership/permissions
    

    那么就是说权限不够
    可以采用执行下面的命令

    sudo chown root /Library/LaunchDaemons/com.redis.plist
    

    最后:

    sudo launchctl start com.redis
    

    重启电脑试试吧

    相关文章

      网友评论

          本文标题:Redis for Mac 开机自启动

          本文链接:https://www.haomeiwen.com/subject/wkiznxtx.html