Building Redis-server on macOS with TLS (make BUILD_TLS=yes redis-server) gives the following error:

sentinel.c:34:10: fatal error: 'openssl/ssl.h' file not found
#include "openssl/ssl.h"

I'm using redis 7.0.12, but it happens with previous versions of redis 7.0. The issue happens only mac (macOS 13.4.1 (22F82), Apple M1).

Comment From: itamarhaber

Hello @franciscofabian

Having openssl installed is prerequisite to building Redis with TLS. You can do that with brew install openssl - please verify that you have it.

Comment From: franciscofabian

Hello @itamarhaber

Thanks for your response. I do have openssl installed, when I do openssl version I get LibreSSL 3.3.6, the default macOS openssl version.

Comment From: bugwz

@franciscofabian hi~

I suggest you check the value of the OPENSSL_CFLAGS variable in the Makefile and verify if the corresponding directory has an include directory, and if that include directory contains the necessary header files.

If you installed openssl using the command brew install openssl, the default directory would be /opt/homebrew/opt/openssl.

Comment From: franciscofabian

Hi @bugwz,

Thanks. Installing openssl from homebrew it works. I see on the Makefile that it expects it to be installed from homebrew,

ifeq ($(uname_M),arm64)
    # Homebrew arm64 uses /opt/homebrew as HOMEBREW_PREFIX
    OPENSSL_PREFIX?=/opt/homebrew/opt/openssl
else
    # Homebrew x86/ppc uses /usr/local as HOMEBREW_PREFIX
    OPENSSL_PREFIX?=/usr/local/opt/openssl
endif

why doesn't it use the default LibreSSL that macOS has?

Comment From: bugwz

@franciscofabian Sorry, I'm not familiar with LibreSSL and don't know why not using LibreSSL.