ksaitoの日記

日々試したことの覚え書き

MacPortsからhomebrewに乗り換える 作成中

移転しました。

自動的にリダイレクトします。

Macオープンソースのソフトウェアを導入するためのパッケージ管理は、MacPortsが有名です。
今回は、同様なパッケージ管理システムとしてhomebrewというのもあり試してみました。

インストール

rubyでインストールするようです。

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.github.com/gist/323731)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...

Press enter to continue
==> /usr/bin/sudo /bin/mkdir /usr/local

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local
==> Downloading and Installing Homebrew...
Warning: Now install Xcode: http://developer.apple.com/technologies/xcode.html
==> Installation successful!
Now type: brew help
$ 

パッケージをインストール

Gitコマンドをインストールしてみます。
XCodeがインストールが必須となているのでXCodeがないと、以下のようにコンパイラーが見つからずエラーになります。
App StoreからXCodeを購入するか無償の旧バージョンをインストールする必要があります。

$ brew install git
Warning: Xcode is not installed! Builds may fail!
Error: No such file or directory - /usr/bin/cc
$ 

XCodeをインストール後は、問題なくパッケージがインストールできるようになります。

$ brew install git
==> Downloading http://git-core.googlecode.com/files/git-1.7.8.tar.gz
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.8 install
==> Downloading http://git-core.googlecode.com/files/git-manpages-1.7.8.tar.gz
######################################################################## 100.0%
==> Downloading http://git-core.googlecode.com/files/git-htmldocs-1.7.8.tar.gz
######################################################################## 100.0%
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

Emacs support has been installed to:
  /usr/local/share/doc/git-core/contrib/emacs

The rest of the "contrib" is installed to:
  /usr/local/share/git/contrib
==> Summary
/usr/local/Cellar/git/1.7.8: 1118 files, 21M, built in 79 seconds
$ git --version
git version 1.7.5.4
$ 

MacPortsと同様にパッケージのインストールはバイナリではなくソースからコンパイルするようです。
homebrewはMac OSが持っているライブラリをなるべく使うように設計されているのでMacPortsに比べてインストール時間が短かくて済みます。