macOS Gatekeeper

display dialog "This script allows you to run applications from anywhere on macOS, recommended for advanced Mac users only." buttons {"Allow from anywhere", "Revert to Default", "Cancel"} with title "macOS Gatekeeper" set the button_pressed to the button returned of the result if the button_pressed is "Allow from anywhere" then display dialog "Allow from anywhere will let you run any application, no matter the source and will disable Gatekeeper. This requires administrator privileges." buttons {"Continue", "Cancel"} with title "macOS Gatekeeper" if the button returned of the result is "Continue" then try do shell script "spctl --master-disable" with administrator privileges display notification "Gatekeeper Disabled" with title "macOS Gatekeeper" on error errMsg number errNum display dialog "Couldn't run without administrator privileges." buttons {"OK"} with title "macOS Gatekeeper" default button 1 end try end if else if the button_pressed is "Revert to Default" then display dialog "Revert to Default will enable Gatekeeper and will only let you run applications from the App Store and identified developers only. This requires administrator privileges." buttons {"Continue", "Cancel"} with title "macOS Gatekeeper" if the button returned of the result is "Continue" then try do shell script "spctl --master-enable" with administrator privileges display notification "Gatekeeper Enabled" with title "macOS Gatekeeper" on error errMsg number errNum display dialog "Couldn't run without administrator privileges." buttons {"OK"} with title "macOS Gatekeeper" default button 1 end try end if end if

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.