LoginSignup
0

More than 5 years have passed since last update.

posted at

Organization

Mac OS X,homebrewでインストールしたredisが自動起動出来ない問題

色んな方がredisのインストール方法は書いてくれているので、概ねその通りやればいけるはずなのですが、なぜか自動起動しなかった。

手順は単純にこれ。ちなみにtmux上でlaunchctlを使うとうまくいかないので注意(前にどハマりした)。

$ brew install redis
$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
$ launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

こんな感じのログが出力されていた。

Feb 23 12:21:34 mac-mini com.apple.xpc.launchd[1] (homebrew.mxcl.redis): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Feb 23 12:21:44 mac-mini com.apple.xpc.launchd[1] (homebrew.mxcl.redis[1959]): Service could not initialize: 15D21: xpcproxy + 12644 [1472][13E77DA5-3602-31BF-B074-49D4EE27E9D8]: 0xd
Feb 23 12:21:44 mac-mini com.apple.xpc.launchd[1] (homebrew.mxcl.redis): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Feb 23 12:21:54 mac-mini com.apple.xpc.launchd[1] (homebrew.mxcl.redis[1961]): Service could not initialize: 15D21: xpcproxy + 12644 [1472][13E77DA5-3602-31BF-B074-49D4EE27E9D8]: 0xd
Feb 23 12:21:54 mac-mini com.apple.xpc.launchd[1] (homebrew.mxcl.redis): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

原因はこれ。ログファイルがroot権限になってた。

$ ls -l /usr/local/var/log/redis.log
-rw-r--r--  1 root  admin  46336  2 23 12:31 /usr/local/var/log/redis.log

一般ユーザーに権限を戻して再度lanchctl loadをかけたらちゃんと起動しました。

$ sudo chown username /usr/local/var/log/redis.log

lanchctlが全然原因のログを出してくれないのでちょっと手間取ってしまった。

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
0