# opensslがらみのCPANモジュールをMac OS X El Capitanにcpanmでインストールする {{tag: mac, perl, cpan, cpanm, module, openssl}} brew インストールした openssl においては、各自ライブラリをコンパイルするときにパス指定してちょ、ということになったらしいので、cpanm で openssl がらみのモジュールをインストールする際は、そのようにする。 $ brew install 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 上のように brew で入れた openssl にリンク張り替えてもらうコマンドは --force でも駄目でコンパイラにパス渡せと。 なので例えば、{{cpan: Crypt::OpenSSL::AES}} 入れたい場合は以下のように。 cpanm --interactive --configure-args="INC=-I/usr/local/opt/openssl/include LDFLAGS='-L/usr/local/opt/openssl/lib'" -L extlib --force Crypt::OpenSSL::AES {{cpan: CPAN}} コマンドの場合は、以下のような感じの様子。モジュールの Makefile.PL/Build.PL を見れば環境変数書いてある。 # OPENSSL_INCLUDE=/usr/local/opt/openssl/include OPENSSL_LIB=/usr/local/opt/openssl/lib PERL_MM_USE_DEFAULT=1 cpan Crypt::OpenSSL::AES `o conf` でデフォルトの環境変数に突っ込んでおくのが良さげかもしれない。 ## see also * *