LoginSignup
5
2

More than 5 years have passed since last update.

brew cask install wkhtmltopdfでハマった

Last updated at Posted at 2017-09-05

wkhtmltopdfのインストール

まず、インストール方法からおさらい。
以下の公式サイトのリンクから普通は落とせば良い。
公式サイト
ただ今回、自分はできるならbrew caskを使って落としたいと思い調べると、以下のコマンドでインストールできそうなのでやってみた。

$ brew cask install wkhtmltopdf 

結果

以下のように、wkhtmltopdfだけversionが表示されず、うまく使えないという事態が発生した。(楽をしようとしたから....)

$ wkhtmltopdf --version
                          // 何も表示されない
$ wkhtmltoimage --version
wkhtmltoimage 0.12.4 (with patched qt)

原因

とりあえず、wkhtmltopdfがどこを参照しているのか確認すると原因がわかった。

$ which wkhtmltopdf
/Users/hogehoge/.rbenv/shims/wkhtmltopdf

何処かのタイミングで、bundle installした際に--path vendor/bundleをつけ忘れたなどの理由で、localのgem listにwkhtmltopdf-binaryがあった。(身に覚えはあまりない...)
このパッケージをインストールする際に、wkhtmltopdfも /Users/hogehoge/.rbenv/shims/ 以下にインストールされ、環境変数の順番的に user/local/bin/ 以下のwkhtmltopdfが参照されなかったという仕組みとなっていた。

解決方法

wkhtmltopdf-binaryをlocal gemからアンインストールした。
bundle installした際の--path vendor/bundleのつけ忘れには気をつけようー

$ gem uninstall wkhtmltopdf-binary
5
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
2