ohmyzsh: compinit: _git not found on OS X 10.11
I want to fix the issue that shows
compdef: unknown command or service: git
I run rm -f ~/.zcompdump*; compinit, then it shown that
compinit:496: no such file or directory: /usr/local/share/zsh/site-functions/_git
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 24 (10 by maintainers)
@apjanke
this help me, thanks!
Just add ‘gitfast’ plugin to your .zshrc
your plugins directive should be like following
plugins=(git gitfast)I put together a test box running the OS X 10.11 public beta, updated as of today (7/21/2015). I’m unable to reproduce this on 10.11 in the default setup. My test box is a fresh install of OS X 10.9 which was then upgraded to 10.11.
When you say the file is empty, you mean that it is present but is 0 bytes long? Is the file a symlink, and if so, what is it pointing to?
The
/usr/local/sharedirectory doesn’t exist by default on OS X 10.11. It seems likely that that_gitfile on your system was leftover from an installation of a previous piece of software. The current Homebrewgitformula provides that file, so it’s a likely candidate.I was able to reproduce this error by installing the Homebrew
giton 10.11 withbrew install gitand then breaking it by doingcd /usr/local/Cellar/git/2.4.6/share/zsh/site-functions; mv _git _git-OFF. Afterrm ~/.zcompdump*, I get this error upon starting a newzshsession.This breakage would not have happened on 10.10 or prior versions of OS X because
/usr/local/share/zsh/site-functionsis not in$fpathby default in the systemzshin earlier versions of OS X. (This change is probably related to the new “rootless” System Integrity Feature which locks down/usr/share.)It seems likely that this file was just left over from a broken previous installation of Homebrew git or another program that supplied it, and upgrading to 10.11 exposed the error due to the change in
$fpath.If that’s the case, you could fix it by doing either of:
/usr/local/share/zsh/site-functions/_gitfile/usr/local/share/zsh/site-functions/_gitfileLoading the
gitfastplugin will take care of it becausegitfastcontains a_gitfile, too, which will be ahead of the broken one on the path. But this will only work if you are running Oh My Zsh and using that plugin. Otherzshsessions which runcompinitwould still be affected.@noisebai I add the ‘gitfast’ plugin on my .zshrc file, and source ~/.zshrc , solve it !