Skip to content

Instantly share code, notes, and snippets.

@v1k0d3n
Last active December 20, 2023 16:40
Show Gist options
  • Save v1k0d3n/3bfe88c71bb5b87f967f6c87faafd949 to your computer and use it in GitHub Desktop.
Save v1k0d3n/3bfe88c71bb5b87f967f6c87faafd949 to your computer and use it in GitHub Desktop.
MacOS Homebrew upgrade/installation compinit issues

You may run into an issue (at some point) where your directories are "insucure" either through a homebrew install or update. If this happens, you can do the following to fix the issue correctly, wihtout setting compinit to ignore errors (which I've seen recommended in some forums).

Example:

Last login: $D $MO $H:$M%S on $TTYS

[WARNING]: Console output during zsh initialization detected.

When using Powerlevel10k with instant prompt, console output during zsh
initialization may indicate issues.

You can:

  - Recommended: Change ~/.zshrc so that it does not perform console I/O
    after the instant prompt preamble. See the link below for details.

    * You will not see this error message again.
    * Zsh will start quickly and prompt will update smoothly.

  - Suppress this warning either by running p10k configure or by manually
    defining the following parameter:

      typeset -g POWERLEVEL9K_INSTANT_PROMPT=quiet

    * You will not see this error message again.
    * Zsh will start quickly but prompt will jump down after initialization.

  - Disable instant prompt either by running p10k configure or by manually
    defining the following parameter:

      typeset -g POWERLEVEL9K_INSTANT_PROMPT=off

    * You will not see this error message again.
    * Zsh will start slowly.

  - Do nothing.

    * You will see this error message every time you start zsh.
    * Zsh will start quickly but prompt will jump down after initialization.

For details, see:
https://github.com/romkatv/powerlevel10k/blob/master/README.md#instant-prompt

-- console output produced during zsh initialization follows --

compinit: initialization aborted
/dev/fd/16:2: command not found: compdef
/Users/$USER/.zshrc:75: command not found: compdef

Runt the following command to run an audit:

❯ compaudit
There are insecure directories:
/opt/homebrew/share/zsh-completions
/opt/homebrew/share

Ah, so we have some insecure directories. This happened after I updated Homebrew (after a MacOS upgrade for example).

Now run the following to repair the issue:

❯ compaudit | xargs chmod g-w
There are insecure directories:

❯ compaudit

And that should fix it for you~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment