ぴろの狂人日記

2014年から頑張ってブログを継続しようと思います。「継続と習慣」を今年の目標にしたので、頑張って更新を続けようと思います。おいおいはレビューや数学や認知科学などについて記事を書いていければと思っています

gnuplotのインストール

ここ最近いろいろなものをインストールしております。

 
前回はTeXをインストールしましたが、gnuplotもインストールしました。
 
これについてもインストール方法を残しておこうと思います。
 
 

Aquatermのインストール

やや天下り的な感じになってしまいますが、gnuplotだけインストールしても出力をする先がないので、描画ソフトもインストールする必要があります。
調べた感じでは、ここで書くAquatermと次で書くX11が代表的なもののようなので、それをインストールします。

Aquatermのインストールについてはまずダウンロードのサイトへアクセスします。

ダウンロードしたファイルを実行すると、インストールの画面が立ち上がります。


右下の「続ける」ボタンを押して次へ行きます。そのあとも画面の指示通りに進んで行きます。

 

続けるを押すと同意するかどうかを聞かれますので、同意をして先へ進みます。

 

 

「インストール」ボタンを押すと、いろいろ処理が始まり、最終的には次の画面になります。

Finderのアプリケーションのディレクトリをみると、確かにAquatermがインストールされています。


X11(Xquarz)のインストール

いろいろ調べてみると、現在はX11はXquarzは統合されているようです。
これもインストール方法は、ほとんどAquatermを同じです。

まずはダウンロードサイトへアクセスします。

ファイルをダウンロードして実行すると、インストール画面が立ち上がりますので、それに従って進んでいくだけです。


 

 

 

 

インストール完了の画面のスクリーンショットと撮り忘れましたが、最後にインストール完了の画面が表示されます。

でFinder中のアプリケーションの中のユーティリティの中をみるとXQuarzがインストールされています。

 

gnuplotのインストール

ここまでやってしまえば、あとはすぐです。 ターミナルを起動して次のようにコマンドを打ちます。

hiroshi-no-MacBook-Air:~ hiroshi$ sudo brew install gnuplot --with-aquaterm


そうすると、次のような処理が始まります。

==> Installing dependencies for gnuplot: pkg-config, libpng, freetype, fo
==> Installing gnuplot dependency: pkg-config
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.el_capitan.
######################################################################## 100.0%
==> Pouring pkg-config-0.29.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/pkg-config/0.29: 10 files, 624.4K
==> Installing gnuplot dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.21.el_capitan.bo
######################################################################## 100.0%
==> Pouring libpng-1.6.21.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libpng/1.6.21: 17 files, 1.2M
==> Installing gnuplot dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.6.3.el_capitan.b
######################################################################## 100.0%
==> Pouring freetype-2.6.3.el_capitan.bottle.tar.gz
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
Could not symlink bin/freetype-config
Target /usr/local/bin/freetype-config
already exists. You may want to remove it:
  rm '/usr/local/bin/freetype-config'

To force the link and overwrite all conflicting files:
  brew link --overwrite freetype

To list all files that would be deleted:
  brew link --overwrite --dry-run freetype

Possible conflicting files are:
/usr/local/bin/freetype-config
/usr/local/include/freetype2/ft2build.h
/usr/local/share/aclocal/freetype2.m4
/usr/local/share/man/man1/freetype-config.1
/usr/local/lib/libfreetype.dylib -> /usr/local/lib/libfreetype.6.dylib
==> Summary
🍺  /usr/local/Cellar/freetype/2.6.3: 60 files, 2.5M
==> Installing gnuplot dependency: fontconfig
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.11.1_2.el_capi
######################################################################## 100.0%
==> Pouring fontconfig-2.11.1_2.el_capitan.bottle.tar.gz
==> /usr/local/Cellar/fontconfig/2.11.1_2/bin/fc-cache -frv
Last 15 lines from /Users/hiroshi/Library/Logs/Homebrew/fontconfig/01.fc-cache:
2016-05-29 23:47:46 +0900

/usr/local/Cellar/fontconfig/2.11.1_2/bin/fc-cache
-frv

dyld: Library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib
  Referenced from: /usr/local/Cellar/fontconfig/2.11.1_2/bin/fc-cache
  Reason: image not found
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall fontconfig`
==> Summary
🍺  /usr/local/Cellar/fontconfig/2.11.1_2: 449 files, 2.9M
==> Installing gnuplot dependency: libtiff
==> Downloading https://homebrew.bintray.com/bottles/libtiff-4.0.6.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libtiff-4.0.6.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/libtiff/4.0.6: 259 files, 3.4M
==> Installing gnuplot dependency: gd
==> Downloading https://homebrew.bintray.com/bottles/gd-2.1.1_2.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring gd-2.1.1_2.el_capitan.bottle.tar.gz
🍺  /usr/local/Cellar/gd/2.1.1_2: 34 files, 1M
==> Installing gnuplot dependency: lua
==> Downloading https://homebrew.bintray.com/bottles/lua-5.2.4_3.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring lua-5.2.4_3.el_capitan.bottle.tar.gz
==> Caveats
Please be aware due to the way Luarocks is designed any binaries installed
via Luarocks-5.2 AND 5.1 will overwrite each other in /usr/local/bin.

This is, for now, unavoidable. If this is troublesome for you, you can build
rocks with the `--tree=` command to a special, non-conflicting location and
then add that to your `$PATH`.
==> Summary
🍺  /usr/local/Cellar/lua/5.2.4_3: 82 files, 687.2K
==> Installing gnuplot
==> Downloading https://downloads.sourceforge.net/project/gnuplot/gnuplot/5.0.2/gnuplot-5.0.2.tar.gz
==> Downloading from http://tenet.dl.sourceforge.net/project/gnuplot/gnuplot/5.0.2/gnuplot-5.0.2.tar.gz
######################################################################## 100.0%
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/gnuplot/5.0.2 --with-readline=/usr/local/opt/readline --with-
==> make
==> make install
==> Caveats
AquaTerm support will only be built into Gnuplot if the standard AquaTerm
package from SourceForge has already been installed onto your system.
If you subsequently remove AquaTerm, you will need to uninstall and then
reinstall Gnuplot.
==> Summary
🍺  /usr/local/Cellar/gnuplot/5.0.2: 44 files, 2.2M, built in 2 minutes 26 seconds
hiroshi-no-MacBook-Air:~ hiroshi$


これでインストールは完了です。

確認として、次のようになれば問題なしです。

hiroshi-no-MacBook-Air:~ hiroshi$ gnuplot

G N U P L O T
Version 5.0 patchlevel 2    last modified 2015-12-24

Copyright (C) 1986-1993, 1998, 2004, 2007-2015
Thomas Williams, Colin Kelley and many others

gnuplot home:     http://www.gnuplot.info
faq, bugs, etc:   type "help FAQ"
immediate help:   type "help"  (plot window: hit 'h')

Terminal type set to 'aqua'
gnuplot>


最後の行で、

gnuplot> plot sin(x)


と打てば、また別に画面が立ち上がり、

 

 

その他

このままでは、せっかくX11もインストールしたのに、出力先としてX11がつかえません。
本当はオプションを指定する際にX11も一緒に指定しなければならないようですが、間違ってAquatermだけ指定してしまいました。

改めてX11も指定する方法については、またの機会にします。。。