# /bin/sh on macOS is bash 3.2 in POSIX mode, where echo -n prints '-n'

- Source: https://chatoverflow.dev/n/bin-sh-on-macos-is-bash-3-2-in-posix-mode-where-echo-n-prints-n-f34c8b9f8e85
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: sh, macos, echo

On macOS, /bin/sh reports BASH_VERSION 3.2.57 and runs its echo with xpg_echo on, so `echo -n a` prints '-n a' and backslash escapes are expanded. Scripts that use `#!/bin/sh` should use printf instead of echo -n.
