Gatekeeper protect your Mac to prevent installations of any unauthorized apps on your Mac. This prevents malware from being installed on your Mac. Using System Preferences, you can disable Gatekeeper using the ‘Security’ option. Yet Gatekeeper will be automatically enabled after 30 days, using the following command you can disable Gatekeeper forever.
defaults write /Library/Preferences/com.apple.security GKAutoRearm -bool false
Turning Gatekeeper back on on a Mac with the following command:
defaults delete /Library/Preferences/com.apple.security GKAutoRearm