Skip to content

Instantly share code, notes, and snippets.

@fkurz
Last active June 28, 2021 15:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fkurz/88b85734462a736176f515cd297ae82e to your computer and use it in GitHub Desktop.
Save fkurz/88b85734462a736176f515cd297ae82e to your computer and use it in GitHub Desktop.
ZSH Compaudit Insecure Directories Fix

This is more or less a note-to-self.

Note: this doesn't seem to be the simplest solution. See edit from 27th June 2021 below.

If ZSH's compaudit complains about insecure directories on a Mac, removing write permissions will fix the issue (see this SO answer):

chmod g-w ${insecure-directories}

In case this doesn't work (for example if you have permission clashes with tools which use the same directories as ZSH—e.g. Brew), you can also choose to ignore insecure directory warnings by adding the following to the front of ~/.zshrc

autoload -Uz compinit && compinit -i > /dev/null

The -i flag will tell ZSH to ignore insecure directories. Note that since compinit will output utility functions we redirect the output of compinit -i to /dev/null.

Edit (28th June 2021): The simplest solution to deal with the warnings/errors created by zsh is to silence compinit. You can do this by putting

export ZSH_DISABLE_COMPFIX="true"

before compinit is being called. If you use oh-my-zsh, ZSH_DISABLE_COMPFIX has to be set before sourcing oh-my-zsh.sh like so:

export ZSH_DISABLE_COMPFIX="true"
source $ZSH/oh-my-zsh.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment