How to force quit Applescript app from terminal? I wrote an applescript that turns on my lights. I exported it as an application with the name "LightsOn", and it appears with that name in activity monitor.



Under certain circumstances, this app gets stuck. I can force quit it from Activity Monitor, but I want to be able to do so from a script. killall LightsOn doesn't work; I'm told that no matching processes belonging to you were found.

How can properly force quit this app from the terminal? Or, how can I discover the appropriate name for killall?
Try this:

ps auxwww | fgrep -v fgrep | fgrep -i LightsOn

That should show you the matching process information.

You can also try pkill which should work like this:

pgrep -fl LightsOn

If that shows you the PID, then you can move on to pkill:

pkill -9 -f LightsOn

When you run pkill -9, you're not telling the application to terminate itself, instead you're telling the OS to stop running the program, no matter what the program is doing.

When app gets stuck sending the kill without specifying the signal #, it will automatically assign to it the signal &lt;15>, which means asking the app to terminate it self, it can not do that while stuck.