Help us understand the problem. What is going on with this article?

初めてのHomebrewインストール.

More than 5 years have passed since last update.

MacにLionちゃんを入れ直した環境構築です(「・ω・)「ガオー
とりあえず、色々なものを入れる前にHomebrewを入れます。

Homebrewとは

  • Homebrewは最も簡単で柔軟性のあるOSX用のUNIXツールのインストーラー
  • パッケージはCellarというプレフィックスで分離され、/usr/binにリンクおいて管理
  • Homebrewには自分自身も同梱されている
  • 数秒でHomebrewのパッケージを作成可能
  • Git管理で簡単にカスタマイズや上流バージョンのマージができる
  • HomebrewのformulaはRubyスクリプトで記述

(参考URL:http://d.hatena.ne.jp/sifue/20120318/1332081624)

とりあえず、Homebrew入れて、「brew install ツール名」で簡単インストールができちゃう代物らしい。

後々また勉強します。

homebrewのインストール

install
/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/...

Press enter to continue
==> /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...
==> Installation successful!
You should run `brew doctor' *before* you install anything.
Now type: brew help

このようにインストールが終わる。
インストール後に"brew doctor"を実行することを求められる。

brew_doctor
Yoshinori-no-MacBook:~ sugiyama$ brew doctor

Warning: 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!
Warning: 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:
  brew install git
Warning: Your compilers are different from the standard versions for your Xcode.
If you have Xcode 4.3 or newer, you should install the Command Line Tools for
Xcode from within Xcode's Download preferences.
Otherwise, you should reinstall Xcode.
Warning: Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct
path at this time if you have *only* installed the Command Line Tools for Xcode.
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:

    sudo xcode-select -switch /Developer
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

DO NOT SET / OR EVERYTHING BREAKS!

Xcodeのメニュー
Xcode->Open Developer tool -> More Developer tool
をクリックして、ジャンプ先から Command Line Tool for Xcodeをダウンロードする。
ダウンロードして、通常のアプリケーションと同じようにインストール。
その後、brew doctorに再チャレンジ。

brew_doctor(again)
Yoshinori-no-MacBook:~ sugiyama$ brew doctor

Warning: Your Xcode is configured with an invalid path.
You should change it to the correct path. Please note that there is no correct
path at this time if you have *only* installed the Command Line Tools for Xcode.
If your Xcode is pre-4.3 or you installed the whole of Xcode 4.3 then one of
these is (probably) what you want:

    sudo xcode-select -switch /Developer
    sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

DO NOT SET / OR EVERYTHING BREAKS!

Yoshinori-no-MacBook:~ sugiyama$ sudo xcode-select -switch /Developer
Password:
xcode-select: Error: Path "/Developer" is not a directory.

Yoshinori-no-MacBook:/ sugiyama$ sudo mkdir Developer
Yoshinori-no-MacBook:/ sugiyama$ sudo xcode-select -switch /Developer
Yoshinori-no-MacBook:/ sugiyama$  sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Yoshinori-no-MacBook:/ sugiyama$ brew doctor
Your system is raring to brew.

Your system is to raring to brew
君のシステムが、Brewしたくてうずうずしてるよー(°∀°)
とのこと。

Homebrewのアップデート自体Gitを使っているので、まずはGitをインストール。
(参考URL:http://www.milligramme.cc/wp/archives/2880)

brew_install_git
Yoshinori-no-MacBook:/ sugiyama$ brew search git
bagit        git-encrypt      git-gerrit       git-sh       git-url-sub      legit        topgit
git      git-extras   git-hg       git-ssh      git-utils        libgit2          willgit
git-cola     git-flow     git-multipush    git-subtree      giter8       magit
git-diffall  git-ftp      git-now      git-svn-abandon  gitslave         stgit

Yoshinori-no-MacBook:/ sugiyama$ brew install git
==> Downloading http://git-core.googlecode.com/files/git-1.7.10.tar.gz
######################################################################## 100.0%
==> make prefix=/usr/local/Cellar/git/1.7.10 CC=/usr/bin/clang CFLAGS=-Os -w -pipe -march=native -Qunused-arguments LDFLAGS= install
==> make CC=/usr/bin/clang CFLAGS=-Os -w -pipe -march=native -Qunused-arguments
==> make clean
==> Downloading http://git-core.googlecode.com/files/git-manpages-1.7.10.tar.gz
######################################################################## 100.0%
==> Downloading http://git-core.googlecode.com/files/git-htmldocs-1.7.10.tar.gz
######################################################################## 100.0%
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d

The OS X keychain credential helper has been installed to:
  /usr/local/bin/git-credential-osxkeychain

The 'contrib' directory has been installed to:
  /usr/local/share/git-core/contrib
==> Summary
/usr/local/Cellar/git/1.7.10: 1166 files, 23M, built in 2.1 minutes

これで、無事にgitのインストールも終わったはず。
一応、念のため確認。

git_version
Yoshinori-no-MacBook:/ sugiyama$ git --version
git version 1.7.7.5 (Apple Git-26)

さらに、最homebrewにするために、brew updateを実行。

brew_update
Yoshinori-no-MacBook:bin sugiyama$ brew update
Initialized empty Git repository in /usr/local/.git/
remote: Counting objects: 64258, done.
remote: Compressing objects: 100% (27436/27436), done.
remote: Total 64258 (delta 42511), reused 54715 (delta 36031)
Receiving objects: 100% (64258/64258), 9.82 MiB | 516 KiB/s, done.
Resolving deltas: 100% (42511/42511), done.
From https://github.com/mxcl/homebrew
 * [new branch]      gh-pages   -> origin/gh-pages
 * [new branch]      master     -> origin/master
HEAD is now at 52fe8c0 LibDAP: Use explicit path to system curl
Already up-to-date.

そして、最後にバージョン確認で、brew -v

brew_version
Yoshinori-no-MacBook:bin sugiyama$ brew -v
0.9

これでhomebrewのインストールはおしまい。

重要キーワード

brew install アプリ名
brew update
brew list

brewコマンドリスト参考URL

http://michitoshi.blogspot.jp/2011/01/homebrew.html

sugi511
アフリカ向けにRuby on Railsでアプリケーション作ってます
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away