Bash – Restart bash from terminal without restarting the terminal application (mac)

bashshell

I've looked around and bit for an answer to this question but I don't seem to find it (which is weird).

My question is, is there any simple way to restart the bash session from within the terminal on mac. I just want the same behaviour as if I closed the terminal application and started it again (all variables reset, .bash_profile sourced etc).

I know how to source .bash_profile, but that's not what I want. One of the reasons I want to do this is because a plugin for my bash prompt has code that prevents colors from being loaded multiple times. Therefore, sourcing .bash_profile doesn't reload the color variables and I have to restart the terminal application to get changes in effect.

Best Answer

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