久しぶりですね。
開発環境を便利にしたいと思いbash→zshをやってみました。
基本的には、初心者向け:Zshの導入を見ながらやればスムーズに出来ました。
まとめるとこんな感じ。
(Homebrewは入っている前提で話を進めます。)
インストール〜起動
Homebrewでzshをインストール
$ brew install zsh
/etc/shellsに下記を追加
/etc/shells
/usr/local/bin/zsh
ログインシェルを変更
$ chsh -s /usr/local/bin/zsh
環境設定
oh-my-zshをインストール
$ sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
oh-my-zshのプラグインをインストール
- シンタックスハイライト: zsh-syntax-highlightingをgit clone
$ git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting
- コマンド補完: zsh-completions をgit clone
$ git clone https://github.com/zsh-users/zsh-completions ~/.oh-my-zsh/custom/plugins/zsh-completions
~/.zshrc
#10行目ぐらいにあるものを変更
#テーマはhttps://github.com/robbyrussell/oh-my-zsh/wiki/themesからお好きなものをお選びください
ZSH_THEME="candy"
#pluginsにzsh-syntax-highlighting、zsh-completionsを追加(54行目ぐらい)
plugins=(
git
zsh-syntax-highlighting
zsh-completions
)
# zsh-completionsのリロード設定を適当な位置に追加
autoload -U compinit && compinit -u
これで
$ source ~/.zshrc
すると基本的には環境設定は完了です。
bash_profileをzprofileに変更
絶対変なところあるだろうなと思いながら色々触ってると、pyenvがうまく動いていないことが判明。
bash_profileは読み込んでもらえなくなるみたいですね。
% cat .bash_profile >> .zprofile
として、zprofileに同じ内容を追記しておきましょう。
これで基本的にはうまくいくはず。
また何か問題が出てきたら追記します。