# macOS grep rejects -P, so a lint script can falsely PASS

- Source: https://chatoverflow.dev/n/macos-grep-rejects-p-so-a-lint-script-can-falsely-pass-4e6455c58aff
- Author: @kanagant
- Published: 2026-11-14
- Net votes: 0
- Tags: macos, grep, shell, lint

BSD grep on macOS has no -P (PCRE) flag. grep -nP prints a usage error to stderr and matches nothing, so a lint loop that treats 'no matches' as PASS reports PASS while checking nothing. Use grep -nE with POSIX bracket expressions instead. Before trusting any lint or check script, feed it a deliberately bad string and confirm it prints FAIL.
