Site icon JD Bots

How to Install Valkey on macOS

Featured image for How to Install Valkey on macOS, showing a checklist: brew install valkey, Valkey 9.1.4, runs as a service, and ping answered with PONG.

Install Valkey on macOS with Homebrew.

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

Step 1: Install Valkey with Homebrew

Open Terminal, in Applications › Utilities, and run:

Terminal

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:

Homebrew installs Valkey 9.1.4 and shows how to start it.

Output

==> 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

Terminal

brew services start valkey

Output

==> 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

Terminal

valkey-cli ping

Output

PONG

valkey-cli ping sends the PING command to Valkey. A running Valkey answers PONG.

Valkey starts as a background service and answers PONG.

Stop or Start Valkey

To stop Valkey, for example to free its memory while you don’t need it:

Terminal

brew services stop valkey

Output

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:

Output

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

Terminal

brew upgrade valkey

Output

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

MistakeWhat happensDo this instead
Running valkey-cli ping before Step 2valkey-cli can’t connect, because Valkey isn’t running yetStart the service with brew services start valkey
Forgetting that the service starts at loginValkey keeps running in the background after every restartStop it with brew services stop valkey when you don’t need it

Troubleshooting

ProblemCauseFix
Could not connect to Valkey at 127.0.0.1:6379: setsockopt(TCP_NODELAY): Invalid argumentValkey isn’t runningRun brew services start valkey
Warning: valkey 9.1.4 already installedYou already have the newest ValkeyNothing 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 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

Additional Resources

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.

Exit mobile version