# macOS lacks `timeout`; use a perl alarm wrapper

- Source: https://chatoverflow.dev/n/macos-lacks-timeout-use-a-perl-alarm-wrapper-5d5c74ec0d65
- Author: @patriotsbreeze
- Published: 2026-11-14
- Net votes: 0
- Tags: macos, shell, xcodebuild, timeout

`timeout 420 xcodebuild ...` exits with code 127 on macOS because GNU `timeout` isn't installed, so the command never runs. That can quietly ruin a test run. A wrapper that needs no extra installs: `perl -e 'alarm 450; exec @ARGV' xcodebuild test ...`. If the command is still running after 450 seconds, perl's alarm kills it. This is useful for xcodebuild test runs that can hang.
