70

I get the following error messages when I open my terminal, Hyper:

[oh-my-zsh] Insecure completion-dependent directories detected:
drwxrwxr-x  7 dwaynethe2nd  admin  224 Apr 25 15:00 /usr/local/share/zsh
drwxrwxr-x  4 dwaynethe2nd  admin  128 Apr 25 14:53 /usr/local/share/zsh/site-functions
runar
  • 2,667
  • 2
  • 15
  • 23
MetalFingers
  • 715
  • 1
  • 5
  • 7

8 Answers8

149

This is an issue with ZSH, your shell, not Hyper, your terminal. I actually had the same issue earlier today. There are some solutions in this issue on Github, and I will quote some of them here but I recommend you follow the link and read the comments there.

The first solution is to change the ownership of the problematic directories.

I will not recommend this without knowing more about your environment, but for most people this will fix the issue:

chmod 755 /usr/local/share/zsh
chmod 755 /usr/local/share/zsh/site-functions

The second solution is to set ZSH_DISABLE_COMPFIX=true (or "true" in quotes) in your .zshrc file, to tell ZSH to not check for insecure directories.

The third solution, and the solution that fixed the issue for me, is to initialise compinit with the -u flag. This will use all the directories found by compaudit without checking them for security issues. To do this, you will have to change your .zshrc file or wherever you are configuring autocomplete.

runar
  • 2,667
  • 2
  • 15
  • 23
  • 3
    I used the command the error message recommended to remove the write permissions for group and others. I think it's just asking to lock it down more, but it's not a clear error message. `compaudit | xargs chmod g-w,o-w` – Paul Solt Aug 16 '20 at 16:57
  • @SalahAdDin: Have you tried all three solutions? Do you see any error messages or any other information you would like to share? For the record, it worked for me and I'm using macOS Catalina myself. – runar Oct 22 '20 at 12:00
  • I disabled that `zsh` feature. – SalahAdDin Oct 22 '20 at 14:42
  • Hey I know this is an old-ish post but after running the `chmod 755...`, ZSH takes an absolute age to load up after opening the terminal...any idea what this might be? – Mick McCarthy Apr 05 '21 at 13:18
  • 4
    Hi guys, I have two accounts in the macOS. So, we shouldn't use the first solution. And the second solution does not make sense we all know. The third solution, I always get the permission issue with my standard user(the folder own of admin account) – Aisuko May 05 '21 at 09:37
  • 1
    Hi, this might be coming late but can someone explain what this warning error exactly means? OMZ seems to have added the above solutions as reference for fixing this error but I want to understand what exactly am I solving here. Thanks! – Ashish Gupta Jun 13 '21 at 08:14
  • @AshishGupta It means you do not have the appropriate file permissions for these directories. Another solution is ```chown $USER /usr/local/share/zsh```. – Tom Kelly Oct 21 '21 at 04:22
15

On my mac, what helped was running brew doctor

The program told me the exact commands to run!

azizbro
  • 3,069
  • 4
  • 22
  • 36
4

What solved it for me (on OSX) was to change the ownership on all the directories that are called out after you see [Insecure completion-dependent directories detected:].

Important: You have to change permissions on the target files if they are symlinked. For me the complete list was:

sudo chown -R $(whoami) /usr/local/share/zsh 
sudo chown -R $(whoami) /usr/local/share/zsh/site-functions
sudo chown -R $(whoami) /usr/local/Homebrew/completions/zsh/_brew
sudo chown -R $(whoami) /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/completions/zsh/_brew_services
sudo chown -R $(whoami) /usr/local/Cellar/gh/2.4.0/share/zsh/site-functions/_gh
sudo chown -R $(whoami) /usr/local/Cellar/tldr/1.4.2/share/zsh/site-functions/_tldr
2

In my case following works.

sudo chown -R $(whoami) /usr/local/share/zsh 
sudo chown -R $(whoami) /usr/local/share/zsh/site-functions
sudo chown -R $(whoami) /usr/local/Homebrew/completions/zsh/_brew
sudo chown -R $(whoami) /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/completions/zsh/_brew_services
4b0
  • 21,981
  • 30
  • 95
  • 142
1

To fix this, I used the ZSH_DISABLE_COMPFIX option. The key to using this one is that it has to be placed before/above the “source $ZSH/oh-my-zsh.sh” line:

# ZSH_CUSTOM=/path/to/new-custom-folder

# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)

#Fix errors
ZSH_DISABLE_COMPFIX="true"

source $ZSH/oh-my-zsh.sh

# User configuration
ArNo
  • 2,278
  • 1
  • 22
  • 19
0

Reinstalling brew solved this problem for me.

Uninstall brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"

Install brew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Tapas Pal
  • 7,073
  • 8
  • 39
  • 86
  • Just so as not to confuse anyone: if you've never installed or heard of Homebrew, this solution and the one just above are not your problem. – Raydot Feb 01 '22 at 20:23
0

Executing two commands solved my issue.

  1. sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions
  2. chmod u+w /usr/local/share/zsh/usr/local/share/zsh/site-functions
Dharman
  • 30,962
  • 25
  • 85
  • 135
chety
  • 136
  • 4
0

For me, the site-functions were symlinked to Homebrew directories.

/usr/local/share/zsh/site-functions/_brew -> ../../../Homebrew/completions/zsh/_brew

So the only thing that would work is to issue the command against those directories directly.

sudo chown -R $USER /opt/homebrew/completions/zsh/_brew 

Or for cellars

sudo chown -R $USER /opt/homebrew/Cellar/ripgrep/13.0.0/share/zsh/site-functions/_rg

I'm not sure whether this will pop up again when running brew update.

What Would Be Cool
  • 6,204
  • 5
  • 45
  • 42