読者です 読者をやめる 読者になる 読者になる

mfks17's blog

趣味や思った事を書いていくと思います

macにRubyist向けプレゼンツールRabbitをインストールする(だけ)

mac Homebrew rabbit gem

↑サンプル動きました。

プレゼンをやる羽目になりそうなので、入れてみようと思います。

Ruby会議で使っている方(開発者?)がいたりとある勉強会で、まつもとゆきひろさんが使っているのを生でみてかっこいいなぁと思ったので。


X11はMountain Lionには入っていないのでここから落としてきます。

インストールする方法はいろいろあるようですが、今回はHomebrewで入れたいと思います。
ここではHomebrewのインストールの手順は、割愛させていただきます。

$ brew install cairo
==> Installing cairo dependency: libpng
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/libpng-1.5.13.mountainlion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.5.13.mountainlion.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.5.13: 14 files, 1.0M
==> Installing cairo dependency: pixman
==> Downloading http://cairographics.org/releases/pixman-0.28.0.tar.gz
######################################################################## 100.0%
==> ./configure --disable-gtk --prefix=/usr/local/Cellar/pixman/0.28.0 --disable-mmx
==> make install
🍺  /usr/local/Cellar/pixman/0.28.0: 11 files, 1.2M, built in 67 seconds
==> Installing cairo dependency: gettext
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/gettext-0.18.1.1.mountainlion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gettext-0.18.1.1.mountainlion.bottle.tar.gz
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

OS X provides the BSD gettext library and some software gets confused if both are in the library path.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/gettext/lib
    CPPFLAGS: -I/usr/local/opt/gettext/include

==> Summary
🍺  /usr/local/Cellar/gettext/0.18.1.1: 366 files, 12M
==> Installing cairo dependency: libffi
==> Downloading http://mirrors.kernel.org/sources.redhat.com/libffi/libffi-3.0.11.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/libffi/3.0.11
==> make install
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Some formulae require a newer version of libffi.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libffi/lib

==> Summary
🍺  /usr/local/Cellar/libffi/3.0.11: 13 files, 312K, built in 25 seconds
==> Installing cairo dependency: glib
==> Downloading http://ftp.gnome.org/pub/gnome/sources/glib/2.34/glib-2.34.3.tar.xz
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file aclocal.m4
patching file config.h.in
patching file configure
Hunk #2 succeeded at 27749 (offset 1 line).
patching file configure.ac
patching file gio/gdbusprivate.c
patching file gio/xdgmime/xdgmime.c
==> ./configure --disable-maintainer-mode --disable-dtrace --prefix=/usr/local/Cellar/glib/2.34.3 --localstatedir=/
==> make
==> make install
🍺  /usr/local/Cellar/glib/2.34.3: 407 files, 15M, built in 6.0 minutes
==> Installing cairo
==> Downloading http://cairographics.org/releases/cairo-1.12.8.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/cairo/1.12.8 --with-x
==> make install
🍺  /usr/local/Cellar/cairo/1.12.8: 106 files, 7.3M, built in 4.8 minutes
$ brew link cairo
Warning: Already linked: /usr/local/Cellar/cairo/1.12.8
To relink: brew unlink cairo && brew link cairo
$ brew install pango
==> Downloading http://ftp.gnome.org/pub/GNOME/sources/pango/1.30/pango-1.30.1.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/pango/1.30.1 --enable-man --with-html-dir=/usr/local/Cellar/pango/1.30.1/share/do
==> make
==> make install
🍺  /usr/local/Cellar/pango/1.30.1: 133 files, 4.1M, built in 89 seconds
$ brew install gtk+
==> Installing gtk+ dependency: jpeg
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/jpeg-8d.mountainlion.bottle.tar.gz
######################################################################## 100.0%
==> Pouring jpeg-8d.mountainlion.bottle.tar.gz
🍺  /usr/local/Cellar/jpeg/8d: 18 files, 1.3M
==> Installing gtk+ dependency: libtiff
==> Downloading http://download.osgeo.org/libtiff/tiff-4.0.3.tar.gz
######################################################################## 100.0%
==> ./configure --without-x --prefix=/usr/local/Cellar/libtiff/4.0.3
==> make install
🍺  /usr/local/Cellar/libtiff/4.0.3: 254 files, 3.7M, built in 71 seconds
==> Installing gtk+ dependency: gdk-pixbuf
==> Downloading http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.26/gdk-pixbuf-2.26.2.tar.xz
######################################################################## 100.0%
==> ./configure --disable-maintainer-mode --enable-debug=no --prefix=/usr/local/Cellar/gdk-pixbuf/2.26.2 --enable-introspection=no 
==> make
==> make install
🍺  /usr/local/Cellar/gdk-pixbuf/2.26.2: 198 files, 3.7M, built in 69 seconds
==> Installing gtk+ dependency: jasper
==> Downloading http://download.osgeo.org/gdal/jasper-1.900.1.uuid.tar.gz
######################################################################## 100.0%
==> Patching
patching file src/libjasper/jpc/jpc_dec.c
==> ./configure --enable-shared --prefix=/usr/local/Cellar/jasper/1.900.1 --mandir=/usr/local/Cellar/jasper/1.900.1/share/man
==> make install
🍺  /usr/local/Cellar/jasper/1.900.1: 35 files, 968K, built in 75 seconds
==> Installing gtk+ dependency: atk
==> Downloading http://ftp.gnome.org/pub/gnome/sources/atk/2.6/atk-2.6.0.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/atk/2.6.0 --enable-introspection=no
==> make
==> make install
🍺  /usr/local/Cellar/atk/2.6.0: 184 files, 2.5M, built in 36 seconds
==> Installing gtk+
==> Downloading http://ftp.gnome.org/pub/gnome/sources/gtk+/2.24/gtk+-2.24.11.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/gtk+/2.24.11 --disable-glibtest --disable-introspection --disable-visibility
==> make install
🍺  /usr/local/Cellar/gtk+/2.24.11: 1184 files, 52M, built in 8.0 minutes
$ brew install poppler --with-glib
==> Installing poppler dependency: little-cms2
==> Downloading http://sourceforge.net/projects/lcms/files/lcms/2.4/lcms2-2.4.tar.gz
######################################################################## 100.0%
tar: copyfile unpack (lcms2-2.4/Projects/mac/.DS_Store) failed: File exists
tar: copyfile unpack (lcms2-2.4/Projects/mac/LittleCMS/.DS_Store) failed: File exists
==> ./configure --prefix=/usr/local/Cellar/little-cms2/2.4
==> make install
🍺  /usr/local/Cellar/little-cms2/2.4: 17 files, 1.0M, built in 59 seconds
==> Installing poppler dependency: openjpeg
==> Downloading http://openjpeg.googlecode.com/files/openjpeg-1.5.1.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/openjpeg/1.5.1
==> make install
🍺  /usr/local/Cellar/openjpeg/1.5.1: 18 files, 608K, built in 41 seconds
==> Installing poppler
==> Downloading http://poppler.freedesktop.org/poppler-0.20.5.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/poppler/0.20.5 --enable-xpdf-headers --disable-poppler-qt4 --enable-poppler-glib
==> make install
==> Downloading http://poppler.freedesktop.org/poppler-data-0.4.6.tar.gz
######################################################################## 100.0%
==> make install prefix=/usr/local/Cellar/poppler/0.20.5
🍺  /usr/local/Cellar/poppler/0.20.5: 455 files, 22M, built in 3.7 minutes

Rabbitのインストール

$ gem install rabbit
Building native extensions.  This could take a while...
ERROR:  Error installing rabbit:
	ERROR: Failed to build gem native extension.

        /Users/typosterr/.rbenv/versions/1.9.3-p327/bin/ruby extconf.rb
checking for -Wall option to compiler... yes
checking for -Waggregate-return option to compiler... yes
checking for -Wcast-align option to compiler... yes
checking for -Wextra option to compiler... yes
checking for -Wformat=2 option to compiler... yes
checking for -Winit-self option to compiler... yes
checking for -Wlarger-than-65500 option to compiler... yes
checking for -Wmissing-declarations option to compiler... yes
checking for -Wmissing-format-attribute option to compiler... yes
checking for -Wmissing-include-dirs option to compiler... yes
checking for -Wmissing-noreturn option to compiler... yes
checking for -Wmissing-prototypes option to compiler... yes
checking for -Wnested-externs option to compiler... yes
checking for -Wold-style-definition option to compiler... yes
checking for -Wpacked option to compiler... yes
checking for -Wp,-D_FORTIFY_SOURCE=2 option to compiler... yes
checking for -Wpointer-arith option to compiler... yes
checking for -Wswitch-default option to compiler... yes
checking for -Wswitch-enum option to compiler... yes
checking for -Wundef option to compiler... yes
checking for -Wunsafe-loop-optimizations option to compiler... yes
checking for -Wwrite-strings option to compiler... yes
checking for rb_define_alloc_func() in ruby.h... yes
checking for rb_block_proc() in ruby.h... yes
checking for new allocation framework... yes
checking for attribute assignment... no
checking for Win32 OS... no
checking for gstreamer-0.10... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
	--with-opt-dir
	--with-opt-include
	--without-opt-include=${opt-dir}/include
	--with-opt-lib
	--without-opt-lib=${opt-dir}/lib
	--with-make-prog
	--without-make-prog
	--srcdir=.
	--curdir
	--ruby=/Users/typosterr/.rbenv/versions/1.9.3-p327/bin/ruby
	--with-pkg-config
	--without-pkg-config
	--with-override-variables
	--without-override-variables
/Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:239:in `parse_pc': .pc for libxml-2.0 doesn't exist. (RuntimeError)
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:181:in `declaration'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:126:in `requires'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:305:in `required_packages'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:213:in `collect_libs'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:143:in `libs'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:214:in `block in collect_libs'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:213:in `collect'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:213:in `collect_libs'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:148:in `libs_only_l'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:356:in `libs_only_l'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/pkg-config-1.1.4/lib/pkg-config.rb:404:in `have_package'
	from /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/glib2-1.1.9/lib/mkmf-gnome2.rb:540:in `required_pkg_config_package'
	from extconf.rb:44:in `<main>'


Gem files will remain installed in /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/gstreamer-1.1.9 for inspection.
Results logged to /Users/typosterr/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/gstreamer-1.1.9/ext/gstreamer/gem_make.out

libxml2がなさそうなので

$ brew install libxml2
==> Downloading ftp://xmlsoft.org/libxml2/libxml2-2.8.0.tar.gz
######################################################################## 100.0%
######################################################################## 100.0%==> ./configure --prefix=/usr/local/Cellar/libxml2/2.8.0 --without-python
==> make
==> make install
==> Caveats
This formula is keg-only: so it was not symlinked into /usr/local.

Mac OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.

Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:

    LDFLAGS:  -L/usr/local/opt/libxml2/lib
    CPPFLAGS: -I/usr/local/opt/libxml2/include

==> Summary
&#127866;  /usr/local/Cellar/libxml2/2.8.0: 242 files, 10M, built in 5.3 minutes

そして、ここを参考に

$ PKG_CONFIG_PATH=/usr/local/opt/libxml2/lib/pkgconfig gem install gstreamer
Building native extensions.  This could take a while...
This library is experimental.
Successfully installed gstreamer-1.1.9
1 gem installed
Installing ri documentation for gstreamer-1.1.9...
Installing RDoc documentation for gstreamer-1.1.9...

これで入りました。改めて、

$ rbenv rehash 
$ gem install rabbit
Fetching: rabbit-2.0.6.gem (100%)
Successfully installed rabbit-2.0.6
1 gem installed
Installing ri documentation for rabbit-2.0.6...
Installing RDoc documentation for rabbit-2.0.6...

キターーー

さらに追記分


次に環境変数の設定をします。

~/.bash_loginあるいは~/.zshenvで以下のようにDYLD_LIBRARY_PATH環境変数を設定します。

export DYLD_LIBRARY_PATH=/usr/local/opt/cairo/lib

サンプルを動かしてみる

参考サイト様:プレゼンツール「Rabbit」をインストールした

$ cd ~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/rabbit-2.0.6/sample
$ rabbit -I ./rabbit/theme/ -t rabbit-and-tortoise rabbit.rd

疲れたので、取りあえずこれくらい。

追記


インストールしたのはいいが、肝心のスライドが作れない事象が発生。
また今度、書く。
ちなみにubuntu12.04でaptitudeで入れたrabbitはrabbit-slideコマンドがないのでひな形が作れなくて積んでます。
どなたか、ご存じの方いらっしゃいますか?

さらに追記


上記のスライドが作れない件は、こちらの勘違いでした。
Mac OS XでHomebrewを使ったインストール方法を参考に.bash_loginに

export DYLD_LIBRARY_PATH=/usr/local/opt/cairo/lib

を追加して、ターミナルを再起動したらいけました。

Ubuntuの件は、再調査します。
さらに追記ここまで

お読みいただきありがとうございました。