はじめに
- macbookで別アカウントのアドミンユーザを作成したところ、元のアドミンユーザにて以下のエラーが警告文が発生してしまった。
zsh compinit: insecure directories, run compaudit for list.
$ compaudit
There are insecure directories:
/usr/local/share/zsh/site-functions
/usr/local/share/zsh
- このメッセージは新規ターミナルを開いた際に毎回出てきてしまい、なんとか消したい気持ちだった。
やったこと
- こちらの記事を参考に実行してみましたが、変わらず。
- brew doctorを試してみた。
$ brew doctor
Warning: The following directories are not writable by your user:
/usr/local/share/aclocal
/usr/local/share/doc
/usr/local/share/info
/usr/local/share/locale
/usr/local/share/man
/usr/local/share/man/man1
/usr/local/share/man/man3
/usr/local/share/man/man5
/usr/local/share/man/man7
/usr/local/share/man/man8
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var/homebrew/linked
/usr/local/var/homebrew/locks
You should change the ownership of these directories to your user.
sudo chown -R $(whoami) /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/info /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/share/man/man8 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/linked /usr/local/var/homebrew/locks
And make sure that your user has write permission.
chmod u+w /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/info /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/share/man/man8 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/linked /usr/local/var/homebrew/locks
解決方法
- 上記の
$brew doctor
でも分かる通り、/usr/local/share/zsh /usr/local/share/zsh/site-functions
の権限が新規ユーザに移ってしまったと考えられるので、オーナーとパーミッションを変更する。
$ sudo chown -R $(whoami) /usr/local/share/zsh /usr/local/share/zsh/site-functions
$ chmod u+w /usr/local/share/zsh /usr/local/share/zsh/site-functions
- これで無事に解決しました。