Starting from macOS 15, sudo spctl --master-disable is no longer supported to disable Gatekeeper.
We need to disbale it with Configuration Profiles.
- Create a new configuration profile, an XML file with
.mobileconfigextension, refer the sample file in this gist - replace the UUID with your own, you can use
uuidgenin terminal to generate a new one