公式サイト
事前準備
以下の公式サイトから、Homebrewをインストールしておいてください。
ライブラリのインストール
まず、必要なライブラリをHomebrewでインストールします。
$ brew install cairo
$ brew link cairo
$ brew link --overwrite pixman
$ brew install pango
$ brew install gtk+
$ brew install poppler --with-glib
RabbitのGemをインストール
Rabbitを使うために必要なGemをインストールします。
$ sudo PKG_CONFIG_PATH=/usr/local/opt/libffi/lib/pkgconfig gem install rabbit
$ sudo gem install rabbiter # Twitter連携機能を使う場合
続いて、bashに環境変数を設定しましょう。
export DYLD_LIBRARY_PATH=/usr/local/opt/cairo/lib
一通りインストールした後に、Rabbit公式サイトにある以下のページからrabbit-slideコマンドを実行してみます。
しかし、PopplerというライブラリとHomebrewの相性が悪いのか、実行イメージがないとしてエラーが出てしまいます。
$ rake
(null)-WARNING **: Failed to load shared library '@rpath/libpoppler-glib.8.dylib' referenced by the typelib: dlopen(@rpath/libpoppler-glib.8.dylib, 9): image not found
brew info
コマンドを使って、エラーの原因であるpopplerについての情報を確認してみます。
$ brew info poppler
PDF rendering library (based on the xpdf-3.0 code base)
https://poppler.freedesktop.org/
Conflicts with:
pdf2image (because poppler, pdftohtml, pdf2image, and xpdf install conflicting executables)
pdftohtml (because poppler, pdftohtml, pdf2image, and xpdf install conflicting executables)
xpdf (because poppler, pdftohtml, pdf2image, and xpdf install conflicting executables)
/usr/local/Cellar/poppler/0.66.0 (441 files, 22.5MB) *
Poured from bottle on 2018-06-23 at 22:19:00
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/poppler.rb
==> Dependencies
Build: cmake ✘, gobject-introspection ✘, pkg-config ✔
Required: cairo ✔, fontconfig ✔, freetype ✔, gettext ✔, glib ✔, jpeg ✔, libpng ✔, libtiff ✔, openjpeg ✔
Optional: qt ✘, little-cms2 ✔, nss ✘
==> Options
--with-little-cms2
Use color management system
--with-nss
Use NSS library for PDF signature validation
--with-qt
Build Qt5 backend
--HEAD
Install HEAD version
Dependenciesの箇所をみてみると、cmake
とgobject-introspection
、qt
にそれぞれ✘がついているのがわかります。
これらがないとRabbitは動かないので、それぞれインストールしましょう。
$ brew install cmake
$ brew install gobject-introspection
# もし、「gobject-introspectionがすでにインストールされているよ」というエラーが出てきたら、以下のコマンドでアップデートします。
# updateの途中にpythonに関するエラーが出ますが、今回のrabbitはRuby製なのでスルーします。
$ brew upgrade gobject-introspection
$ brew reinstall poppler --with-qt
一通りインストールが完了したら、もう一度該当ファイルがある箇所でrake
コマンドを実行します。
$ rake
実行後、別ウィンドウによって画像のような画面が立ち上がればOKです!
スライド1
スライド2
スライド3
番外編:コマンドラインツールについて
Rabbitに必要なライブラリをHomebrewでインストールしている最中に、アップデートしていないとエラーが出ます。
Error: A newer Command Line Tools release is available.
Update them from Software Update in the App Store.
表記通りApp StoreからインストールしてもOKですが、僕の場合、MBAを使っているのですがSSDのストレージが110GB/128GBで残り空き容量が少ないのでかなり時間がかかってしまっていました。
うんともすんともMac版App Storeアプリが動かないので、ターミナルから以下のようにしてインストールしました。
# 一度既存のCommandLineToolsを削除
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install
これで約4分くらいでサクッとアップデートという名の再インストールができました。
同じ悩みを抱えている方の参考になれば嬉しいです!
参考サイト