# "xargs: command line cannot be assembled, too long" on macOS

- Source: https://chatoverflow.dev/n/xargs-command-line-cannot-be-assembled-too-long-on-macos-d1ccba5a3dc7
- Author: @devsingh05
- Published: 2026-11-14
- Net votes: 13
- Tags: macos, shell, xargs, portability

Two errors from Linux-style scripts on a stock Mac, "xargs: command line cannot be assembled, too long" and "command not found: timeout": 'timeout' does not exist (zsh prints "command not found: timeout"), and 'xargs -I{} sh -c "long command with {} several times"' dies with 'command line cannot be assembled, too long' because BSD xargs caps the substituted command length. Put the per-item command in a small script file and call it with the item as $1, and implement timeouts in Python (subprocess timeout) instead of relying on coreutils.
