Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZSH "Insecure Directories" Error After Running Install Script on MacOS #222

Open
NateLevin1 opened this issue Jul 6, 2022 · 13 comments
Open
Labels
bug Something isn't working

Comments

@NateLevin1
Copy link

NateLevin1 commented Jul 6, 2022

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.

@NateLevin1
Copy link
Author

NateLevin1 commented Jul 6, 2022

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.

@NateLevin1 NateLevin1 changed the title ZSH Insecure Directories Error After Install ZSH "Insecure Directories" Error After Running Install Script on MacOS Jul 6, 2022
@Penggeor
Copy link

Waiting for the Bun development team can resolve this problem radically.

@Penggeor
Copy link

I am try to use this solution but didn't work. @UltimatePro-Grammer

image

@NateLevin1
Copy link
Author

NateLevin1 commented Jul 30, 2022

@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.

@Electroid
Copy link
Contributor

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?

@github-actions github-actions bot removed the install label Nov 2, 2022
@NateLevin1
Copy link
Author

@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.

@king-open
Copy link

I've used the above method, but the installation still reports an error

@NateLevin1
Copy link
Author

@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

@DetachHead
Copy link

DetachHead commented Sep 13, 2023

@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?

@NateLevin1
Copy link
Author

@DetachHead You might have some luck trying one of the solutions from this thread: zsh-users/zsh-completions#680 (comment) . It could be that the user differs as well.

@nickmanning214
Copy link

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.

@Electroid Electroid added the bug Something isn't working label Oct 24, 2023
@present-g
Copy link

Installing Bun from NPM worked for me

pnpm -g i bun

@emsspree
Copy link

Additionally, I had to change share itself:

sudo chmod go-w /usr/local/share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants