Homebrew-core: Redis failed to start on macOS 10.12

Created on 16 Mar 2017  路  12Comments  路  Source: Homebrew/homebrew-core

I tried to install redis using homebrew two times today and both had problems because the formula won't create the needed directories and install the configuration files.

  • [x] Ran brew update and retried your prior step?
$ brew update
Already up-to-date.
  • [x] Ran brew doctor, fixed as many issues as possible and retried your prior step?
$ brew doctor
Your system is ready to brew.
  • [x] Ran brew config.
$ brew config
HOMEBREW_VERSION: >1.1.0 (no git repository)
ORIGIN: https://github.com/Homebrew/brew
HEAD: 0f35f4ca1e01d18824831727ad08e93bc3f9160b
Last commit: 4 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 4469165031e12ee1a1e0f6155a6122a524a0e366
Core tap last commit: 5 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: quad-core 64-bit ivybridge
Homebrew Ruby: 2.0.0-p648
Clang: 8.0 build 800
Git: 2.10.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/local/bin/perl => /usr/local/Cellar/perl/5.24.1/bin/perl
Python: /usr/local/bin/python => /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/local/bin/ruby => /usr/local/Cellar/ruby/2.4.0/bin/ruby
Java: N/A
macOS: 10.12.3-x86_64
Xcode: 8.2.1
CLT: N/A
X11: N/A

Most helpful comment

All 12 comments

I tried to install redis using homebrew two times today

What command did you run and how did you identify it didn't start?

@devsdmf try to use development version it works for me brew install redis --devel.

yes, I know it's not a valid answer, but it's workaround for now

I analyzed the problem and seems that installer don't create the needed folders in /usr/local/var (run, db/redis, log) neither the redis.conf file in /usr/local/etc.

@MikeMcQuaid I ran the brew services start redis

I cannot reproduce this; brew reinstall redis creates all these files and directories on my machine.

Please paste the output of ls -lha /usr/local/etc /usr/local/var/db /usr/local/var/run and then the output of brew reinstall redis, ls -lha /usr/local/etc /usr/local/var/db /usr/local/var/run and brew services restart redis.

@MikeMcQuaid, I think that the command did not create those directories, but I guess that you have installed redis since a time ago, because I installed redis some weeks ago in another machine and it went well, anyway, here is the outputs:

ls -lha /usr/local/etc /usr/local/var/db /usr/local/var/run

/usr/local/etc:
total 128
drwxrwxr-x  12 devsdmf  admin   408B Mar 17 00:23 .
drwxr-xr-x  14 root     wheel   476B Mar 15 23:05 ..
drwxr-xr-x   3 devsdmf  admin   102B Mar 16 02:04 bash_completion.d
drwxr-xr-x   6 devsdmf  admin   204B Mar 16 03:13 libressl
drwxr-xr-x  18 devsdmf  admin   612B Mar 16 20:51 nginx
lrwxr-xr-x   1 devsdmf  admin    37B Mar 16 03:12 odbc.ini -> ../Cellar/unixodbc/2.3.4/etc/odbc.ini
lrwxr-xr-x   1 devsdmf  admin    41B Mar 16 03:12 odbcinst.ini -> ../Cellar/unixodbc/2.3.4/etc/odbcinst.ini
drwxr-xr-x   7 devsdmf  admin   238B Mar 16 02:07 openssl
drwxr-xr-x   8 devsdmf  admin   272B Mar 16 02:31 [email protected]
drwxr-xr-x   3 devsdmf  admin   102B Mar 16 03:33 php
-rw-r--r--   1 devsdmf  admin   7.4K Mar 17 00:23 redis-sentinel.conf
-rw-r--r--   1 devsdmf  admin    46K Mar 17 00:23 redis.conf.default

/usr/local/var/db:
total 0
drwxr-xr-x  2 devsdmf  admin    68B Mar 17 00:22 .
drwxrwxr-x  8 devsdmf  admin   272B Mar 16 03:08 ..

/usr/local/var/run:
total 8
drwxr-xr-x  4 devsdmf  admin   136B Mar 17 00:04 .
drwxrwxr-x  8 devsdmf  admin   272B Mar 16 03:08 ..
drwxr-xr-x  7 devsdmf  admin   238B Mar 16 02:31 nginx
-rw-r--r--  1 root     admin     3B Mar 17 00:04 nginx.pid

brew reinstall redis

==> Reinstalling redis 
==> Downloading https://homebrew.bintray.com/bottles/redis-3.2.8.sierra.bottle.1.tar.gz
Already downloaded: /Users/devsdmf/Library/Caches/Homebrew/redis-3.2.8.sierra.bottle.1.tar.gz
==> Pouring redis-3.2.8.sierra.bottle.1.tar.gz
==> Caveats
To have launchd start redis now and restart at login:
  brew services start redis
Or, if you don't want/need a background service you can just run:
  redis-server /usr/local/etc/redis.conf
==> Summary
馃嵑  /usr/local/Cellar/redis/3.2.8: 11 files, 1.7MB

ls -lha /usr/local/etc /usr/local/var/db /usr/local/var/run

/usr/local/etc:
total 128
drwxrwxr-x  12 devsdmf  admin   408B Mar 17 00:23 .
drwxr-xr-x  14 root     wheel   476B Mar 15 23:05 ..
drwxr-xr-x   3 devsdmf  admin   102B Mar 16 02:04 bash_completion.d
drwxr-xr-x   6 devsdmf  admin   204B Mar 16 03:13 libressl
drwxr-xr-x  18 devsdmf  admin   612B Mar 16 20:51 nginx
lrwxr-xr-x   1 devsdmf  admin    37B Mar 16 03:12 odbc.ini -> ../Cellar/unixodbc/2.3.4/etc/odbc.ini
lrwxr-xr-x   1 devsdmf  admin    41B Mar 16 03:12 odbcinst.ini -> ../Cellar/unixodbc/2.3.4/etc/odbcinst.ini
drwxr-xr-x   7 devsdmf  admin   238B Mar 16 02:07 openssl
drwxr-xr-x   8 devsdmf  admin   272B Mar 16 02:31 [email protected]
drwxr-xr-x   3 devsdmf  admin   102B Mar 16 03:33 php
-rw-r--r--   1 devsdmf  admin   7.4K Mar 17 00:24 redis-sentinel.conf
-rw-r--r--   1 devsdmf  admin    46K Mar 17 00:24 redis.conf.default

/usr/local/var/db:
total 0
drwxr-xr-x  2 devsdmf  admin    68B Mar 17 00:22 .
drwxrwxr-x  8 devsdmf  admin   272B Mar 16 03:08 ..

/usr/local/var/run:
total 8
drwxr-xr-x  4 devsdmf  admin   136B Mar 17 00:04 .
drwxrwxr-x  8 devsdmf  admin   272B Mar 16 03:08 ..
drwxr-xr-x  7 devsdmf  admin   238B Mar 16 02:31 nginx
-rw-r--r--  1 root     admin     3B Mar 17 00:04 nginx.pid

brew services restart redis

==> Successfully started `redis` (label: homebrew.mxcl.redis)

Additionaly a ran the following command:

$ ps aux | grep redis
devsdmf          2899   0.0  0.0  2432804   2028 s000  S+   12:25AM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn redis

And when I realized which was the problem, I created the folders and configuration files manually:

$ cp /usr/local/etc/redis.conf.default /usr/local/etc/redis.conf
$ mkdir /usr/local/var/db/redis

The, I restarted the service again:

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

So, I ran the ps aux command again:

$ ps aux | grep redis
devsdmf          3147   0.0  0.0  2442020   2044 s000  S+   12:29AM   0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn redis
devsdmf          3133   0.0  0.1  2461928   3320   ??  S    12:28AM   0:00.04 /usr/local/opt/redis/bin/redis-server 127.0.0.1:6379

On my system where redis was never installed, I did: brew install redis and brew services start redis and brew services stop redis and all went well.

However, redis-server /usr/local/etc/redis.conf (as recommended in the caveat) lead to:
39511:C 17 Mar 09:14:43.249 # Fatal error, can't open config file '/usr/local/etc/redis.conf'

Indeed:

$ ll /usr/local/etc/redis*              
-rw-r--r--  1 fx  admin   7.4K Mar 17 09:13 /usr/local/etc/redis-sentinel.conf
-rw-r--r--  1 fx  admin    46K Mar 17 09:13 /usr/local/etc/redis.conf.default

brew install redis --force-bottle won't worked.
brew install redis --build-from-source works well.

@fxcoudert please, paste the output of ps aux | grep redisafter start the service.

I just had pretty much the same experience as @devsdmf on macOS 10.12.3. I had neither the /usr/local/etc/redis.conf file nor the /usr/local/var/db/redis folder after installing and reinstalling redis. In fact, I did not even have a /usr/local/var/db folder so I had to first create that. Here's what worked for me:

cp /usr/local/etc/redis.conf.default /usr/local/etc/redis.conf
mkdir /usr/local/var/db/
mkdir /usr/local/var/db/redis
brew services restart redis

Here's a gist of all commands I ran:
https://gist.github.com/jhunken/b6a36c6fff936e9571ec9aa869f43f64

I can finally reproduce this so working on a fix now.

Well done, thank you, brothers!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oli-laban picture oli-laban  路  3Comments

ghostbar picture ghostbar  路  4Comments

jyutzler picture jyutzler  路  4Comments

ghost picture ghost  路  3Comments

gregvirgin picture gregvirgin  路  3Comments