Typhoues

pauldix's typhoeus at master - GitHub

Mac OSX で Typhoues を使う

Mac ではすんなり使えなかったので、記録の為にメモ。Ubuntu ではすんなり使えました。

Typhoues は HTTP アクセスライブラリの libcurl を利用するため、最初に curl をインストールしておく必要があります。ここでは MacPorts を使って curl をインストールしています。

SSL でアクセスするためには libcurl の ssl を有効にしてインストールしなくてはなりません。ちなみに ssl ではなく gnutls を有効にすると curl でこんなエラーメッセージを見ることになります。libcurl をインストールする際には ssl と gnutls のどちらか片方しか有効に出来ないんで、ssl を有効にするのがいいようです。

curl: (60) server certificate verification failed. CAfile: none CRLfile: none
More details here: http://curl.haxx.se/docs/sslcerts.html

curl performs SSL certificate verification by default, using a "bundle"
 of Certificate Authority (CA) public keys (CA certs). If the default
 bundle file isn't adequate, you can specify an alternate file
 using the --cacert option.
If this HTTPS server uses a certificate signed by a CA represented in
 the bundle, the certificate verification probably failed due to a
 problem with the certificate (it might be expired, or the name might
 not match the domain name in the URL).
If you'd like to turn off curl's verification of the certificate, use
 the -k (or --insecure) option.

まずは、MacPort でインストール時に指定可能な variants の確認。

$ port variants curl
curl has the variants:
        universal: Build for multiple architectures
        darwin_6: Platform variant, do not select manually
        ssl
        ipv6
        ares: Add support for resolving names asynchronously
        idn: Add support for internationalized domain names
        spnego: Enable SPNEGO authentication support
        gnutls
        gss
        openldap
        sftp_scp: Add SFTP/SCP support via libssh2
        doc

色々選べるんですね。ここでは +ssl してインストールします。

$ sudo port install curl +ssl

これで Typhoeus のインストール準備が完了しました。gem でインストールします。

$ sudo gem install pauldix-typhoeus

これで、SSL アクセスに対応した curl と Typhoeus のインストールが完了です。

ボンノウドットコム Wiki: Ruby/Typhoues (last edited 2009-07-26 03:04:04 by JunKikuchi)

このサイトに関するお問い合わせは kikuchi@bonnou.com までお願いします