macOS ZSH wildcards

ZSH wildcards on MacOS

As a long time "not zsh" user, I've recently been caught a few times by wildcards not working in ZSH.

Now ZSH has been the default shell in macOS for a while now but I've only recently started to switch, call me old fashioned.

The first time I ran into this was when I was trying to find a file I was sure existed, however the terminal gave me an error.

~ % find . -type f -name index*  
zsh: no matches found: index*

The way to make it work correctly is to put quotes around the term and wildcard.

~ % find . -type f -name "index*"

If you are interested, there is more reading at SuperUser with some good information on how it's related to the way that ZSH manages globbing characters to generate filenames.

SuperUser ZSH Wildcards

I've also run into this issue using rsync and other MacOS/UNIX cli tools, so making a note in case it's helpful for others, or just for future self :-)

© JB