Does Process with Launch Path /usr/bin/swift requires Command Line Tools to be installed on Mac?

Yes, Swift "scripts" (Swift files run directly using swift — which are, behind the scenes, compiled into a temporary directory and then immediately executed) require either the Command Line Tools or a full Xcode installation on the target machine (depending on what the script needs to do).

macOS does not come with the Swift compiler (or other developer tools) preinstalled, so compiling Swift on a target machine requires installing it. The /usr/bin/swift which comes preinstalled on macOS prompts for this installation when run — and installing the tools will overwrite /usr/bin/swift to be able to compile Swift.

If you are trying to distribute and run "scripts" like this alongside your app, you'll either need to ensure that the end user has the Command Line Tools installed (or prompt them to follow the instructions to install them themselves), or precompile those scripts into your app so you don't need to rely on /usr/bin/swift. The latter is likely preferred: why do you need to run actions in external scripts, and why can't your application perform these actions itself?

If your app intends to help users run their own scripts, they will need to install these tools as well.


Note that this isn't unique to /usr/bin/swift. macOS also ships with a /usr/bin/git, for instance, that prompts for the same thing. The Command Line Tools are necessary for many basic developer-related command-line tools.