Skip to content

Instantly share code, notes, and snippets.

@marka2g
Forked from nrollr/Redis.sh
Last active August 30, 2018 17:55
Show Gist options
  • Select an option

  • Save marka2g/2fe41f55e8a139f9679564a61406bfbd to your computer and use it in GitHub Desktop.

Select an option

Save marka2g/2fe41f55e8a139f9679564a61406bfbd to your computer and use it in GitHub Desktop.
Install Redis via Homebrew

Commands

Install Redis using Homebrew

$ brew install redis

Enable Redis autostart

$ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents

Start Redis server via launchctl

$ launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

homebrew.mxcl.redis.plist contains reference to redis.conf file location: /usr/local/etc/redis.conf

Start Redis server using configuration file, Ctrl+C to stop

$ redis-server /usr/local/etc/redis.conf

Check if the Redis server is running

$ redis-cli ping

Get redis info

$ brew info redis

Disable Redis autostart

$ launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist

Redis .sh

#!/bin/bash
brew install redis #homebrew install
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgent #Enable Redis autostart
redis-server /usr/local/etc/redis.conf #Start Redis server using configuration file, Ctrl+C to stop
redis-cli ping #check if running -> shoud return 'PONG'
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.redis.plist # Disable Redis autostart

Resources

medium blog post

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