As with the Linux build, use CMake.
If you used Homebrew to install
a supported version of OpenSSL, you
need to tell CMake where to find it with OPENSSL_ROOT_DIR. You'll also need to
tell the C compiler to add the openssl include path.
export OPENSSL_ROOT_DIR=`brew --prefix openssl`
export CFLAGS="-I$(brew --prefix openssl)/include"OS X compilers treat uninitialized global variables as
common symbols,
which can be eliminated with the -fno-common compiler option.
export CFLAGS="${CFLAGS} -fno-common"Initialize the CMake build normally:
cmake -S . -B DebugMacOSOpenSSL64Then build:
cmake --build DebugMacOSOpenSSL64You might encounter an error where the compiler can't locate the standard library headers:
fatal error: 'cstddef' file not found
52 | #include <cstddef>
| ^~~~~~~~~
[ 9%] Linking C static library libTpm_PlatformLib.a
1 error generated.
This may occur if the OS X developer command-line tools were upgraded from an older version. One workaround is to perform a clean reinstall of the OS X developer command line tools.
For more information see: nodejs/node#55023