How to install libssl-dev ,libffi-dev on Mac os?
Sebastian Wright
I can install libssl-dev and libffi-dev on Ubuntu with the command apt-get install libssl-dev libffi-dev, But I can't install on Mac; I have tried using the command: brew install libssl-dev libffi but not working for me.
What do I need to do to get homebrew to install this?
14 Answers
Those particular packages do not exist under those names on both MacPorts and Homebrew - hence the errors you are receiving. In order to install these particular packages on OS X, you will want to use openssl. The following command should help you out:
brew install opensslIf you already have openssl installed, try running the following in order to repair it - some users over on Stack Overflow reported this as a fix when trying to get Django working.
brew unlink openssl && brew link openssl --force 3 I was trying to get Crystal off the ground on MacOS Mojave and ran into a similar issue.
This is the error message I was seeing:
Error: execution of command failed with code: 1: `cc "${@}" -o '/Users/mymbp/.cache/crystal/crystal-run-server.tmp' -rdynamic
`command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libssl || printf %s '-lssl -lcrypto'` `command -v pkg-config > /dev/null && pkg-config --libs --silence-errors libcrypto || printf %s '-lcrypto'` -lz -lpcre -lgc -lpthread
/usr/local/Cellar/crystal/0.27.0/src/ext/libcrystal.a -levent -liconv -ldl -
L/usr/lib -L/usr/local/lib`Searching /usr/local/lib I noticed there was no mention of libssl.
So I added a symlink and that seemed to fix it.
ln -s /usr/local/Cellar/openssl/1.0.2p/lib/libssl.dylib /usr/local/lib/Note: The current version of openssl that brew drops is 1.0.2p, your version may be different.
1openssl was already installed, but I could not build psycopg2 because it was complaining about missing -lssl. I've followed the steps from Simon Sheehan but it was still not available.
But looking at the message after force linking openssl:
For compilers to find openssl@1.1 you may need to set: export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib" export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"So I did what it says. I've added those two lines in my ~/.bashrc. And psycopg2 builded without errors this time.
For Macports, install sudo port install openssl and set your environment variables as below.
export LDFLAGS="-L/opt/local/lib"
export CPPFLAGS="-I/opt/local/include/openssl"I found out about these locations via the command port contents openssl | grep -v "man"