18

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?

Suhaib Janjua
  • 3,538
  • 16
  • 59
  • 73
Tian Gao
  • 201
  • 1
  • 2
  • 8
  • Me too facing the same issue. I need it to compile `xrdp` for Mac. For now we have to go with http://mac-dev-env.patrickbougie.com/openssl/ – Necktwi Mar 03 '16 at 04:31
  • Question seems closely related to "CMake not able to find OpenSSL library". Here's the answer pertaining to MacOS: https://stackoverflow.com/a/69268455/1965146 – Tyler Nov 10 '21 at 12:19

5 Answers5

16

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"
MuseumPiece
  • 159
  • 2
  • 4
9

this command solve my problem:

brew install openssl@1.1
cp /usr/local/opt/openssl@1.1/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/
Andy Tao
  • 313
  • 2
  • 7
  • I have been following the thrift installation tutorial which led me to this comment by @AndyTao. For me version 1.1 did not work as it conflicted with some rubygems. sudo cp /usr/local/opt/openssl@1.0/lib/pkgconfig/*.pc /usr/local/lib/pkgconfig/ Copy version 1.0 of openSSL – Lucian Tarna May 16 '21 at 09:22
  • I would prefer the other solution (https://stackoverflow.com/a/65287219/314725), cleaner than potentially overwriting something in the pkgconfig folder ... – nisc Oct 18 '21 at 04:15
  • Thank you!!! After hours of reinstalls and dead ends, copying that pkgconfig folder finally allowed me to install openssl -> tidyverse in RStudio. – FromTheAshes Jan 17 '22 at 09:10
4

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 openssl@1.1

Then you can find include and lib folder in /usr/local/opt/openssl@1.0/ or /usr/local/opt/openssl@1.1, and adjust your makefile, modify the path like this:

OPENSSL_DIR = /usr/local/opt/openssl@1.1
OPENSSL_SUPPORT = -I$(OPENSSL_DIR)/include -L$(OPENSSL_DIR)/lib
McGrady
  • 10,869
  • 13
  • 47
  • 69
2
brew install openssl@1.1

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/openssl@1.1/lib/pkgconfig/
Ilay
  • 235
  • 3
  • 11
1

brew install openssl@1.1

cd /usr/local/lib/pkgconfig/

make symbolic links instead of copying

cp --symbolic-link /usr/local/opt/openssl@1.1/lib/pkgconfig/* .

Symlinks are now in the present working directory.

Michael
  • 11
  • 2