Once in a while, you will come across an error like “corrupt history file” when using the ZSH shell after doing something like a hard shutdown of your computer. This error can easily be fixed by re-writing the history file. In this article, the history file is named .zsh_history which is always the case but if the error shows a different file name, substitute that in.