What does --disable-sandbox do for Swift Package Manager?

A user recently reported a weird bug to me, and the internet hinted that I might be able to fix it by running swift build with the --disable-sandbox flag (something about how Homebrew uses its own sandbox, so we need to disable Swift's when running swift build).

Running swift build --help tells me this:

--disable-sandbox       Disable using the sandbox when executing subprocesses

I'm a bit worried that disabling the sandbox might open the program up to security issues or something, so I wanted to know: what is the sandbox? What's it for? Are there any reasons not to disable it?

The sandbox prevents Package.swift files running arbitrary code when you build and install them. As they are Swift files, they can execute code if they want to. The sandbox limits their access to the rest of the system.

Oh, I get it. So if they’re files I wrote, this should be pretty safe (unless someone tampers with them in some way, I guess).

Thanks for the help.

Terms of Service

Privacy Policy

Cookie Policy