1

I get this when I tre to run the terminal on my mac:

zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? y

Suggested answers like this are of no use to me as they all involve running commands which I'm not currently able to do. How do I resolve this?

Ths is my .zshrc:

export JAVA_HOME=$(/usr/libexec/java_home)
export PATH="$HOME/.jenv/bin:$PATH:/Users/paulcarron/Apache/apache-maven-3.8.1/bin"
eval "$(jenv init -)"
export NVM_DIR=~/.nvm
    source $(brew --prefix nvm)/nvm.sh
source ~/.bash_profile

.bashrc:

export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
eval "$(jenv init -)"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
if [ -r ~/.zshrc ]; then
   source ~/.zshrc
fi
Marlon Richert
  • 5,250
  • 1
  • 18
  • 27
runnerpaul
  • 5,942
  • 8
  • 49
  • 118
  • Why are you not able to run those commands? – Marlon Richert Sep 21 '21 at 06:35
  • Because I can't seem to exit out of `zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]? y`. Each time I select an option that just appears back in the terminal. – runnerpaul Sep 21 '21 at 06:36
  • What, you mean that, when you press `y` or `n` in response to that question, then the same question pops up again? – Marlon Richert Sep 21 '21 at 10:18
  • What have you installed? This is not asked by default in `zsh` on macOS. – Marlon Richert Sep 21 '21 at 10:20
  • Yes. If I press y or n I get the question again. Not sure what might have been installed. – runnerpaul Sep 21 '21 at 10:24
  • @runnerpaul : Configure your terminal, so that you can start tabs which run either `bash` or a `zsh` that bypasses the usual startup files. This is always handy as a backup, even if you don't need it in your daily business. Another possibility is to use your text editor to comment out the `compinit` line in your startup file; at least this will give you a working shell from which you can proceed further. – user1934428 Sep 22 '21 at 07:40
  • @runnerpaul : See also my response to [this](https://stackoverflow.com/questions/56284264/recommended-method-for-reloading-zshrc-source-vs-exec/56303297#56303297) question. While your problem is slightly different, my response should apply to your case as well. – user1934428 Sep 22 '21 at 07:57
  • @runnerpaul It would be useful if you could add your `.zshrc` file to your question. – Marlon Richert Sep 22 '21 at 13:24
  • @MarlonRichert `.zshrc` added to question. – runnerpaul Sep 22 '21 at 22:08
  • Why do you `source ~/.bash_profile`? Please add the contents of that file to your question, too. – Marlon Richert Sep 23 '21 at 08:05
  • @MarlonRichert I can't remember why I added `source ~/.bash_profile` but think it was in order to resolve some other issue. – runnerpaul Sep 23 '21 at 16:00

1 Answers1

1

You have a created an infinite loop in your dotfiles. Your .zshrc sources your .bashrc, which sources your .zshrc, ad infinitum.

Additionally, when you source "$NVM_DIR/bash_completion" from zsh, it for some strange reason calls compinit. (This is something that nvm should not do.)

So, there you have it: Together, you’ve created yourself infinite compinits.

Moral of the story: It’s already a bad idea to source .bashrc from .zshrc, or vice versa, but doing it in both directions is even worse.

Solution: Don’t do that and remove the offending lines from your dotfiles.

Marlon Richert
  • 5,250
  • 1
  • 18
  • 27