Mac OS X 開発環境構築手順:Homebrewインストール

Homebrewインストールに必要な環境は以下の通り。

An Intel CPU 2
OS X 10.5 or higher
Command Line Tools for Xcode or Xcode 3with X11 4
Java Developer Update 5

そして、Xcodeについてはこの作業を行う前にインストールを行う必要がありました。『Command Line Tools for Xcode』で事足りるというアドバイスを頂きましたので、そちらを導入(手順は以下)。


Xcode導入後の手順を以下にメモ。

  • 『/usr/local』フォルダを作成。(※存在しない場合) sudo経由で作成するのでパスワードを入力。
$ sudo 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:************************ 【ログインパスワードを入力】
  • 所定のコマンドを入力(下記コード1行目:上記サイトからコピペして実行が吉)。
$ /usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/Formula/...
/usr/local/Library/Homebrew/...
==> The following directories will be made group writable:
/usr/local/.
==> The following directories will have their group set to admin:
/usr/local/.

Press enter to continue
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/.
Password:************************ 【ログインパスワードを入力】
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/.
==> Downloading and Installing Homebrew...
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help
$ 
  • 環境変数の追加を行う。ログインユーザの .bash_profile に以下の内容を追記。『source .bash_profile』で反映。
...
...

PATH=/usr/local/bin:$PATH
export PATH
  • インストール確認として、バージョンが出るか試してみる。
$ brew -v
  • また、インストールしたいキーワードでも検索してみる。
$ brew search groovy
groovy       groovyserv
  • (追記)brew versions』等を使うために、上記処理終了後『brew update』コマンドを実行。
$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 74137, done.
remote: Compressing objects: 100% (36578/36578), done.
remote: Total 74137 (delta 50150), reused 58276 (delta 36749)
Receiving objects: 100% (74137/74137), 10.58 MiB | 317 KiB/s, done.
Resolving deltas: 100% (50150/50150), done.
From https://github.com/mxcl/homebrew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      go         -> origin/go
 * [new branch]      master     -> origin/master
HEAD is now at 54d2abc jailkit 2.15
Already up-to-date.
$ 

参考サイト: