공부/mac

m1 맥 zsh-completions 인스톨하기

inSaPPoRo 2022. 1. 13. 13:37

시작하면서

m1 맥으로 이사하면서 모두 초기화 하고 다시 설정하는데 tab키를 눌러도 반응이 없어서 찾아보니 zsh-completions이 필요했습니다.
예전 맥에서도 인스톨을 했는지 기억도 없는데 ㅠㅠ
인스톨 순서를 기록합니다.

zsh-completions install

brew install zsh-completions

brew를 이용해 인스톨 했습니다.

==> Caveats
To activate these completions, add the following to your .zshrc:

  if type brew &>/dev/null; then
    FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

    autoload -Uz compinit
    compinit
  fi

You may also need to force rebuild `zcompdump`:

  rm -f ~/.zcompdump; compinit

Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting
to load these completions, you may need to run this:

  chmod -R go-w '/opt/homebrew/share/zsh'
==> Summary
🍺  /opt/homebrew/Cellar/zsh-completions/0.33.0_1: 147 files, 1.2MB
==> Running `brew cleanup zsh-completions`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

내용이 나오네요
.zshrc에 아래의 내용을 추가 하였습니다.

if type brew &>/dev/null; then
  FPATH=$(brew --prefix)/share/zsh-completions:$FPATH

  autoload -Uz compinit
  compinit
fi

추가한 내용을 적용하였습니다.

$ source ~/.zshrc
zsh compinit: insecure directories, run compaudit for list.
Ignore insecure directories and continue [y] or abort compinit [n]? y%

안전하지 않는 디랙토리를 무시한다고 나오네요
아까 설치 할때 나온 내용에 있군요
Additionally, if you receive "zsh compinit: insecure directories" warnings when attempting
to load these completions, you may need to run this:

chmod -R go-w '/opt/homebrew/share/zsh'

chmod -R go-w '/opt/homebrew/share/zsh'

실행하고 다시 rm -f ~/.zcompdump; compinit를 해보았지만 같은 내용이 나오네요
검색해본 결과 /opt/homebrew/share/를 chmod -R go-w하지 않으면 안되는것 같습니다.

chmod -R go-w '/opt/homebrew/share/'
rm -f ~/.zcompdump; compinit

디랙토리 무시 메시지가 안나오고 init가 되었습니다.

마치며

추가하고 무엇이 추가된 기능인지 잘 모르겠지만 일단 추가 했습니다.
좀더 조사해보아야겠습니다.

 

https://qiita.com/riku929hr/items/d2a15276e94bd2b11e75

반응형