MACでMercurial

WindowsでMercurialを使う方法はこちらにまとめてあります。
ここでは、MACでMercurialを使う手順と、はまった点をログに残しておきます。

Homebrewのインストール

よく使われているパッケージ管理を調べたらこれだった。まずは使ってみる。

コマンドを調べる

Installation欄にある以下のコマンドをコピーして、ターミナルから実行。

$ /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"

「Installation successful!」と表示されれば成功。

gitのインストールでエラー

homebrewを更新できるようにgitを入れておく。

$ brew install git

なんかエラーになる。brew doctorを試せと言っている。

Error: Failed executing: ./configure --disable-debug --prefix=/usr/local/Cellar/pkg-config/0.25 --with-pc-path=/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig (pkg-config.rb:23)
If `brew doctor' does not help diagnose the issue, please report the bug:
    https://github.com/mxcl/homebrew/wiki/reporting-bugs
We saved the configure log, please gist it if you report the issue:
    ~/Library/Logs/Homebrew/config.log

brew doctorを実行してみると、どうやらXcodeにCommand Line Tools がセットされていないと言っています。

Error: You have no /usr/bin/cc.
This means you probably can't build *anything*. You need to install the Command Line Tools for Xcode. You can either download this from http://connect.apple.com or install them from inside Xcode's Download preferences. Homebrew does not
require all of Xcode! You only need the Command Line Tools package!
Error: Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git:

そもそもXcodeも入っていなかったので、Xcodeのインストールをする。

Xcodeのインストール

  • iOS Dev CenterでAppleDeveloppterの登録
  • 登録が完了したら、XCodeをダウンロード。Xcode 4.3.3 for lion
  • インストールが完了したら、Xcode→Preferences→Downloads→Command Line Tools→install

git他のインストール

以下を実行する。

$ brew install git
$ brew install python

日本語化

brewでインストールしてからhgコマンドを実行してみると、日本語になっていない
場合がある。以下のいずれかの方法で有効にできる。

本家からバイナリをゲットしてインストール

以下からバイナリをダウンロール。
Mercurial SCM
ファイルをダブルクリックするとインストーラーが起動。言われた通り続ければ完了。
インストール直後から、hgコマンドの結果が日本語になる。

必要ライブラリのインストール

参考サイト:Mac OS X 開発環境構築手順:Mercurialドキュメントの日本語化 - Shinya’s Daily Report

$ brew install gettext
$ brew link gettext
$ brew uninstall mercurial
$ brew install mercurial

以上