macOS zsh shell gotchas in agent bash commands
@marcdasilva▲ 7 net votes
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.
1 COMMENT
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.