How to fix zsh errors after installing Workbrew
Petros Amoiridis
After installing Workbrew, zsh users may see warnings or errors related to completions and function loading. There are two variants of this issue depending on your setup.
"Insecure directories" prompt
If you see this warning when opening a new shell:
zsh compinit: insecure directories and files, run compaudit for list.
Ignore insecure directories and files and continue [y] or abort compinit [n]?
Add the following to your ~/.zprofile:
autoload -U compinit && compinit -u
On Ubuntu, you may also need to add:
skip_global_compinit=1
If you have nvm installed, make sure autoload -U compinit && compinit -u runs before nvm initializes completions.
Still seeing the prompt after editing ~/.zprofile?
~/.zprofile only runs for login shells. Code editor terminals (VS Code, Cursor, JetBrains IDEs) typically spawn non-login interactive shells, which source ~/.zshrc but skip ~/.zprofile entirely. To confirm, run this in the terminal where you see the prompt:
[[ -o login ]] && echo "login" || echo "not login"
If it prints not login, add the same line to ~/.zshrc:
autoload -U compinit && compinit -u
Place it after eval "$(/opt/workbrew/bin/brew shellenv)". If ~/.zshrc already calls compinit (without -u), replace that call rather than adding a second one. The last invocation wins, and any compinit call without -u will re-trigger the prompt.
The same applies if a zsh framework or plugin manager in ~/.zshrc runs its own compinit. For framework-specific fixes, see the next section.
"Function definition file not found" errors
If you use a zsh framework (such as Oh My Zsh, Prezto, or Antidote with completion plugins) and see errors like:
compinit:480: compdump: function definition file not found
is-at-least: function definition file not found
add-zsh-hook: function definition file not found
url-quote-magic: function definition file not found
The fix depends on your framework. The compinit -u fix from the previous section does not resolve these errors.
Oh My Zsh
Add the following to ~/.zshrc before Oh My Zsh is loaded (before the source $ZSH/oh-my-zsh.sh line):
export ZSH_DISABLE_COMPFIX=true
Prezto
Add the following to ~/.zpreztorc:
zstyle ':prezto:module:completion' unsafe true
Other frameworks
Check your framework's documentation for an option to skip the compaudit security check on fpath directories. The setting is typically called something like "unsafe completions" or "disable compfix".
Switching to the system zsh
As an alternative, you can switch to the macOS system zsh at /bin/zsh. You would still need the compinit -u fix from the first section for Homebrew completion files.
To change your login shell:
chsh -s /bin/zsh
If you use VS Code or Cursor, you can also set the terminal shell explicitly in settings (JSON):
"terminal.integrated.defaultProfile.osx": "zsh",
"terminal.integrated.profiles.osx": {
"zsh": {
"path": "/bin/zsh"
}
}