Mac OS X YosemiteにHomebrewをインストール
前回の作業から Yosemiteにアップグレードまで済ませたので、さらにHomebrewをインストールし直した際の作業メモ。
環境
- Mac OS X Yosemite 10.10.1
- Xcode Command Line Toolsはすでにインストール済み
- インストールしていなくて、Homebrewをインストールする際にセットでインストールされる
Homebrewのインストール
Homebrewのウェブサイトのトップページを参考に、ターミナルからコマンドを実行する。
% ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
インストールが完了し、
==> Installation successful! ==> Next steps Run `brew doctor` before you install anything Run `brew help` to get started
と表示されるのでbrew doctor
を実行する。
% brew doctor
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
上手くいかないのでsudo
で再実行。
% sudo brew doctor You have not agreed to the Xcode license agreements, please run 'xcodebuild -license' (for user-level acceptance) or 'sudo xcodebuild -license' (for system-wide acceptance) from within a Terminal window to review and agree to the Xcode license agreements. Error: Failure while executing: /usr/bin/otool -L /usr/bin/install_name_tool
言われる通りxcodebuild --license
を実行。
% xcodebuild -license Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.
指示に従いこれもsudo
で再実行。
% sudo xcodebuild -license You have not agreed to the Xcode license agreements. You must agree to both license agreements below in order to use Xcode. Hit the Enter key to view the license agreements at '/Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf'
Enterでライセンス条項がずらずらと出てくる。quitすると、
By typing 'agree' you are agreeing to the terms of the software license agreements. Type 'print' to print them or anything else to cancel, [agree, print, cancel]
と訊かれるのでagree
と入力してライセンスに同意する。
再びbrew doctor
を実行。
% 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: Broken symlinks were found. Remove them with `brew prune`: /usr/local/bin/cake /usr/local/bin/coffee ...
どうもアンインストール前のシンボリックリンクの残骸が
残っているようなのでbrew prune
で削除する。
% brew prune Pruned 0 dead formulae Pruned 109 symbolic links and 2 directories from /usr/local
再びbrew doctor
を実行。
% brew doctor Your system is ready to brew.
これで正常な状態に。ついでにバージョンも確認しておく。
% brew --version 0.9.5
Homebrew Caskのインストール
コマンドラインからdmgパッケージを導入するためにHomebrew Caskも導入する。
% brew install caskroom/cask/brew-cask
インストールが完了してbrew cask doctor
を実行すると、
インストール先のディレクトリへのパーミッション付与のために
初回だけパスワードを訊かれる。
% brew cask doctor ==> We need to make Caskroom for the first time at /opt/homebrew-cask/Caskroom ==> We'll set permissions properly so we won't need sudo in the future Password:
パスワードを入力すると成功する。
% brew cask doctor Password: xxxxxxxx ==> OS X Release: 10.10 ==> OS X Point Release: 10.10.1 ==> Hardware Architecture: intel-64 ==> Ruby Version: 2.0.0-p481 ==> Ruby Path: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby ==> Homebrew Version: 0.9.5 (snip ...)
パッケージの取得
個人的に必要なパッケージをいくつか取得。
brew install
によるインストール
lv
高機能なコマンドラインのページャプログラム。
% brew install lv
GNU screen
Yosemiteにプリインされているscreenは少しバージョンが古いので、 Homebrewから最新を取得する。
% brew search screen homebrew/dupes/screen ...
詳細をbrew info
で確認してみる。
% brew info homebrew/dupes/screen Error: No available formula for screen Please tap it and then try again: brew tap homebrew/dupes
言われた通りにbrew tap
を実行。
% brew tap homebrew/dupes Cloning into '/usr/local/Library/Taps/homebrew/homebrew-dupes'... ... Tapped 37 formulae
再びbrew info
を実行。
% brew info screen screen: stable 4.2.1, HEAD http://www.gnu.org/software/screen /usr/local/Cellar/screen/4.2.1 (26 files, 1.2M) Built from source From: https://github.com/homebrew/homebrew-dupes/blob/master/screen.rb ==> Dependencies Build: autoconf ✔, automake ✔
インストールを実行。
% brew install screen
Yosemiteデフォルトのscreenがあるせいか
/usr/local/bin
直下にシンボリックリンクを張ってくれないので自前で作成。
% ln -s ../Cellar/screen/4.2.1/bin/screen screen
% rehash
brew cask install
によるインストール
iTerm2
% brew cask install iterm2
Google Japanese IME
% brew cask install google-japanese-ime
インストール後は日本語変換エンジンを起動するために、Macを一度再起動する必要がある。
Dropbox
% brew cask install dropbox
Firefox
FormulaのURLを日本語パッケージに変更。
環境変数EDITOR
でFormulaを編集するためのエディタを指定できる。
% EDITOR=vim brew cask edit firefox #=> 日本語対応版に変更 - url 'https://download.mozilla.org/?product=firefox-latest&os=osx&lang=en-US' + url 'https://download.mozilla.org/?product=firefox-latest&os=osx&lang=ja-JP-mac' % brew install firefox
その他
HomebrewでGitHubのアクセス上限回数を引き上げ
パッケージの探索でbrew search
などをしまくっていると、
% brew search caskroom/cask/brew-cask brew-cask Error: GitHub API rate limit exceeded for 126.80.145.113. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) Try again in 55 minutes 4 seconds, or create an API token: https://github.com/settings/applications and then set HOMEBREW_GITHUB_API_TOKEN.
と警告される。これを回避するには上記のURL先でAPI tokenを作成し HOMEBREW_GITHUB_API_TOKENという環境変数でセットする。
% export HOMEBREW_GITHUB_API_TOKEN=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
これで1時間に5000回までは許されるようになるらしい。