Tian Gao
Tian Gao

Reputation: 231

install openssl-devel on Mac

I need to install the openssl-devel on Mac. But I've tried brew and macport both. Neither of them work.

And I have also googled this problem--- install openssl-devel on Mac. But, I did not find an exact answer.

Anyone met this kind of problem before?

Upvotes: 21

Views: 33636

Answers (5)

Ilay
Ilay

Reputation: 234

brew install [email protected]

Don't copy anything, just set the PKG_CONFIG_PATH environment variable with the path to openssl's *.pc files:

export PKG_CONFIG_PATH=/usr/local/opt/[email protected]/lib/pkgconfig/

Upvotes: 2

Michael
Michael

Reputation: 11

brew install [email protected]

cd /usr/local/lib/pkgconfig/

make symbolic links instead of copying

cp --symbolic-link /usr/local/opt/[email protected]/lib/pkgconfig/* .

Symlinks are now in the present working directory.

Upvotes: 1

MuseumPiece
MuseumPiece

Reputation: 369

This has changed with the latest verison of brew on Big Sur (11.5.1) on a Macbook M1 (just for completeness):

export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"

Upvotes: 26

McGrady
McGrady

Reputation: 11477

I suppose you want to compile C++ program, and the C++ code include openssl headers, so just install openssl with brew:

brew install openssl

or install openssl 1.1.1 with

brew install [email protected]

Then you can find include and lib folder in /usr/local/opt/[email protected]/ or /usr/local/opt/[email protected], and adjust your makefile, modify the path like this:

OPENSSL_DIR = /usr/local/opt/[email protected]
OPENSSL_SUPPORT = -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib

Upvotes: 4

Andy Tao
Andy Tao

Reputation: 313

this command solve my problem:

brew install [email protected]
cp /usr/local/opt/[email protected]/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/

Upvotes: 9

Related Questions