I have multiple files of `.zcompdump` , why do I have multiple files of these?

Viewed 14180

I have multiple files of .zcomdump.

.rw-r--r--   47k myuser 13 Jul 10:02  .zcompdump
.rw-r--r--   47k myuser 14 Jul 16:52  .zcompdump-MacBook Pro (2)-5.7.1
.rw-r--r--   47k myuser  4 Jun  9:32  .zcompdump-MacBook Pro-5.7.1
.rw-r--r--   36k myuser  3 Jul 11:07  .zcompdump.macbook-pro-2.lan.54221

Which one of them do zsh actually use? Can i clear out some of them or?

2 Answers

Because the compinit mechanism of zsh creates the filename depending on some environment variable, here $HOST.

It's safe to delete them, but they will be recreated unless you add -D to compinit line in your zsh config

https://github.com/wurmlab/oswitch/issues/41

They are used to speed up the completion mechanism.
You can delete them and let it recreate the one you need.

I added this line to the ~/.zshrc above the source $ZSH/oh-my-zsh.sh line:

export ZSH_COMPDUMP=$ZSH/cache/.zcompdump-$HOST

Then, when we source $ZSH/oh-my-zsh.sh, the compinit command dumps to that new location.

Here's where compinit is in oh-my-zsh.sh.

Related