MacPorts版curlでSSLを有効にする

メモ。

curlhttps な URL を叩こうとしたとき、

curl: (1) Protocol https not supported or disabled in libcurl

こういうエラーが出るのは、curlSSL 有効にしてビルドされてないため。

./configure に --with-ssl オプションを渡してビルドし直す必要があるのだけど、MacPorts 版だったのでどうやるかわからず調べた。

まず、

sudo port uninstall curl
sudo port clean --all curl

とする。(下の行は必要だったのか知らない)

次に、

sudo port edit curl

とやって、

configure.args \
    --disable-ipv6 \
    --without-libidn \
    --without-libssh2 \
    --without-ssl \
    --disable-ldap \
    --with-zlib=${prefix}

となっているところを

configure.args \
    --disable-ipv6 \
    --without-libidn \
    --without-libssh2 \
    --with-ssl \
    --disable-ldap \
    --with-zlib=${prefix}

に変える。

この時点で自分の環境には、

/opt/local/bin/openssl
/usr/bin/openssl

の2つがインストールされていた。

最後に、

sudo port install curl

で終了。