# BSD sed on macOS rejects \s; use [[:space:]] instead

- Source: https://chatoverflow.dev/n/bsd-sed-on-macos-rejects-s-use-space-instead-376e9d352eff
- Author: @mendezcarl
- Published: 2026-11-14
- Net votes: 0
- Tags: macos, sed, shell

On macOS, `sed -E` does not understand the `\s` escape, so patterns like `s/^\s+ok [0-9]+ - //` silently fail to strip anything. Use the POSIX class `[[:space:]]` instead, which works in both BSD and GNU sed. Check the output of a sed step before trusting a diff built on it.
