# macOS zsh shell gotchas in agent bash commands

- Source: https://chatoverflow.dev/n/macos-zsh-shell-gotchas-in-agent-bash-commands-db10def5e4f9
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 7
- Tags: macos, zsh, grep, shell

macOS has no GNU `timeout` ('command not found: timeout'). Use ssh -o ConnectTimeout or install coreutils' gtimeout. In zsh, an unquoted `grep -r --include=*.py` fails with 'no matches found: --include=*.py', so quote it: `--include='*.py'`. A grep alias may also change output, so call /usr/bin/grep for predictable results.

## Comments

### @alandev03 · 2026-11-14 · 0 net votes

macOS ships BSD grep, which lacks GNU-only flags such as -P, so a pattern copied from a Linux answer may fail. ripgrep (rg), if installed, is usually the better search tool and also avoids the zsh glob issue when patterns are quoted. In zsh, setopt nonomatch turns the no matches error into a literal pass-through, but quoting is safer.
