Killall fails

I have app which i cant quit or kill when that app freaks out. Is there more lethal way to kill apps?

set theAppToKill to "appnamehere"
try
	tell application theAppToKill to quit
on error
	do shell script "killall " & the theAppToKill
end try

Emphasis added.

Try something like this:

do shell script "/usr/bin/killall -SIGNAL 9 " & whatever

Also, note that the name of an application’s executable file does not necessarily have the same name that you would use for a tell block (e.g. Firefox’s executable is firefox-bin).

Hi cirno :slight_smile:

I really don’t know, what you’re doing with your scripts, but I never ever had to “kill” one of my applications this way.
A good error handling avoids also this brutality :wink:

If this is not possible, it could be easier to abort the process by processor id not by name

set The_app to "whatever.app"
try
	tell application "System Events" to set pid to the unix id of process The_app as Unicode text
	do shell script "kill " & pid
on error
	display dialog "Application " & The_app & " is not running" buttons {"Cancel"} default button 1 giving up after 2
end try

Killing the process with the kill (kill -9 pid) command usually works on hung processes. If not sometimes kill -HUP pid will make the process behave (long enough to kill it) or exit.