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

パンダのメモ帳

技術系のネタをゆるゆると

MacPorts から Homebrew に移行する

何番煎じかわからないけどメモ。

2013-11-11編集:記事投稿時から Homebrew のインストールスクリプトのURLが変更されているのでそれを追記。

前提条件

MacPorts をアンインストール

MacPortsおよびMacPortsからインストールしたパッケージを削除する。

$ sudo port -f uninstall installed
$ sudo rm -rf \
    /opt/local \
    /Applications/DarwinPorts \
    /Applications/MacPorts \
    /Library/LaunchDaemons/org.macports.* \
    /Library/Receipts/DarwinPorts*.pkg \
    /Library/Receipts/MacPorts*.pkg \
    /Library/StartupItems/DarwinPortsStartup \
    /Library/Tcl/darwinports1.0 \
    /Library/Tcl/macports1.0 \
    ~/.macports

Homebrew をセットアップ

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

Press enter to continue [ENTER]
==> /usr/bin/sudo /bin/mkdir /usr/local
Password: (パスワード入力)[ENTER]
==> /usr/bin/sudo /bin/chmod g+w /usr/local
==> /usr/bin/sudo /usr/bin/chgrp staff /usr/local
==> Downloading and Installing Homebrew...
==> Installation successful!

Homebrew でインストールされたコマンドは /usr/local/bin に格納されるので、このパスを /usr/bin より優先する様にする。

$ sudo vim /etc/paths
$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin

Homebrew を使ってみる

試しに subversion をインストールしてみる

$ brew install subversion
Also installing dependencies: pkg-config, neon
==> Downloading http://pkg-config.freedesktop.org/releases/pkg-config-0.25.tar.gz
######################################################################## 100.0%
==> ./configure --disable-debug --prefix=/usr/local/Cellar/pkg-config/0.25 --with-pc-path=/usr/local
==> make install
Warning: m4 macros were installed to "share/aclocal".
Homebrew does not append "/usr/local/share/aclocal"
to "/usr/share/aclocal/dirlist". If an autoconf script you use
requires these m4 macros, you'll need to add this path manually.
==> Summary
/usr/local/Cellar/pkg-config/0.25: 8 files, 248K, built in 31 seconds
==> Downloading http://www.webdav.org/neon/neon-0.29.3.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/neon/0.29.3 --disable-debug --enable-shared --disable-sta
==> make install
==> Caveats
This formula is keg-only, so it was not symlinked into /usr/local.

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

Compiling newer versions of Subversion on 10.6 require this newer neon.

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 its lib & include paths to your build variables:

  LDFLAGS: -L/usr/local/Cellar/neon/0.29.3/lib
  CPPFLAGS: -I/usr/local/Cellar/neon/0.29.3/include
==> Summary
/usr/local/Cellar/neon/0.29.3: 168 files, 1.3M, built in 16 seconds
==> Downloading http://subversion.tigris.org/downloads/subversion-1.6.17.tar.bz2
######################################################################## 100.0%
==> Downloading patches
######################################################################## 100.0%
==> Patching
patching file configure
Hunk #1 succeeded at 23390 with fuzz 1 (offset 8 lines).
Hunk #2 succeeded at 23540 with fuzz 1 (offset 32 lines).
Hunk #3 succeeded at 23693 with fuzz 1 (offset 56 lines).
Hunk #4 succeeded at 26271 (offset 67 lines).
==> ./configure --disable-debug --prefix=/usr/local/Cellar/subversion/1.6.17 --with-ssl --with-zlib=
==> make
==> make install
/usr/local/Cellar/subversion/1.6.17: 88 files, 6.0M, built in 2.4 minutes