最近は、MacPortsよりもHomebrewをインストールする方がほとんど。でも滅多にアップデート・インストールしないので、コマンドを忘れてしまう。 ということで、コマンドのメモを書いておく。
$ brew update $ brew upgrade
$ brew install パッケージ名
$ brew uninstall パッケージ名
$ brew search パッケージ名
但し、Homebrewのダウンロード先(GitHub)には認証なしのアクセスについて、同じIPアドレスから1時間に60回までというアクセス制限があるため、searchを多用するとすぐに上限に達してしまうので注意。上限に達すると
$ brew search Error: GitHub API rate limit exceeded for xxx.xxx.xxx.xx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.) You may want to create an API token: https://github.com/settings/applications and then set HOMEBREW_GITHUB_API_TOKEN.
現在の検索可能回数は、以下のコマンドで確認できる。だたし、コマンド実行で1回分使用してしまうので注意。
$ curl -i https://api.github.com/users/whatever HTTP/1.1 200 OK Server: GitHub.com DATE: Tue, 03 Feb 2015 06:32:xx GMT Content-Type: application/json; charset=utf-8 Content-Length: 1096 Status: 200 OK X-RateLimit-Limit: 60 X-RateLimit-Remaining: 47 X-RateLimit-Reset: 1422947680 ...
その他使い方については
$ man brew $ brew help
で参照。
homebrewでpdftkをインストールするためのメモ。 とりあえずコマンドをたたくと
$ brew install pdftk Error: No available formula with the name "pdftk" ==> Searching for similarly named formulae... Error: No similarly named formulae found. ==> Searching taps... Error: No formulae found in taps. ==> You haven't updated Homebrew in a while. A formula for pdftk might have been added recently. Run `brew update` to get the latest Homebrew updates!
パッケージがないのかと思ったら
$ brew search pdftk No formula found for "pdftk". ==> Searching pull requests... Closed pull requests: pdftk: 2.02 - a Handy Tool for Manipulating PDF Documents (https://github.com/Homebrew/homebrew/pull/25953)
どうやらbrew pullするらしい。 PILOGさんの homebrewでpdftkを入れてコマンドラインでPDF結合 を参考にして
$ brew pull https://github.com/Homebrew/homebrew/pull/25953 ######################################################################## 100.0% ==> Applying patch Applying: pdftk: 2.02 - a Handy Tool for Manipulating PDF Documents ==> Patch closes issue #25953 ==> Patch changed: Library/Formula/pdftk.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) $ brew install pdftk ==> Downloading http://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_server- ==> Downloading from https://www.pdflabs.com/tools/pdftk-the-pdf-toolkit/pdftk_s ######################################################################## 100.0% 🍺 /usr/local/Cellar/pdftk/2.02: 28 files, 61M, built in 13 seconds
無事にインストール終了。
10.12(Sierra)へアップグレードしたMacでhomebrewをセットアップしていたら、gnupgインストール時にこんなメッセージが。
$ brew install gnupg ==> Downloading https://homebrew.bintray.com/bottles/gnupg-1.4.21.el_capitan.bot ######################################################################## 100.0% ==> Pouring gnupg-1.4.21.el_capitan.bottle.1.tar.gz ==> Caveats This formula does not install either `gpg` or `gpgv` executables into the PATH. If you simply require `gpg` and `gpgv` executables without explicitly needing GnuPG 1.x we recommend: brew install gnupg2 If you really need to use these tools without the "1" suffix you can add a "gpgbin" directory to your PATH from your ~/.bash_profile like: PATH="/usr/local/opt/gnupg/libexec/gpgbin:$PATH" Note that doing so may interfere with GPG-using formulae installed via Homebrew. ==> Summary 🍺 /usr/local/Cellar/gnupg/1.4.21: 57 files, 5.4M
今は gnupg 2.xがデフォルトなのですね。 gnupg 1.x系を使っているので、とりあえず PATHに上記を追加した。
MacTeXをHomebrewでインストールするメモ。
まず、MacTeX.pkgは3GB近くもあり、mirror.ctan.org からダウンロードするのはとても時間がかかる。 でも、homebrewでインストールすると、上記URLからダウンロードしようとするので、とりあえず適当なミラーサイトからパッケージをダウンロードしておく。
現バージョンは mactex-20161019.pkg。ダウンロードしたファイルは
~/Library/Caches/Homebrew/Cask/mactex--20161009.pkg
へ保存。mactexと日付の間のハイフンは2個になっていることに注意。 一度
$ brew cask install mactex
を実行すると、上記のディレクトリが作成されると思われる。 brewコマンドを実行してダウンロードが開始されると mactex--20161009.pkg.incomplete というファイルが作成されるので、これは削除しておく。
$ brew cask install mactex ==> Downloading http://mirror.ctan.org/systems/mac/mactex/mactex-20161009.pkg Already downloaded: /Users/hoge/Library/Caches/Homebrew/Cask/mactex--20161009.pkg ==> Verifying checksum for Cask mactex ==> Running installer for mactex; your password may be necessary. ==> Package installers may write to any location; options such as --appdir are i Password: ==> installer: Package name is MacTeX-2016 ==> installer: Installing at base path / ==> installer: The install was successful. 🍺 mactex was successfully installed!
後は
$ sudo tlmgr update --self --all
を実行してインストールを完了させる。 515個もパッケージインストールされるので、途中でMacが寝ないように電源設定しておくことも忘れずに。😉