Another option is to turn off the gatekeeper.
sudo spctl --master-disable
Now all you have to do is enter your admin password and the system settings => security will show you the option to install and open apps from anywhere.
But as you can see in the picture, I can not start the program, although it is allowed in the settings. It works only by subsequent seten the execute flag.
tTO turn it back on
sudo spctl --master-enable