Build and run Redis Open Source on macOS 14 (Sonoma), 15 (Sequoia), and 26 (Tahoe)
| Redis Open Source |
|---|
Follow the steps below to build and run Redis Open Source with all data structures from its source code on a system running macOS 14 (Sonoma), macOS 15 (Sequoia), or macOS 26 (Tahoe). These instructions apply to both Intel and Apple Silicon (ARM) Macs.
Three RediSearch-specific build constraints apply on macOS and are handled in the steps below:
- The cross-language LTO that RediSearch enables by default requires Linux; its build script aborts on macOS with
Error: LTO is only supported on Linux. Step 5 setsLTO=0to disable it. - RediSearch's Rust workspace uses edition 2024 and features stabilized in Rust 1.94, so the Rust toolchain in step 3 is pinned to
1.94.0. Older Rust fails withfeature edition2024 is required.
1. Install homebrew
If Homebrew isn't already installed, follow the installation instructions on the Homebrew home page.
2. Install required packages
export HOMEBREW_NO_AUTO_UPDATE=1
brew update
brew install coreutils
brew install make
brew install openssl
brew install llvm@18
brew install cmake
brew install gnu-sed
brew install automake
brew install libtool
brew install wget
3. Install Rust
Rust is required to build the JSON package.
RUST_INSTALLER=rust-1.94.0-$(if [ "$(uname -m)" = "arm64" ]; then echo "aarch64"; else echo "x86_64"; fi)-apple-darwin
wget --quiet -O ${RUST_INSTALLER}.tar.xz https://static.rust-lang.org/dist/${RUST_INSTALLER}.tar.xz
tar -xf ${RUST_INSTALLER}.tar.xz
(cd ${RUST_INSTALLER} && sudo ./install.sh)
4. Download and extract the Redis source
The Redis source code is available from the Redis GitHub site. Select the release you want to build and then select the .tar.gz file from the Assets drop down menu. You can verify the integrity of these downloads by checking them against the digests in the redis-hashes GitHub repository.
Create a directory for the src, for example ~/src.
mkdir ~/src
Copy the tar(1) file to ~/src.
Alternatively, you can download the file directly using the wget command, as shown below.
cd ~/src
wget -O redis-<version>.tar.gz https://github.com/redis/redis/archive/refs/tags/<version>.tar.gz
Replace <version> with the three-digit Redis release number, for example 8.0.0.
Extract the source:
cd ~/src
tar xvf redis-<version>.tar.gz
rm redis-<version>.tar.gz
5. Build Redis
cd ~/src/redis-<version>
export HOMEBREW_PREFIX="$(brew --prefix)"
export BUILD_WITH_MODULES=yes
export BUILD_TLS=yes
export LTO=0
PATH="$HOMEBREW_PREFIX/opt/libtool/libexec/gnubin:$HOMEBREW_PREFIX/opt/llvm@18/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$PATH"
export LDFLAGS="-L$HOMEBREW_PREFIX/opt/llvm@18/lib"
export CPPFLAGS="-I$HOMEBREW_PREFIX/opt/llvm@18/include"
mkdir -p build_dir/etc
make -C redis-8.0 -j "$(nproc)" all OS=macos
make -C redis-8.0 install PREFIX=$(pwd)/build_dir OS=macos
6. (Optional) Verify the installation
Check the installed Redis server and CLI versions:
cd ~/src/redis-<version>
build_dir/bin/redis-server --version
build_dir/bin/redis-cli --version
7. Start Redis
To start Redis, use the following command:
cd ~/src/redis-<version>
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
build_dir/bin/redis-server redis-full.conf
To validate that the available modules have been installed, run the [INFO]/docs/latest/commands/info/ command and look for lines similar to the following:
build_dir/bin/redis-cli INFO
...
# Modules
module:name=ReJSON,ver=20803,api=1,filters=0,usedby=[search],using=[],options=[handle-io-errors]
module:name=search,ver=21005,api=1,filters=0,usedby=[],using=[ReJSON],options=[handle-io-errors]
module:name=bf,ver=20802,api=1,filters=0,usedby=[],using=[],options=[]
module:name=timeseries,ver=11202,api=1,filters=0,usedby=[],using=[],options=[handle-io-errors]
module:name=RedisCompat,ver=1,api=1,filters=0,usedby=[],using=[],options=[]
module:name=vectorset,ver=1,api=1,filters=0,usedby=[],using=[],options=[]
...