The zshcompsys man-page says:


If the system was installed completely, it should be enough to call the shell function compinit from your initialization file; see the next section. However, the function compinstall can be run by a user to configure various aspects of the completion system.

zsh can't find the commands though:

genesis% compinit
zsh: command not found: compinit
genesis% compinstall
zsh: command not found: compinstall
genesis% echo $PATH

I'm lead to ask this question because when starting zsh I get:

tmuxinator.zsh:20: command not found: compdef

How do I get zsh to find these completion commands?

2 Answers 2


This is the same issue I got on my mac. I am using zsh shell.

Zsh Compdef error

Compdef is basically a function used by zsh for load the auto-completions. The completion system needs to be activated. If you’re using something like oh-my-zsh then this is already taken care of, otherwise you’ll need to add the following to your ~/.zshrc

autoload -Uz compinit

Completion functions can be registered manually by using the compdef function directly like this compdef . But compinit need to be autoloaded in context before using compdef.

  • 1
    I tried this but got "compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew compinit:503: no such file or directory: /usr/local/share/zsh/site-functions/_brew_cask" Guessing that is because I don't use homebrew so this answer may be a problem for people like me.
    – Jackie
    Jan 4, 2021 at 20:34

Answer to the question as asked

Access these commands by running:

$ autoload -Uz compinstall && compinstall

It will load a guided wizard, I quit as soon as I had the option to Save and exit.

Then reload the shell:

$ exec zsh

More general answer

It appears that the new user configuration was not run.

Run it by:

$ autoload -Uz zsh-newuser-install && zsh-newuser-install -f

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.