How to build Redis 6 with TLS on Mac

Viewed 2032

I want to use TLS with Redis on Mac (macOS 10.15.4, kernel: Darwin 19.4.0). This is what I tried according to Documentation:

export BUILD_TLS=yes
mkdir redis && cd redis
curl -O http://download.redis.io/redis-stable.tar.gz
tar xzvf redis-stable.tar.gz
cd redis-stable
make BUILD_TLS=yes
make test
sudo make install

All tests passed but when I run:

% redis-server --tls-cluster yes

I get error:

*** FATAL CONFIG FILE ERROR (Redis 6.0.4) *** Reading the configuration file, at line 2
>>> 'tls-cluster "yes"'
Bad directive or wrong number of arguments
2 Answers

You did not specify the value for the tls-cluster configuration option. This works (on my MacBook Catelina 10.15.5):

% redis-server --tls-cluster yes

Give a try to brew install redis (currently in version 6.0.5) it includes already support for TLS, in any case, if you would like to compile it from the source you could check the brew formula: https://github.com/Homebrew/homebrew-core/blob/master/Formula/redis.rb#L18

def install
    system "make", "install", "PREFIX=#{prefix}", "CC=#{ENV.cc}", "BUILD_TLS=yes"

    %w[run db/redis log].each { |p| (var/p).mkpath }

    # Fix up default conf file to match our paths
    inreplace "redis.conf" do |s|
      s.gsub! "/var/run/redis.pid", var/"run/redis.pid"
      s.gsub! "dir ./", "dir #{var}/db/redis/"
      s.sub!  /^bind .*$/, "bind 127.0.0.1 ::1"
    end

    etc.install "redis.conf"
    etc.install "sentinel.conf" => "redis-sentinel.conf"
  end
Related