Why?
なんかよさげだったから(コナミカン
バージョンが上だし
アップデートもしやすそうだし
みんなそれでやってるっぽいから(結論)
実際にやってみる
とりあえずbrew info zshしてみる
$ brew info zsh
zsh: stable 5.0.5 (bottled)
http://www.zsh.org/
Not installed
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/zsh.rb
==> Dependencies
Required: gdbm ✔, pcre ✔
==> Options
--disable-etcdir
Disable the reading of Zsh rc files in /etc
==> Caveats
Add the following to your zshrc to access the online help:
unalias run-help
autoload run-help
HELPDIR=/usr/local/share/zsh/helpfilesなるほど。デフォルトのzshが5.0.2だったから5.0.5でちょっと新しくなっている。
それから--disable-etcdirでデフォルトの設定を無効にできるらしい。思ったよりも簡単に出来そうだ。
#いざインストール!!
$ brew install --disable-etcdir zsh
==> Downloading https://downloads.sourceforge.net/project/zsh/zsh/5.0.5/zsh-5.0.5.tar.bz2
Already downloaded: /Library/Caches/Homebrew/zsh-5.0.5.tar.bz2
==> ./configure --prefix=/usr/local/Cellar/zsh/5.0.5 --enable-fndir=/usr/local/Cellar/zsh/5.0.5/share/zsh/functions --enable-scriptdir=/usr/local/Cellar/zsh/5.0.5/share/zsh/scripts
==> make install
==> make install.info
==> Caveats
Add the following to your zshrc to access the online help:
unalias run-help
autoload run-help
HELPDIR=/usr/local/share/zsh/helpfiles
==> Summary
🍺 /usr/local/Cellar/zsh/5.0.5: 1070 files, 10M, built in 92 secondsよしきた(一回試しにやったのがバレたかな)
次に、デフォルトのシェルのパスを変更する。
なんでもいいけどsudo vi /etc/shellsみたいな感じで/etc/shellsに/usr/local/bin/zshを追記する
*ロックがかかっているのでsudoで
試しにターミナルに再起動をかけると、、
This is the Z Shell configuration function for new users,
zsh-newuser-install.
You are seeing this message because you have no zsh startup files
(the files .zshenv, .zprofile, .zshrc, .zlogin in the directory
~). This function can help you with a few settings that should
make your use of the shell easier.
You can:
(q) Quit and do nothing. The function will be run again next time.
(0) Exit, creating the file ~/.zshrc containing just a comment.
That will prevent this function being run again.
(1) Continue to the main menu.
--- Type one of the keys in parentheses --- 設定ファイルがないよーという旨のメッセージが出てくる。
実際にはあるんだけど読み込まれなくなっている。これはbrew installするときにつけた--disable-etcdirというオプションが効いている証拠ですね。(/etc/zshenvで$ZDOTDIRを設定していたのが読み込まれなくなっている)
なので元々あった設定を引き継ぎます
$ sudo mv /etc/zshenv ~/.zshenv
これで元々の設定で動くようになりました。
意外と楽に移行できたかも?