Mountaion LionにRを入れて使うまでの準備

MacBookAirにRが入ってなかったので、入れるまでの手順をメモします。

まず前提としてMac OS X 10.8、入れる方法としてHomebrewを使用します。Homebrewそもそものインストールは他のサイトを見てください。

$ brew install gfortran

$ brew install R
Unsatisfied dependency: XQuartz 
Homebrew does not package XQuartz. Installers may be found at:
  https://xquartz.macosforge.org
Error: An unsatisfied requirement failed this build.

XQuartz入れるよってエラーが出たので、入れます。

XQuartz

ここのサイトからXQuartz.dmgを入れます。

そして、再度Rをインストール。

$ brew install R

これで入ります。が、IDE(RStudioのような)を使う場合は更に以下のコマンドを実行します。

$ sudo ln -s "/usr/local/opt/r/R.framework" /Library/Frameworks

これで使えます。

$ R

では、またー

参考サイト


Home Brewを使ってMac OS LionにRをインストール - Learning R
Install R with Home Brew under Mac OS X | nesono
X11 (XQuartz 2.7.2)をMac OS X 10.8 Mountain Lionにインストールする - memo.yomukaku.net