- 追加された行はこの色です。
- 削除された行はこの色です。
#author("2022-04-18T06:23:20+00:00","default:src128","src128")
&tag(Homebrew);
*目次 [#s19aafa7]
#contents
*参考情報 [#sfe8c920]
-[[Homebrewのよく使うコマンドまとめ | The Note of Ssaito's:http://ssaito.org/2012/07/homebrew-command-frequently-used/]]
-使用可能なmacOSは基本的に現行版含め最新3世代からサポートしないらしい。
*関連ページ [#x5b01c30]
-[[./emacs]]
-[[./anyenv]]
-
-[[./mysql]]
-[[./httpd]]
-[[./httpd24]]
-[[./php56]]
**その他 [#iab7cc55]
-[[Homebrew-cask]]
-[[./ClamXav]]
-[[rbenv]]
-[[./httpd22]]
-[[./nginx]]
-[[./php54]]
-[[./php53]]
-[[./git]]
-[[./subversion]]
-[[./tomcat6]]
-[[./Mecab]]
-[[./smartmontools]]
-[[./nokogiri]]
-[[./Node.js]]
-[[./tap用リポジトリの作成]]
*インストール [#aeb05696]
-[[Homebrew ― MacPorts driving you to drink? Try Homebrew!:http://mxcl.github.com/homebrew/]]に書いてある。
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
**デフォルトフォルダにインストール [#hc3e327a]
-[[Homebrew ― The missing package manager for OS X:http://brew.sh/]]に書いてある。
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-インストール後以下のコマンドを実行。
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> /Users/sora/.zprofile
eval $(/opt/homebrew/bin/brew shellenv)
**別のフォルダにインストール [#wca922f2]
-「/usr/local」以外でインストールする。例えば/opt/brewとか/brewとか。
- [[homebrew/Installation.md at master · Homebrew/homebrew · GitHub:https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Installation.md#installation]]に書いてある。
- まずフォルダを作成しパーミッションを変更。
#pre{{
sudo mkdir /opt/brew
sudo chown sora:staff /opt/brew
curl -L https://github.com/Homebrew/homebrew/tarball/master | tar xz --strip 1 -C /opt/brew
}}
-あとは/opt/brew/binにパスを通しておく。
*Homebrew自体のアインインストール [#y7215fe6]
公式の方法は以下のコマンドを実行する
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
以下のリンクからたどれるuninstall scriptは動作しなくなっていた(2018/11/11(日)現在)
- [[Uninstall Homebrew - updated -- with Sudo · GitHub:https://gist.github.com/damien1/3452855]]
*操作 [#o82c129a]
-[[Macのパッケージ管理をMacPortsからhomebrewへ - よんちゅBlog:http://yonchu.hatenablog.com/entry/20110226/1298723822]]
**更新関連 [#bf0970b7]
***Homebrew自体の更新 [#f3420d32]
-updateコマンドはFormulaリストを更新する
brew update
***パッケージのアップグレード [#q5af0226]
-upgradeで全パッケージをアップグレードできる(?)
brew upgrade
-古いバージョンの削除は
brew cleanup
*** 全パッケージを再インストール [#jf7955a3]
-OSのアップグレード時など、インストール済みのパッケージを再度全部コンパイルしてインストールし直したい場合
--[[How to Recompile/Reinstall Homebrew Packages | No Replied:http://www.noreplied.com/how-to-recompilereinstall-homebrew-packages/]]
--[[How reinstall all recipies after upgrde to maverick?:http://librelist.com/browser//homebrew/2013/10/30/how-reinstall-all-recipies-after-upgrde-to-maverick/#70aba8f1e0e13021194607a2070a98ff]]
#pre{{
brew list > ~/brewlist
brew uninstall $(cat ~/brewlist)
brew install $(cat ~/brewlist)
}}
**パッケージを探す [#ubc55fae]
-すべてのパッケージを表示。
brew search
-XXXマッチするパッケージを表示
brew search XXX
**パッケージの一覧表示 [#z0137bc7]
-インストール済みのパッケージ一覧
brew list
-バージョン番号つきの一覧
brew list --versions
**パッケージをインストール [#a39454c1]
-installコマンドを使う
brew install XXX
-特定バージョンをインストールする場合、brew versionsでバージョン確認後、Fomulaディレクトリでcheckoutし、インストールする。
**パッケージをアンインストール [#s9619e61]
-uninstallコマンドを使う
brew uninstall XXX
**パッケージのバージョンを表示 [#m8535431]
-versionsコマンドを使う。
brew versions
**パッケージのインストールオプションを表示 [#hf307e57]
-infoコマンドを使う
brew info emacs
-もしくはoptions
brew options emacs
**インストールログを確認 [#u66b0e22]
-~/Library/Logs/Homebrew以下にログが出力される。
**サービスに関して [#jc03d08a]
-[[brew servicesを使ってHomebrewでインストールしたMySQLを自動起動する - cockscomblog?:http://cockscomb.hatenablog.com/entry/2014/04/05/153451]]
*トラブルシューティング [#s024565d]
**brew doctorのエラーを解決 [#h19de11b]
*** Warning: Some installed formula are missing dependencies [#md6f4b02]
-以下のようなメッセージが表示される
#pre{{
Warning: Some installed formula are missing dependencies.
You should `brew install` the missing dependencies:
brew install openssl@1.1
}}
-とりあえず支持されたとおり「 brew install openssl@1.1」を実行。
***Warning: You have unlinked kegs in your Cellar [#i13d7f56]
-以下のようなメッセージが表示される。
#pre{{
Warning: You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
mysql55
}}
-これも指示通り「brew link mysql55」する。/usr/local/binの下にmysql関連のシンボリックリングがどばっとつくられるのだが…
**brew tapしようとしたらgithubのパスワードを聞かれた。 [#k8b42926]
-たいていリポジトリのスペルを間違えている。正しいかちゃんと確認しよう「homebrew/dupes」とか。
**brew tapしたら"Already tapped"といわれた [#i0f6c505]
-何か壊れている? "--repair"で修復できるらしい。
brew tap --repair homebrew/versions
** brew updateで「error: Your local changes to the following files would be overwritten by merge」 [#q506707a]
-何かのFormulaをいじってしまったのが原因。変更を保存しなくてもいいならば次のコマンドで修復できる。https://github.com/Homebrew/homebrew/issues/2906#issuecomment-1740037
#pre{{
cd /usr/local
git fetch origin
git reset --hard origin/master
}}
**コンパイルエラーが発生したのでデバッグしたい [#e1b0b12c]
-brew installを実行すると/tmpの下にソースコードが展開されてビルドされる。
-しかしエラーで失敗すると全て削除されてしまうのでそのままではデバッグできない。
-[[debugging a formula and fixing compile errors?:http://librelist.com/browser//homebrew/2013/3/2/debugging-a-formula-and-fixing-compile-errors/#7b89ff9243164d375b65516b9572e1ab]]によると、"unpack"が使えるらしい。"-p"オプションでパッチの適用。"-g"オプションでgitリポジトリの作成
brew unpack foo -p
-またはinstallにdebugオプションをつける
brew install --debug foo
*FAQ [#u111662c]
**結局パッケージをアップグレードしたい場合どうすれば? [#g4d4f1b4]
-以下のコマンドで良いと思われる。brew updateでbrewの更新とformulaファイルの一覧が最新に更新され、brew upgrade
outdateなパッケージが全て最新版になり更新される。
#pre{{
brew update
brew upgrade
}}
**macOSアップグレード後にHomebrewはどうする? [#c379ae19]
-[[macos - How should I fix my Homebrew installation after upgrading OS X? - Ask Different:http://apple.stackexchange.com/questions/85480/how-should-i-fix-my-homebrew-installation-after-upgrading-os-x]]や、[[macos - How can I update everything installed through Homebrew after OSX upgrade? - Ask Different:http://apple.stackexchange.com/questions/56419/how-can-i-update-everything-installed-through-homebrew-after-osx-upgrade]]によると、基本的にOSアップグレードもそのままで問題なし。以下のコマンドを実行し、問題がでたものだけuninstall=>installしなおせば良い。
#pre{{
brew update
brew upgrade
}}
-必要ないかもしれないが全てのパッケージを再ビルドする方法。[[macos - How do I reinstall all packages installed with Homebrew? - Super User:https://superuser.com/questions/1137780/how-do-i-reinstall-all-packages-installed-with-homebrew]]
**keg-onlyパッケージってなに? [#i03e6bd4]
-デフォルトのOS Xコマンドと重複しているので、/usr/local以下の適切な場所にsymlinkが貼られないパッケージらしい。このリンクを無理矢理作る場合、以下のコマンドを使う。
brew link aaa --force
**ファイルが所属するパッケージを探すには? [#l1360f1c]
-[[macos - How to determine which brew package provides a given file? - Super User:http://superuser.com/questions/781693/how-to-determine-which-brew-package-provides-a-given-file]]によると存在しない?
**outdatedなパッケージを削除するには? [#m46f03d3]
-[[macos - How do I reinstall all packages installed with Homebrew? - Super User:https://superuser.com/questions/1137780/how-do-i-reinstall-all-packages-installed-with-homebrew]]によると以下のコマンドを使用する。
brew cleanup
*疑問点 [#c2f33361]
-apache2をport80で稼働させるスマートな方法は?
-keg-onlyなopensslライブラリを使いたい場合 link -force するとrubyインストール時に使えるが、brew doctorでエラーが表示される。どうやって解決するのか。