LoginSignup
12
11

More than 5 years have passed since last update.

HomebrewをMac OS X Mountain Lionにインストールする

Last updated at Posted at 2013-08-17

Rubyが入っていることを確認する。多分デフォルトで入っています。

noguchiwataru-no-MacBook-Air:~ noguchiwataru$ ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [universal-darwin12.0]

homebrewをインストール。

noguchiwataru-no-MacBook-Air:~ noguchiwataru$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1

Press ENTER to continue or any other key to abort
==> /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: Install the "Command Line Tools for Xcode": http://connect.apple.com
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help

警告が出て、homebrewでインストールする前に brew doctor しなさいと言われます。

noguchiwataru-no-MacBook-Air:~ noguchiwataru$ brew doctor
You must: brew install git
Warning: An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
You must: brew install git

Warning: No developer tools installed
You should install the Command Line Tools:
  https://developer.apple.com/downloads/
noguchiwataru-no-MacBook-Air:~ noguchiwataru$ 

ここで指摘されているのは

  • Gitのバージョンが古い
  • Xcodeのコマンドラインツールが入っていない

ということです。

Command Line Toolsのインストール

その前に Xcodeを入れた気がするのですが 、失念しました。

にアクセスしてログイン。
Apple IDがない場合は作成します。
けっこう面倒です。

xcode と検索して出てきた以下の画像にあるzipをダウンロードして、指示に従ってインストールします。

xcode_command_line.png

これでCommand Line Toolsは入ったので端末を立ち上げ直して

noguchiwataru-no-MacBook-Air:~ noguchiwataru$ brew doctor
Your system is ready to brew.

となればOKです。

最新のgitをインストール

Macにバンドルされてるバージョンのgitのバージョンが古いので、日本語ファイル名の扱いに問題が生じます。
この段階でバージョンアップしておきます。
そもそもこの段階で which git にヒットしないので、git自体がインストールされているかどうか怪しいのですが・・・。

brew install git

このままだとhomebrewでインストールされたバイナリが読み込まれないので、

~/.bash_profile
export PATH="/usr/local/bin:$PATH"

な感じに設定して source ~/.bash_profile するか端末を立ち上げ直します。

参考サイト

12
11
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
12
11