How to disable Gatekeeper in OSX Sierra

During the June WWDC conference during a “What’s New in Security” session it was made known that Apple were changing the default options of Gatekeeper for macOS Sierra. This can cause some troubles installing programs so I’m writing this blog to show you how to disable Gatekeeper in OSX Sierra.Gatekeeper1
As you can see the main change in the GUI was to remove the “Anywhere” option that had been available since it’s introduction in OS X Mountain Lion. Gatekeeper2
Now why I don’t condone using the Anywhere option you may find on the very rare occasion as a user you are forced into it.
One example of this is the KODAK_AiO_Printer_v7_9 software. Like alot of software downloaded from the internet it is not signed by an identified developer and therefore Gatekeeper will not allow it to run and warns you about it.
Now for most software the lack of an Anywhere option is fine because we can either Control-Click the app and select Open from the contextual menu to update Gatekeeper to allow the software or we can go to Security & Privacy preferences and select Open  Anyway which appears once you have dismissed the initial warning.Gatekeeper4The problem with the Kodak installer is that even if you override Gatekeeper settings to allow install Software package it actually runs 10 separate installer packages each also unsigned and therefore blocked by Gatekeeper.Gatekeeper5Now we could run the installer 10 times each time having to go to Security & Privacy preferences and Open Anyway until we have finally done them all or we can disable Gatekeeper temporarily so that we can install the drivers.Gatekeeper6 Now although graphically Anywhere is gone we can actually use the feature which in turn actually reenables the GUI option. To do this we could use a configuration profile
Gatekeeper7or simply use the command line.
To disable Gatekeeper in the command line. Launch Terminal and type:

sudo spctl --master-disable

Once you have finished the installation remember to enable Gatekeeper once again you can either do this by using another configuration profile, running

sudo spctl --master-enable

in Terminal or just change the setting back in Security & Privacy preferences manually. All methods will result in the Anywhere GUI option disappearing again.
I know the temptation is to leave it disabled and sometimes you may find the warnings annoying but they are there to help prevent the running of Malicious software.
Remember: Only override Gatekeeper if you are 100% sure the application or package you are using is safe.
While the author has taken care to provide our readers with accurate information, please use your discretion before acting upon information based on the blog post. Amsys will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.
This blog was written and demonstrated using macOS 10.12.0 which was the latest release of macOS at the time of writing.