bun
bun copied to clipboard
ZSH "Insecure Directories" Error After Running Install Script on MacOS
From this discord message.
After downloading Bun via the install script on macOS, upon opening a new terminal, the following message is output:
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]?
The simple fix is to comment out the line after # bun completions in ~/.zshrc, but I think fixing this would make downloading bun "just work" better out of the box. I'll look into this further to see if I can figure out the root cause of the issue.
Edit: The problem is specifically to do with the source "/Users/NAME/.bun/_bun" command which is added to the zshrc on install. When executed, it prints the error message above.
The issue happens because /usr/local/share/zsh is an "insecure directory" (according to compaudit.)
To fix the issue you need to run:
sudo chmod g-w /usr/local/share/zsh/site-functions
sudo chmod g-w /usr/local/share/zsh
Since this requires sudo I assume this isn't something you want to have added to the install script.
Might be worth adding this info to the Troubleshooting section of the README, I can PR it if necessary.
Waiting for the Bun development team can resolve this problem radically.
I am try to use this solution but didn't work. @UltimatePro-Grammer
@Penggeor Show me the compaudit after running those commands - if you still can’t figure it out you can always get rid of the lines after # bun completions in the .zshrc
The post and its comments on this stack overflow answer may help.
Hi @UltimatePro-Grammer, thanks for filing this issue and sorry about the install trouble. Is this still happening when you install using the curl script?
@Electroid Yes, I am still able to reproduce this issue. Also, the code causing the problem has not been modified. It seems to be a problem fundamental to ZSH experienced by lots of projects, so a troubleshooting note might be best.
I've used the above method, but the installation still reports an error
@king-open What is the output of compaudit after you have run the solution above? It would also be useful if you could provide the output of ls -lh /usr/local/share/zsh
@NateLevin1 i ran that command for all of these directories and the error still occurs. here's the output of compaudit. it doesn't seem to remove them from this list:
% compaudit
There are insecure directories and files:
/usr/local/share/zsh/site-functions
/usr/local/share/zsh
/usr/local/share/zsh/site-functions/_brew
/usr/local/share/zsh/site-functions/_brew_services
/usr/local/share/zsh/site-functions/_carthage
/usr/local/share/zsh/site-functions/_git
It would also be useful if you could provide the output of
ls -lh /usr/local/share/zsh
total 0
drwxr-xr-x 7 not-me admin 224B Sep 8 11:38 site-functions
neither the not-me or admin accounts are my user, so maybe that's the issue?
@DetachHead You might have some luck trying one of the solutions from this thread: https://github.com/zsh-users/zsh-completions/issues/680#issuecomment-612960481 . It could be that the user differs as well.
I'm getting this message when installing bun from a different user on my mac. A few of the suggestions here didn't work for me. I decided to comment out source "/Users/nickmanning/.bun/_bun" in ~/.zshrc.
Installing Bun from NPM worked for me
pnpm -g i bun