Webinar: Navigating PAM: Privileged Access Management for macOS
Register to attend
Guide

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.

"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"
  }
}