Valkey® is a free, open-source in-memory data store. On a Mac, the easiest way to install it is Homebrew, the package manager for macOS: one command installs Valkey and one more starts it.
By the end of this guide, Valkey runs in the background on your Mac and answers your commands, ready for the Valkey Tutorial.
Note: Every command and output on this page is real, run on Valkey 9.1.4 on an Apple silicon Mac with macOS 26.
Prerequisites
- A Mac with Apple silicon (M1 or later) and macOS 15 Sequoia or later. Homebrew has a ready-made Valkey build for these Macs.
- Homebrew. If Terminal can’t find the
brewcommand, install Homebrew with the command on brew.sh (opens in a new tab).
Step 1: Install Valkey with Homebrew
Open Terminal, in Applications › Utilities, and run:
brew install valkey
Homebrew downloads Valkey and installs its programs, including valkey-server, the database server, and valkey-cli, the command-line tool you use to talk to it. If Homebrew hasn’t updated itself for a while, it does that first and prints a list of updates before these lines:

==> Downloading bottle manifests
✔︎ Bottle Manifest valkey (9.1.4)
==> Fetching downloads for: valkey
✔︎ Bottle valkey (9.1.4)
==> Pouring valkey--9.1.4.arm64_tahoe.bottle.tar.gz
🍺 /opt/homebrew/Cellar/valkey/9.1.4: 21 files, 3.6MB
==> Caveats
==> valkey
To start valkey now and restart at login:
brew services start valkey
Or, if you don't want/need a background service you can just run:
/opt/homebrew/opt/valkey/bin/valkey-server /opt/homebrew/etc/valkey.conf
If Homebrew also installs openssl@4, that’s expected: Valkey uses it for encrypted connections. The Caveats lines at the end show two ways to start Valkey. Step 2 uses the first one.
Step 2: Start Valkey as a Background Service
brew services start valkey
==> Successfully started `valkey` (label: sh.brew.valkey)
brew services runs Valkey in the background now, and starts it again every time you log in to your Mac.
Note: Valkey listens only on your own Mac (127.0.0.1), on port 6379. Other computers on your network can’t reach it, which is the safe setting while you learn.
Step 3: Check That Valkey Works
valkey-cli ping
PONG
valkey-cli ping sends the PING command to Valkey. A running Valkey answers PONG.

Stop or Start Valkey
To stop Valkey, for example to free its memory while you don’t need it:
brew services stop valkey
Stopping `valkey`... (might take a while)
==> Successfully stopped `valkey` (label: sh.brew.valkey)
To start it again, run brew services start valkey from Step 2. While Valkey is stopped, valkey-cli ping can’t connect, and on a Mac the message reads:
Could not connect to Valkey at 127.0.0.1:6379: setsockopt(TCP_NODELAY): Invalid argument
It means nothing answered, so start Valkey again. Why valkey-cli says “setsockopt(TCP_NODELAY): Invalid argument” has the details.
Keep Valkey Up to Date
brew upgrade valkey
Warning: valkey 9.1.4 already installed
When a newer Valkey is out, this command installs it instead of printing the warning. Then stop and start the service, so the new version runs.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Running valkey-cli ping before Step 2 | valkey-cli can’t connect, because Valkey isn’t running yet | Start the service with brew services start valkey |
| Forgetting that the service starts at login | Valkey keeps running in the background after every restart | Stop it with brew services stop valkey when you don’t need it |
Troubleshooting
| Problem | Cause | Fix |
|---|---|---|
Could not connect to Valkey at 127.0.0.1:6379: setsockopt(TCP_NODELAY): Invalid argument | Valkey isn’t running | Run brew services start valkey |
Warning: valkey 9.1.4 already installed | You already have the newest Valkey | Nothing to do |
FAQ
Is Valkey free to use on a Mac?
Yes. Valkey is open source under the BSD 3-Clause license, so it’s free for personal and commercial use. Is Valkey Free for Commercial Use? explains the license.
Does Homebrew have Valkey for Intel Macs?
Homebrew’s Valkey formula lists ready-made builds only for Apple silicon Macs on macOS 15 Sequoia and later, and this guide was run on one of them. The formula page (opens in a new tab) shows the current list.
Where is Valkey’s configuration file?
Homebrew puts it at /opt/homebrew/etc/valkey.conf, the path in the Caveats lines of Step 1. Part 19 of the Valkey Tutorial covers configuration.
Which Valkey version does the Valkey Tutorial use?
Valkey 9.1, the newest stable release, on macOS. On Ubuntu and in WSL on Windows, the series uses Ubuntu’s own package, which installs Valkey 9.0.
Conclusion
Valkey is now installed on your Mac and running in the background, and valkey-cli ping answers PONG. One Homebrew command keeps it up to date.
Related
- Valkey Tutorial for Beginners
- Valkey Tutorial — Part 1: What Is Valkey? The In-Memory Key-Value Store Explained
- Valkey Tutorial — Part 2: Your First Valkey Commands with valkey-cli
- Fixed: “Could not connect to Valkey at 127.0.0.1:6379: setsockopt(TCP_NODELAY): Invalid argument” on macOS
- Valkey vs Redis: What’s the Difference?
- Is Valkey Free for Commercial Use? The Valkey License Explained
Additional Resources
- Valkey installation docs (macOS) (opens in a new tab)
- Homebrew: the valkey formula (opens in a new tab)
- Homebrew manual (brew services) (opens in a new tab)
- valkey-cli documentation (opens in a new tab)
Valkey® is a registered trademark of LF Projects, LLC. Redis® is a registered trademark of Redis Ltd. Any rights therein are reserved to Redis Ltd. Other names mentioned are trademarks of their respective owners. JD Bots isn’t affiliated with the Valkey project, LF Projects or Redis Ltd., and isn’t endorsed, supported or certified by them.
0 comments