qrunchに上げていたものの移植その4。
読み直すと結構トリッキーなことをしていると思う。
homebrew に少し詳しくなれたのは覚えているが、最近は Windows しか使ってないので、もはや懐かしい感覚。
# 事の発端
Last login: Mon Jan 28 12:50:37 on ttys000 VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST? ~ [01/28 13:30:57] $
VCS_INFO_detect_p4:79: maximum nested function level reached; increase FUNCNEST?
が出るようになった。これは zsh を brew でアップデートしてから問題が起こるようになった。
原因がわからず調べていたが、最終的にTwitterを調べたら vcs_info
側の問題であることがわかった。
https://twitter.com/songmu/status/1089488439743897600?s=19
(最悪なことに自分の zshrc の79行目で vcs_info
を使っていたために原因の分析が遅れた)
修正が入ってるかの確認
GitHubを確認したら修正があたっているようだった。
https://github.com/zsh-users/zsh/commit/b70919e0d9dadc93893e9d18bc3ef13b88756ecf
なのでMasterブランチを持ってきてインストールできれば… と思い始める。
ちなみに brew reinstall zsh
を試したが、効果はなかった。(詳しく見ていないが、バージョンが打たれているものを引きに行くような動きになっているものと思われる)
Homebrew で HEAD 版を入れる
なんかうまく行ってる風ですが、自己責任で。。。
コマンドはここによくまとまっているのでここから探す。
brew install --HEAD --force zsh
で良さそうなのがわかる。 brew reinstall --HEAD --force zsh
というコマンドはないと言われた。
$ brew reinstall --HEAD --force zsh Usage: brew reinstall [option(s)] formula: Uninstall and then install formula (with existing install options). If HOMEBREW_INSTALL_CLEANUP is set then remove previously installed versions of upgraded formulae as well as the HOMEBREW_CACHE for that formula. -s, --build-from-source Compile the formula> from source even if a bottle is available. --display-times Print install times for each formula at the end of the run. -v, --verbose Make some output more verbose. -d, --debug Display any debugging information. -h, --help Show this message. Error: invalid option: --HEAD [01/30 00:27:16] $ brew install --HEAD --force zsh Updating Homebrew... Error: zsh 5.7 is already installed To install HEAD, first run `brew unlink zsh`
しかし brew unlink zsh
しないと入れられないぞと言われる。これは依存関係的な問題だとは思うので unlink する。(ちなみに結構危険)
$ brew unlink zsh Unlinking /usr/local/Cellar/zsh/5.7... 1473 symlinks removed
改めて brew install --HEAD --force zsh
を実行。
[01/30 00:27:46] $ brew install --HEAD --force zsh ==> Cloning https://git.code.sf.net/p/zsh/code.git Cloning into '/Users/yumechi/Library/Caches/Homebrew/zsh--git'... Checking out files: 100% (1619/1619), done. ==> Checking out branch master Already on 'master' Your branch is up to date with 'origin/master'. ==> Util/preconfig ==> ./configure --prefix=/usr/local/Cellar/zsh/HEAD-4f6ac08 --enable-fndir=/usr/local/Cellar/zsh/HEAD-4f6ac08/share/zsh/ ==> make install.bin install.modules install.fns 🍺 /usr/local/Cellar/zsh/HEAD-4f6ac08: 1,190 files, 6.1MB, built in 7 minutes 8 seconds
時間はかかったもののなんとかインストールできたようだ。
他のターミナルを開いて exec zsh
してみると…?
~ [01/30 00:15:09] $ exec zsh ~ [01/30 00:35:42] $
良さげ。 念の為 brew docter
を最後に実行してリンク関係を見ておきましょう。
反省点
- ログインShellがzshなので、ログインShellは念の為変えたほうが良かったかも(
brew unlink
で自分の環境では zsh が一時的に使えなくなった) - その時の様子を撮っておけばよかった。。。
まとめ
- HomeBrew の使い方が意外とググりにくい
- 古いバージョンを入れる話はあるが、新しいバージョンを入れる話は出てこない
- それだけ頻繁にバージョンアップがあるごとにメンテされているからだとは思うが
- ログイン周り破壊しかねないような対応をしてしまったので、反省点は本当に反省(セーフモードとかから戻すの本当にめんどくさいので)
- HEADバージョン入れられるのをしれたのは良いこと
- Linuxだったら最新版落としてきてビルドするだけ、だったのでパッケージマネージャーに頼っているとこういうときにめんどくさいのかを実感できた