Restart bash from terminal without restarting the terminal application (mac)?

exec bash should replace the current shell process with (a new instance of) bash.


The accepted answer is great for a shell that's using bash, which is also what the OP asked, however, I'm using Terminal on macOS with a non-default shell (zsh) and running the command exec bash obviously doesn't have the desired effect: it launches bash instead of my default shell.

So the environment-agnostic command would be exec $SHELL which utilizes the environment variable $SHELL that stores the default shell for the user.

Also, note that Apple replaced bash with zsh in macOS Catalina so to have the effect the OP is looking for running either exec zsh or exec $SHELL is the way to go after updating to macOS 10.15.


According to this article and others your shell doesn't change when you upgrade to Catalina. But any new accounts will be zsh. You can change those to bash if desired. bash will not be part of macOS at some time in the future. Apparently the licensing for zsh is less restrictive.

I came upon this article after getting tired of quitting and restarting iTerm for the same reason as the OP knowing there was a command such as exec zsh.

Tags:

Shell

Bash