【Mac環境のSHELL】The default interactive shell is now zsh.

PC

ミニマリスト_カミ

みなさんこんにちは!
カミ@god48_です。

今回はターミナルで表示されているThe default interactive shell is now zsh.についてです。
特に何もせずにスルーをしてきた方もいるかと思いますが、今回は「The default interactive shell is now zsh.」について細かく説明していきます。

 この記事で分かること

  • The default interactive shell is now zsh.の理解
  • bashまたはzshの切り替え
  • bashのまま使う場合の警告の非表示
icon

それではさっそく、すすめましょう。

The default interactive shell is now zsh.が表示される理由

macOS Catalina からデフォルトシェルが zsh になりました。
Visual Studio Code のターミナルを起動させると以下のメッセージが表示されます。

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
icon

macOSがCatalina以上になると自動で表示がされるようになります。

The default interactive shell is now zsh.とは?

icon

表示される理由はわかったけど何か知りたいです。

それは現在はあなたのMacがzshではなくbash になっているからです。

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
icon

Google翻訳で翻訳すると以下のように、表示されます。

デフォルトのインタラクティブシェルはzshになりました。
zshを使用するようにアカウントを更新するには、 chsh -s / bin/zshを実行してください。
詳細については、https://support.apple.com/kb/HT208050をご覧ください。

スポンサードサーチ

現在使っているshellの確認

shellはコマンドかvscodeのどちらかで確認ができます。

コマンドでshellの確認

現在使っているshellコマンドを叩くと、bashzshのどちらかの結果が返ってきます。

echo $0

以下の結果が返ってきます。

-bash
-zsh

$ echo $SHELL

以下のパスでbashかzshのどちらかが返ってきます。

/bin/bash
/bin/zsh

結果は使用しているshellによってそれぞれ違いますが、コマンドで確認できます。

Macのシステム環境設定から設定変更

システム環境のユーザーとグループの詳細オプションからSHELLを変更することができます。

スポンサードサーチ

使用可能なシェル一覧を取得

使用可能なシェルの一覧を確認するコマンドもあります。

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/dash
/bin/ksh
/bin/sh
/bin/tcsh
/bin/zsh

vscodeで確認

vscodeならコマンドを叩かなくても、一目で確認することができます。

bashからzshへ変更する方法

「chsh -s /bin/zsh」コマンドでbashからzshに変更できます。

$ chsh -s /bin/zsh

スポンサードサーチ

zshからbashへ変更する方法

「chsh -s /bin/bash」コマンドでzshからbashに変更できます。

$ chsh -s /bin/bash

Display all 1660 possibilities? (y or n)

Y-MacBook-Pro:~username$ `
Display all 1660 possibilities? (y or n)

ターミナルで使用できる全コマンドを表示することができます。

`!                              `db_stat                        `http-server                    `moo-outdated                   `postlock                       `system_profiler
`.                              `db_upgrade                     `httpclient                     `moo-outdated5.18               `postlog                        `systemextensionsctl
`2to3                           `db_verify                      `httpd                          `moose-outdated                 `postmap                        `systemkeychain
`2to3-3.9                       `dbicadmin                      `httpd-wrapper                  `moose-outdated5.18             `postmulti                      `systemsetup
`:                              `dbicadmin5.18                  `httxt2dbm                      `moose-outdated5.30             `postqueue                      `systemsoundserverd
`AssetCacheLocatorUtil          `dbicadmin5.30                  `ibd2sdi                        `more                           `postsuper                      `systemstats
`AssetCacheManagerUtil          `dbilogstrip                    `ibtool                         `mount                          `power_report.sh                `tab2space
`AssetCacheTetheratorUtil       `dbilogstrip5.18                `iconutil                       `mount_9p                       `powermetrics                   `tabs
`BTLEServer                     `dbilogstrip5.30                `iconv                          `mount_acfs                     `pp                             `tail
`BTLEServerAgent                `dbiprof                        `ictool                         `mount_afp                      `pp5.30                         `tailspin
`BlueTool                       `dbiprof5.18                    `id                             `mount_apfs                     `ppdc                           `talk
`BootCacheControl               `dbiprof5.30                    `idle3                          `mount_cd9660                   `ppdhtml                        `tar
`DeRez                          `dbiproxy                       `idle3.9                        `mount_cddafs                   `ppdi                           `taskinfo
`DevToolsSecurity               `dbiproxy5.18                   `idlj                           `mount_devfs                    `ppdmerge                       `taskpolicy
`DirectoryService               `dbiproxy5.30                   `idn2                           `mount_exfat                    `ppdpo                          `tbl
`GetFileInfo                    `dbmmanage                      `if                             `mount_fdesc                    `ppm2tiff                       `tbtdiagnose
--More--

詳しくはこちらを参考にしてください。

bashのまま使いたい方

以下のコマンドを打つとbashでも警告メッセージが表示されなくなります。

bash_profile

 bash_profileまたはprofileに書き込みする場合

export BASH_SILENCE_DEPRECATION_WARNING=1

 .bash_profile に書き込みする場合

$ echo “export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile

ますは現在の.bashrcと.bash_profileの中を確認します。

cat ~/.bashrc
cat ~/.bash_profile

以下のように表示がされます。

export PATH=$PATH:/Applications/MAMP/bin/php/php7.3.1/bin:PATH
export PATH=/usr/local/opt/php@7.3.1/bin:$PATH
export PATH="/usr/local/Cellar/git/2.32.0_1/bin:$PATH"
export PATH=/Applications/MAMP/bin/php/php7.3.1/bin:$PATH
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH’ >> ~/.bash_profile
export PATH=$HOME/.nodebrew/current/bin:$PATH
以下省略

以下のコマンドを打って、bashrcと.bash_profileの中をもう一度確認します。

export BASH_SILENCE_DEPRECATION_WARNING=1
入力した結果を反映させる
$ echo "export BASH_SILENCE_DEPRECATION_WARNING=1" >> ~/.bash_profile

再度、コマンドを入力して確認する
export PATH=$PATH:/Applications/MAMP/bin/php/php7.3.1/bin:PATH
export PATH=/usr/local/opt/php@7.3.1/bin:$PATH
export PATH="/usr/local/Cellar/git/2.32.0_1/bin:$PATH"
export PATH=/Applications/MAMP/bin/php/php7.3.1/bin:$PATH
echo 'export PATH=$HOME/.nodebrew/current/bin:$PATH' >> ~/.bash_profile
export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
export PATH=$HOME/.nodebrew/current/bin:$PATH
export BASH_SILENCE_DEPRECATION_WARNING=1
export PATH=$HOME/.nodebrew/current/bin:$PATH
※以下省略

問題なく表示されなくなればokですね

プログラミングを始めたい方や、独学で進めてなかなか進まないなど、プログラミングは悩みが付き物です。
正直、プログラミングは実務的に行わないと成長はしません。
もし、プログラミングをまだ始めていない方や、今後の報告で悩んでいる方は無料相談を行っているので、是非一度お問合せください。
悩んでもしょうがないので、無料相談後に選択肢を増やしたり、今後の方向性を定めることをおすすめします。

PC

Posted by kami