LoginSignup
2
2

More than 3 years have passed since last update.

bashからzshへの乗り換え

Last updated at Posted at 2019-12-23

:pencil: このエントリーは、MacOS Catalinaからデフォルトシェルが bash から zsh になったことを期に、bashからzshへ乗り換えるための作業メモ

前提条件

ホームディレクトリで作業

$ pwd
/Users/gentamura

現在利用しているシェルはbash

$ echo $SHELL
/bin/bash

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

移行作業

ログインシェルを入れ替え

$ chsh -s /bin/zsh

一旦ターミナルを閉じて、再起動

利用しているシェルを確認

$ echo $SHELL
/bin/bash

設定ファイルをコピー

$ cp .bash_profile .zsh_profile

設定ファイルを一部書き換え

$ vim .zsh_profile
.zsh_profile
export PATH="$HOME/.anyenv/bin:$PATH"
eval "$(anyenv init -)"

export PATH="$HOME/.cargo/bin:$PATH"
export PATH="/Applications/flutter/bin:$PATH"

export GOPATH="$(go env GOPATH)"
export PATH="$GOPATH/bin:$PATH"

eval "$(starship init bash)" => eval "$(starship init zsh)" に変更

再起動

$ source .zsh_profile

以上です。
今の所無事動いているので、なにかあれば追記します:elephant:


追記
ターミナル再起動したところ、 starship が適用されなかったので、以下を追加

.zshrc
source ~/.zsh_profile
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2