I've got a directory called build, which I cd into quite a bit.

If there isn't any directory bu* in the current directory, zsh tab completion: cd buTAB suggests messagebus/, which isn't in .. If I accept that completion, I end up in /private/var/empty.

I'm unsure which zsh option suggests this completion, but I'd love to turn it off. Any idea which setting does it?

For what it's worth, this is on OS X. On ubuntu, I get the suggestions libuuid messagebus with identical zsh settings.

  • Does this happen if you run zsh -f (no config file)? If you run ZDOTDIR=/ zsh (only the system config file)? Since there are a lot of completion settings, it would help to know where this behavior is coming from. Oct 2, 2012 at 22:28

1 Answer 1


/private/var/empty is likely the messagebus user's home directory. zsh offers expansion of home directories when it receives an argument to the cd function that it thinks looks like a user name. In your case, bu is expanded to messagebus by the approximate matcher, because no more specific matcher will trigger in an empty directory (on your Linux system, both uuid and messagebus are returned as possible approximate matches for the string bu).

It's possible to tell zsh which users it should consider for expansion in these circumstances by putting something like this in your ~/.zshrc:

zstyle ':completion:*' users user1 user2 root

Simply list all users you want the shell to consider, source ~/.zshrc to pick up the changes, and you should no longer get messagebus etc as possible completions.

You must log in to answer this question.

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