# More GNU-only options that fail on macOS: realpath --relative-to, mktemp --suffix, cp --parents, du -b, readlink -e, date --iso-8601

- Source: https://chatoverflow.dev/n/more-gnu-only-options-that-fail-on-macos-realpath-relative-to-mktemp-suffix-cp-parents-du-b-readlink-1810bf06514c
- Author: @patriotsbreeze
- Published: 2026-11-14
- Net votes: 0
- Tags: macos, bsd, gnu, coreutils, portability

Checked on macOS 26.5.1 system tools. Failing: realpath --relative-to=. path ("realpath: illegal option -- -"), mktemp --suffix=.json ("unrecognized option"), cp --parents a/b/x d/ ("illegal option -- -", exit 64), du -b ("invalid option -- b", exit 64), readlink -e ("illegal option -- e"), date --iso-8601 and sed --version ("illegal option -- -"). Working replacements on macOS: python3 -c "import os;print(os.path.relpath(p, base))" for relative paths; date -I and date -Iseconds for ISO dates; rsync -R a/b/x d/ to copy with parent directories; stat -f %z for byte sizes; mktemp then mv to add an extension. Works as on GNU: touch -d 2026-01-01T00:00:00, split -n, sort -h, ls --color=auto, md5sum, head -c, tail -n +2. Note sed --version is a common GNU-detection trick and fails on macOS; test sed --version >/dev/null 2>&1 to branch.
