OS X の OpenSSL をバージョンアップ #El Capitan
OS X の OpenSSL はバージョンが古いので、Homebrew の OpenSSL を使うようにします。
$ openssl version OpenSSL 0.9.8zh 14 Jan 2016
OpenSSL インストール
$ brew install openssl
Homebrew な OpenSSL を使うための設定
以前は brew link コマンドで、Homebrew の OpenSSL を使うようにしましたが、OpenSSL のリンクはできなくなったようです。
$ brew link openssl --force Warning: Refusing to link: openssl Linking keg-only openssl means you may end up linking against the insecure, deprecated system OpenSSL while using the headers from Homebrew's openssl. Instead, pass the full include/library paths to your compiler e.g.: -I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
なので、PATH を通すようにします。
$ echo 'export PATH=/usr/local/opt/openssl/bin:$PATH' >> ~/.bash_profile $ . ~/.bash_profile $ which openssl /usr/local/opt/openssl/bin/openssl $ openssl version OpenSSL 1.0.2j 26 Sep 2016
落穂ひろい
Homebrew な OpenSSL のヘッダファイルを使ってコンパイルする時は、以下のオプションで明示的に指定する必要があるようです。
-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib
(インストール時のメッセージ)
Generally there are no consequences of this for you. If you build your own software and it requires this formula, you'll need to add to your build variables: LDFLAGS: -L/usr/local/opt/openssl/lib CPPFLAGS: -I/usr/local/opt/openssl/include