The error message checking for OpenSSL or libgcrypt... configure: error: one of OpenSSL or Gcrypt was not found
indicates that the configure
script for a software package you’re trying to build requires either OpenSSL or libgcrypt to be installed, but it couldn’t find either of them on your system.
Here’s how you can resolve this issue on macOS:
1. Install OpenSSL using Homebrew
Most macOS systems don’t come with OpenSSL installed by default, or they have an outdated version. The easiest way to install OpenSSL is via Homebrew, the popular package manager for macOS.
If you don’t have Homebrew installed, you can install it by running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once you have Homebrew installed, you can install OpenSSL:
brew install openssl
2. Point the build process to the OpenSSL library
After installing OpenSSL via Homebrew, the configure
script may still not be able to find the OpenSSL libraries because they are installed in a non-default location (Homebrew typically installs OpenSSL in /opt/homebrew/opt/openssl@3
or a similar directory). You can set the environment variables LDFLAGS
and CPPFLAGS
to point to the OpenSSL installation.
Run the following commands in your terminal to specify the correct paths for OpenSSL:
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@3/lib/pkgconfig"
Note: The path
/opt/homebrew/opt/openssl@3/
is specific to OpenSSL 3.x. If you installed a different version, replaceopenssl@3
with the correct version.
3. Run the configure
script again
After setting the environment variables, try running the configure
script again:
./configure
This should now be able to find OpenSSL and proceed with the installation.
4. Install libgcrypt (Optional)
If the software you’re trying to build requires libgcrypt instead of OpenSSL, you can install it with Homebrew as well:
brew install libgcrypt
If you choose to install libgcrypt, you may need to configure the environment to point to it in a similar way as OpenSSL. For example:
export LDFLAGS="-L/opt/homebrew/opt/libgcrypt/lib"
export CPPFLAGS="-I/opt/homebrew/opt/libgcrypt/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/libgcrypt/lib/pkgconfig"
5. Re-run the configure
script
After installing either OpenSSL or libgcrypt, and setting the correct environment variables, rerun the configure
script again:
./configure
This should now successfully detect OpenSSL or libgcrypt, and you can proceed with the rest of the build process.
Troubleshooting:
- Check installation directories: If you’re still getting errors, double-check the paths where Homebrew installs libraries. You can check the path of OpenSSL with:
brew info openssl
This will show you the installation path and other information. - Missing dependencies: If the error persists, make sure all required dependencies are installed using Homebrew.
By following these steps, you should be able to resolve the error and successfully configure the software.