Skip to content

Instantly share code, notes, and snippets.

@nrollr
Created March 29, 2016 11:30
Show Gist options
  • Star 68 You must be signed in to star a gist
  • Fork 17 You must be signed in to fork a gist
  • Save nrollr/eb24336b8fb8e7ba5630 to your computer and use it in GitHub Desktop.
Save nrollr/eb24336b8fb8e7ba5630 to your computer and use it in GitHub Desktop.
Install Redis via Homebrew
#!/bin/bash
brew install redis # Install Redis using Homebrew
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents # Enable Redis autostart
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Start Redis server via launchctl
# homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf
redis-server /usr/local/etc/redis.conf # Start Redis server using configuration file, Ctrl+C to stop
redis-cli ping # Check if the Redis server is running
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Disable Redis autostart
@xofred
Copy link

xofred commented Dec 6, 2018

Thanks man! Finally find the redis.conf on mac LOL

@fexx
Copy link

fexx commented Dec 14, 2018

Thanks.

@ntung
Copy link

ntung commented Mar 9, 2019

Thanks for sharing your solution. This has helped me a lot!

Copy link

ghost commented Apr 6, 2019

Thanks!

@gathm5
Copy link

gathm5 commented Jun 3, 2019

Awesome!

@siemensikkema
Copy link

This script has a confusing outcome if the ~/Library/LaunchAgents directory does not exist. It will create ~/Library/LaunchAgents as a symbolic link to the plist file. So maybe consider adding a line before line 3 like this:

mkdir -p ~/Library/LaunchAgents # Ensure the LaunchAgents directory exists

@barnabas-avalara
Copy link

I came across this gist through Google. So, today after running brew install redis I saw the message:

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

Instead of following this gist's instructions, I did that. I'm thinking brew services is the more modern way to do this...?
https://github.com/Homebrew/homebrew-services

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment