I understand .zcompdump-* files are dumped configuration files that can speed up completion and that can be deleted safely. I would like to store them in a separate location since they clutter my home directory. What's a good way of doing so?

I know one option is to use the ZDOTDIR variable but that would force me to place all my zsh dot files in that location. I just want to store the .zcompdump files elsewhere.


In your .zshrc, change the invocation of compinit to add a -d option with the location of the file. For example:

compinit -d ~/.cache/zsh/zcompdump-$ZSH_VERSION
|improve this answer|||||
  • Thanks @Gilles. I assume I can still invoke this after loading oh-my-zsh ? – Amelio Vazquez-Reina Sep 11 '17 at 19:12
  • 1
    @AmelioVazquez-Reina No, you have to change the place where compinit is invoked. If you invoke it twice, it'll create the file each time, with the name supplied on that invocation or as ~/.zcompdump if you don't pass -d. If you want your configuration rather than Robby Russell's, don't use oh-my-zsh. – Gilles 'SO- stop being evil' Sep 11 '17 at 19:32
  • Note that the file won't be created if you don't have the ~/.cache/zsh/ directory – VasyaNovikov Dec 10 '17 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.