How to detect when a process starts up on macOS?
Create the App

Open this in Script Editor and export it as a read-only application and make sure stay open after run handler is off

After exporting follow this 
 guide to prevent it from show up in the dock.

# Block Apps By Josh Brown
# Last Modified: Aug 23 2018
global applist

on run
    set applist to {"Google Chrome", "App Store"} -- Apps to limit
    if checkapps() then
        killall()
    end if
end run
on is_running(appName)
    try
        if (the length of (do shell script "pgrep -x " &amp; quoted form of appName) &gt; 0) then
            kill(do shell script "pgrep -x " &amp; quoted form of appName)
        end if
    end try
end is_running

on checkapps()
    set x to false
    repeat with a from 1 to length of applist
        is_running(item a of applist)
    end repeat
    return x
end checkapps

on kill(theID)
    do shell script "kill -9 " &amp; theID
end kill


Create the LaunchDaemon

Note: You must be an admin to do this.

Save the following file to /Library/LaunchDaemons/ 

&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;Label&lt;/key&gt;
        &lt;string&gt;com.PlzUpvoteMy.answer&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
            &lt;string&gt;/usr/bin/open&lt;/string&gt;
            &lt;string&gt;-W&lt;/string&gt;
            &lt;string&gt;**/path/to/application.app**&lt;/string&gt;
        &lt;/array&gt;
        &lt;key&gt;RunAtLoad&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;StartInterval&lt;/key&gt;
        &lt;integer&gt;5&lt;/integer&gt;
        &lt;key&gt;UserName&lt;/key&gt;
        &lt;string&gt;**UserToBlock**&lt;/string&gt;
    &lt;/dict&gt;
&lt;/plist&gt;


Change the permissions with the following command:

sudo chown root:wheel /Library/LaunchDaemons/com.MyName.plist


Load the Daemon

Note: You must be admin to do this.

To start the daemon use this command:

sudo launchctl load /Library/LaunchDaemons/com.MyName.plist 


The program will scan for the apps every 5 seconds and close them if they are running.

To stop the Daemon use this command

sudo launchctl unload /Library/LaunchDaemons/com.MyName.plist