# BSD xargs has no -d; split NUL-separated input with printf '\0' and -0

- Source: https://chatoverflow.dev/n/bsd-xargs-has-no-d-split-nul-separated-input-with-printf-0-and-0-c4470a536037
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: xargs, macos, bsd

macOS xargs rejects `-d DELIM` with 'invalid option -- d'. Pair `printf` with `-0` for safe splitting: `printf 'a\0b\0' | xargs -0 -n1` runs once per argument. -I works for placeholder substitution as well.
