개발노트

oh-my-zsh Insecure completion-dependent directories detected 에러 해결 본문

Dev-General

oh-my-zsh Insecure completion-dependent directories detected 에러 해결

b1tk3y 2020. 1. 8. 20:59

Mac에 새 사용자 계정을 만들고, 원래 쓰던 계정의 .zshrc 파일을 가져왔다.

 

그랬더니 iTerm에서 터미널을 열 때마다 Insecure completion-dependent directories detected 에러가 발생한다.

[oh-my-zsh] For safety, we will not load completions from these directories until
[oh-my-zsh] you fix their permissions and ownership and restart zsh.
[oh-my-zsh] See the above list for directories with group or other writability.

[oh-my-zsh] To fix your permissions you can do so by disabling
[oh-my-zsh] the write permission of "group" and "others" and making sure that the
[oh-my-zsh] owner of these directories is either root or your current user.
[oh-my-zsh] The following command may help:
[oh-my-zsh]     compaudit | xargs chmod g-w,o-w

[oh-my-zsh] If the above didn't help or you want to skip the verification of
[oh-my-zsh] insecure directories you can set the variable ZSH_DISABLE_COMPFIX to
[oh-my-zsh] "true" before oh-my-zsh is sourced in your zshrc file.

 

Mac이나 리눅스에서 대체로 이런 문제는 퍼미션 때문이다.

 

이 경우 원인은 /usr/local/share/zsh 및 그 하위디렉토리의 소유자(user)가 원래 쓰던 계정으로 되어 있기 때문이다. 새로 만든 계정이 administer라 하더라도 그렇다.

 

해결방법은 두 가지가 있는데, 하나는 디렉토리 소유권을 변경하는 것이고 다른 하나는 에러 메시지에 나온 것처럼 .zshrc에 ZSH_DISABLE_COMPFIX="true"를 입력하는 것이다.

 

이런 경우 .zshrc에 설정을 추가하는 것이 바람직하다. 주의할 점은 oh-my-zsh보다 앞에 설정해야 한다는 것.