LoginSignup
245
271

More than 5 years have passed since last update.

MacにHomebrewをインストールする

Last updated at Posted at 2014-07-28

環境:Mac OS X 10.9.4

HomebrewはMacにソフトウェアやライブラリをインストールするパッケージ管理システム。
HomebrewはMacPortsの後発パッケージで、MacPortsの様にすべてのライブラリをダウンロードするのではなく、Macに入っているライブラリを極力使用するのが特徴。
※ MacPortsとHomebrewは共存しない方が安全らしいです。

Homebrewを使用すると、/usr/localディレクトリ以下にインストールされます。

Command Line Tools for Xcodeのインストール

Homebrewのインストールには、Command Line Tools for Xcodeが必要なのでインストールします。
※ 事前にXcodeがインストール(App Storeからインストールできます)されて、ライセンス使用許諾契約に同意済みであること。

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

Command Line Tools for Xcodeのインストールダイアログ

  1. 「インストール」ボタンを押下する。
  2. 使用許諾契約画面が表示されるので「同意する」を押下する。
  3. Command Line Tools for Xcodeのインストール完了です。

Homebrewのインストール

Homebrewのサイトに下のコマンドが記載されているのでコピーしてペーストして実行すれば完了です。

$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
==> The following directories will be made group writable:
/usr/local/.
/usr/local/bin
/usr/local/lib
/usr/local/share
/usr/local/share/doc
==> The following directories will have their group set to admin:
/usr/local/bin
/usr/local/share
/usr/local/share/doc

Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin /usr/local/lib /usr/local/share /usr/local/share/doc

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 /usr/bin/chgrp admin /usr/local/bin /usr/local/share /usr/local/share/doc
==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 184874, done.
remote: Compressing objects: 100% (50748/50748), done.
remote: Total 184874 (delta 133006), reused 184810 (delta 132957)
Receiving objects: 100% (184874/184874), 36.91 MiB | 57.00 KiB/s, done.
Resolving deltas: 100% (133006/133006), done.
From https://github.com/Homebrew/homebrew
 * [new branch]      master     -> origin/master
HEAD is now at 601338e Remove proc handling from BuildEnvironment
==> Installation successful!
==> Next steps
Run `brew doctor` before you install anything
Run `brew help` to get started

途中でEnterキーの入力とパスワードの入力を促され、インストールには少し時間が掛かりました。
インストールが終了すると、brew doctorを実行しなさいと促されるので実行します。

brew doctorの実行

brew doctorはHomebrewのインストールやその後の使用に問題がないか確認するためのコマンドです。

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Unbrewed dylibs were found in /usr/local/lib.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:
    /usr/local/lib/libecomlodr.dylib

あれ?なんかWarningが出ている…なんか「削除する必要があるかも」って言っている。
何のファイルかわからないので消すのは怖いから、とりあえずリネームして置いておく。

$ mv /usr/local/lib/libecomlodr.dylib /usr/local/lib/libecomlodr.dylib.bak 

2014.12.1 追記
どうもNorton Internet Security関連ぽい Issue #18348、警告なので無視しても良いのかも…

再度、brew doctorを実行。

$ brew doctor
Your system is ready to brew.

今度は大丈夫みたい。

$ brew -v
Homebrew 0.9.5

一応、Homebrewのアップデートを実行します。Homebrewの本体が更新された場合などに実行します。
時々、実行すると良いようです。

$ brew update
Updated Homebrew from 601338e8 to d19f3bdb.
==> Updated Formulae
pgpool-ii
$
245
271
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
245
271