Restart zsh
Zsh reads .zshrc
when it starts. You don't need to log out and log back in. Just closing the terminal and opening a new one gives you your new .zshrc
in this new terminal. But you can make this more direct. Just tell zsh to relaunch itself:
exec zsh
If you run this at a zsh prompt, this replaces the current instance of zsh by a new one, running in the same terminal. The new instance has the same environment variables as the previous one, but has fresh shell (non-exported) variables, and it starts a new history (so it'll mix in commands from other terminals in typical configurations). Any background jobs are disowned.
Reread .zshrc
You can also tell zsh to re-read .zshrc
. This has the advantage of preserving the shell history, shell variables, and knowledge of background jobs. But depending on what you put in your .zshrc
, this may or may not work. Re-reading .zshrc
runs commands which may not work, or not work well, if you run them twice.
. ~/.zshrc
There are just too many things you can do to enumerate everything that's ok and not ok to put in .zshrc
if you want to be able to run it twice. Here are just some common issues: