How to install the latest Redis on macOS
You can download and install Redis from source at https://redis.io/download or you can use Homebrew, a package manager for the Mac.
I recommend using Homebrew (or Brew as I’ll refer to it) not only handles installation of Redis, but also handles starting Redis up again when your computer restarts.
Installation with Brew
To install brew (if you haven’t previously installed it on your Mac), simply run
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Then install Redis with Brew:
brew install redis
Check installation
You can see the status of your newly installed redis server with the following command:
$ brew services list`
redis started cal /Users/cal/Library/LaunchAgents/homebrew.mxcl.redis.plist
If you see the word started
in green next to redis, then Redis server is up and running on your machine. You can now type:
$ redis-cli
127.0.0.1:6379>
… and the redis prompt will appear.
Type PING
here.
127.0.0.1:6379> PING
PONG
Congratulations! You just typed your first Redis command on your newly installed Redis server!
Next Steps
Those new to Redis will want to start learning about Redis’s built-in data types. There is wonderful documentation at https://redis.io/topics/data-types-intro. The next article in this series will go through each of these data types in depth.
I’d also recommend installing Red, (https://echodot.com/red/) also available on the Mac App Store ( https://apps.apple.com/us/app/red-ui-for-redis/id1491764008)
Red is a front-end client for Redis that makes it easy to get started visually with Redis concepts, while also showing what commands are being run to make things happen. It is a fantastic learning tool.
On opening Red, the default connection information should be enough to log into your new Redis server. You won’t need a password. Your window should look like this:
Click Connect. From here start clicking around and see what you can do with your new Redis server. Pay close attention to the console — these are the commands that Red is running for you — but that you will need to learn to get a program to communicate with Redis.
Helpful Brew Commands
Stop redis: brew services stop redis
Start redis” brew services start redis
Restart redis server brew services restart redis
Upgrade Redis to the latest version brew upgrade redis