UPDATE 3 I've worked out that these annoying autocomplete options are actually usernames. I.e. they exist in /etc/passwd I have users such as _kadmin_admin and _kadmin_changepw and many others starting with an underscore. This may be specific to OSX.

Oh-my-zsh is autocompleting with these usernames when it can't find any other matches. I tried adding these usernames to the "Don't complete uninteresting users" list in ~/.oh-my-zsh/lib/completion.zsh, but that didn't work. I'm not sure why?

Is there anyway to stop oh-my-zsh from autocompleting usernames?

I'm getting frustrated by some weird behaviour in either ZSH or oh-my-zsh. I'm not sure which would be causing it.

The autocomplete seems to be searching some weird directories that I don't want it to. They appear to be some SVN directories, that I know nothing about and have no idea why they would be in the path. (I don't even use SVN)

This behaviour only seems to occur if there are no other matches in the current directory - it must then look in some other path that I have no idea about.


NOTE: There is nothing in my home dir that matches mi

→  ~  cd mi<tab>
→  ~  cd _kadmin

I.e. it turns mi into _kadmin. I have no idea why it is matching that directory.

If I try to actually change into that directory, I get an error anyway (as it is not the full directory name):

→  ~  cd _kadmin
cd:cd:10: no such file or directory: _kadmin

If I keep pressing <tab> then it will match the full directory name:

→  ~  cd mi<tab><tab><tab>
→  ~  cd kadmin_admin
→  ~_svn
→  ~_svn pwd

I have no idea what is going on there. I have no idea what kadmin_admin is. And why when I change into it, why would I now get a directory name of ~_svn, and then if I PWD it shows /var/empty

This is my path:


Nothing obvious in there that I can see.

Please someone shed some light on this. It's quite frustrating me!

EDIT: Seems someone has had a similar issue before: Stop tab completion suggesting 'messagebus' There are no answers on there though :(

UPDATE: This is the cd function which oh-my-zsh applies:

→  ~  which cd
cd () {
    if [[ "x$*" = "x..." ]]
            cd ../..
    elif [[ "x$*" = "x...." ]]
            cd ../../..
    elif [[ "x$*" = "x....." ]]
        cd ../../..
    elif [[ "x$*" = "x......" ]]
            cd ../../../..
            builtin cd "$@"
  • 1
    This looks like an issue in oh-my-zsh or rvm. One of these is overloading cd with a function. Try running zsh without one of them: does the problem persist? What is the cd function and where is it coming from? Is there a CDPATH? Dec 2, 2012 at 23:56
  • @Gilles Yes, it's oh-my-zsh which is using a cd function. Have pasted it above. I also ran zsh without oh-my-zsh, and it did not have the same problem. So I think you could be right. There is no CDPATH set either.
    – asgeo1
    Dec 3, 2012 at 4:15
  • Did you ever figure this out @asgeo1? I just recently ran into this myself. Jul 24, 2015 at 23:39
  • This solved it for me: unix.stackexchange.com/a/181675/27991 Jul 24, 2015 at 23:49

1 Answer 1


_kadmin is probably a completer function for the kadmin tool - not a directory. If you attempt completion on something that zsh can't find as a command, a directory or a valid and known command argument completion, it then starts to offer completion functions as possible expansion candidates. By default, zsh comes with a lot of completers, many of which you may not need - there are bundles for AIX, BSD, Cygwin, various Linux distributions, etc, and they all get read and installed into the shell. If you attempt an expansion on something zsh can't find, it has all those installed completion functions to offer you instead.

You configure zsh not to offer completer functions by putting this in your ~/.zshrc:

zstyle ':completion:*:functions' ignored-patterns '_*'

Reload the file and you should no longer be offered completion functions for tools you don't have installed. Have a look at the zshcompsys manpage for (a lot) more detail.

EDIT in reply to UPDATE 3

If _kadmin is actually a user account, you can configure zsh to not offer it in completions. It seems the approach is to list the user accounts you do want the shell to consider, which limits any names offered only to those listed. The zstyle line is something like this:

zstyle ':completion:*' users asgeo1 root

I think you can list as many users as you like after the users tag. The shell will then only offer those users' home directories as possible completions for the cd function or builtin.

I don't know why adding the username to the ignored-patterns in the completion.zsh file didn't work - did you reload your config after making the change?

  • Thanks for the information - I didn't really know anything about zsh autocomplete functions before. I think that oh-my-zsh must be adding some autocomplete functions that I don't need. If I put that line in my .zshrc it doesn't appear to do anything though - I have to still disable oh-my-zsh. I'm hoping there is a way in oh-my-zsh to disable certain completion functions (but leave the git one turned on for example)
    – asgeo1
    Dec 3, 2012 at 22:46
  • I've worked out that _kadmin actually refers to a username on OSX. See edit to question above. Do you know how to make zsh not autocomplete usernames? I'm struggling to understand the zstyle syntax. Cheers.
    – asgeo1
    Dec 3, 2012 at 23:55
  • Edited my answer to cover this new information. I hope that fixes it for you!
    – D_Bye
    Dec 4, 2012 at 10:06
  • Yeah, I did reload the config. So not sure why the ignored-patterns didn't work. But your other suggestion works and is a lot cleaner anyway, so thanks for that!
    – asgeo1
    Dec 6, 2012 at 0:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .