How to prevent all applications in a specific folder from launching on macOS? How to prevent all applications in a specific folder from launching on macOS? With a .mobileconfig file? Or a script?
Use the following configuration profile. It will block all apps within the users home folder from launching without an admin password.  This can be changed to a different path if needed.


Save the following to a file with the extension .mobileconfig
Double Click on the file and install it in System Preferences
Celebrate




&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;PayloadIdentifier&lt;/key&gt;
    &lt;string&gt;com.company.macos.blockapps&lt;/string&gt;
    &lt;key&gt;PayloadRemovalDisallowed&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;PayloadScope&lt;/key&gt;
    &lt;string&gt;System&lt;/string&gt;
    &lt;key&gt;PayloadType&lt;/key&gt;
    &lt;string&gt;Configuration&lt;/string&gt;
    &lt;key&gt;PayloadUUID&lt;/key&gt;
    &lt;string&gt;9c24d6b3-6233-4a08-a48d-9068f4f76cf0&lt;/string&gt;
    &lt;key&gt;PayloadOrganization&lt;/key&gt;
    &lt;string&gt;Company Name&lt;/string&gt;
    &lt;key&gt;PayloadVersion&lt;/key&gt;
    &lt;integer&gt;1&lt;/integer&gt;
    &lt;key&gt;PayloadDisplayName&lt;/key&gt;
    &lt;string&gt;Block Apps In User Folder&lt;/string&gt;
    &lt;key&gt;PayloadContent&lt;/key&gt;
    &lt;array&gt;
        &lt;dict&gt;
            &lt;key&gt;PayloadType&lt;/key&gt;
            &lt;string&gt;com.apple.applicationaccess.new&lt;/string&gt;
            &lt;key&gt;PayloadVersion&lt;/key&gt;
            &lt;integer&gt;1&lt;/integer&gt;
            &lt;key&gt;PayloadIdentifier&lt;/key&gt;
            &lt;string&gt;MCXToProfile.9c24d6b3-6233-4a08-a48d-9068f4f76cf0.alacarte.customsettings.2476221c-1870-4f3e-8c52-52386029c4cf&lt;/string&gt;
            &lt;key&gt;PayloadEnabled&lt;/key&gt;
            &lt;true/&gt;
            &lt;key&gt;PayloadUUID&lt;/key&gt;
            &lt;string&gt;2476221c-1870-4f3e-8c52-52386029c4cf&lt;/string&gt;
            &lt;key&gt;PayloadDisplayName&lt;/key&gt;
            &lt;string&gt;Blocks all apps in the ~/ directory./string&gt;
            &lt;key&gt;familyControlsEnabled&lt;/key&gt;
            &lt;true/&gt;
            &lt;key&gt;pathBlackList&lt;/key&gt;
            &lt;array&gt;
                &lt;string&gt;~/&lt;/string&gt;
            &lt;/array&gt;
        &lt;/dict&gt;
    &lt;/array&gt;
&lt;/dict&gt;
&lt;/plist&gt;




Source: https://gist.github.com/rtrouton/1475fc5785b1af9cfbf4080a2eb6696f#file-application_block-mobileconfig