zshellを導入したときのメモ

ログインシェルをbashから、zshellに変更した。

brewzshをインストール。

$ brew install zsh
... 🍺 ...

$ which zsh
/usr/local/bin/zsh

システムで有効なログインシェルの一覧を、/etc/shellsで見ることができる。
ログインシェルとは、ユーザーがシェルにログインしたときに、最初に起動するシェルのこと。
Mac OS Xだと、bash以外に csh ksh sh tcsh zsh が入っている。

$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

システムにプリインストールされていたzshと、brewでインストールしたzshのバージョンを比較する。
brewからインストールしたzshの方が新しい。

$ /bin/zsh --version
zsh 5.0.5 (x86_64-apple-darwin14.0)

$ /usr/local/bin/zsh --version
zsh 5.2 (x86_64-apple-darwin14.5.0)

/etc/shellsに、/usr/local/bin/zshを追記する。

$ sudo bash -c 'echo /usr/local/bin/zsh >> /etc/shells'
Password:

catで追加されたことを確認し、change shellコマンドのchshを実行する。

$ cat /etc/shells
# List of acceptable shells for chpass(1).
# Ftpd will not allow users to connect who are not using
# one of these shells.

/bin/bash
/bin/csh
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh
/usr/local/bin/zsh

$ chsh -s /usr/local/bin/zsh
Password for Bambi:


設定は、~/.zshrcに書く。なければ作成する。
~/.bashrcと~/.bash_profileから、エイリアス環境変数を移せば、完了です〜 😋