Gatekeeper is an execution prevention technology in OS X that will block apps from running if they have not been properly certified. It combines with similar technologies in OS X such as quarantining of downloaded files, to give you ample warning that a program you are running may be suspicious if it has not come from vetted sources, such as the App Store.
While it is a great option for most users to keep enabled by default, there may be times when you might wish to keep Gatekeeper disabled. These may be for special cases where developers create software, especially with developer tools besides Apple’s, or where a user might need to run numerous open source software packages.
Again in the vast majority of cases, this behavior is great for security and since in most cases you may only need to disable Gatekeeper temporarily, it being re-enabled will likely go unnoticed. Furthermore, you can always re-visit the Security system preferences to change Gatekeeper’s settings, if needed. However, if you wish to always have Gatekeeper disabled, then you can do so by running the following command in the OS X Terminal:
sudo defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool NO
This will write a hidden setting to Apple’s security preferences to prevent the disabling of Gatekeeper. You may need to reboot your Mac for these settings to take effect, and then Gatekeeper will stay disabled indefinitely.
If you wish to undo this setting, then you can run the following command to remove the change made by the previous command:
sudo defaults delete /Library/Preferences/com.apple.security GKAutoRearm