Install redis on Mac

Redis is an open source, in-memory data structure store, used as database, cache and message broker. It is one of the most popular key-value nosql database. Also note that the name Redis means REmote DIctionary Server.

Here are installation steps for redis on Mac using brew.

  1. Get redis package info

    $ brew info redis
    redis: stable 3.0.7 (bottled), HEAD
    Persistent key-value database, with built-in net interface
    Not installed
  2. Install redis using brew

    $ brew install redis
  3. List installed files

    $ brew list redis
  4. In case you want to start redis at login add symlink in ~/Library/LaunchAgents. Note that it will start redis as current user. This info can also be obtained by command brew info.

    $ ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
  5. To start redis one time as current user:

    $ launchctl load /usr/local/opt/redis/homebrew.mxcl.redis.plist
  6. View redis config

    $ less /usr/local/etc/redis.conf 
  7. View redis log

    $ tail -f /usr/local/var/log/redis.log
    59980:M 03 Mar 14:01:37.643 # Server started, Redis version 3.0.7
    59980:M 03 Mar 14:01:37.658 * DB loaded from disk: 0.015 seconds
    59980:M 03 Mar 14:01:37.658 * The server is now ready to accept connections on port 6379
  8. Look at redis db file

    $ ls -l /usr/local/var/db/redis/
    -rw-r--r--  1 user1  admin  33 Jan 21 09:33 dump.rdb
  9. Try out few redis-cli commands
    $ echo "set key1 value1" | redis-cli
    $ echo "INFO keyspace" | redis-cli
    # Keyspace
    $ echo "KEYS *" | redis-cli
    1) "key1"

    You may also want to visit redis cli quick start tutorial

Share this article: share on Google+ share on facebook share on linkedin tweet this submit to reddit


Click here to write/view comments