Trying to find a proper way to force kill an application on Mac… I always use the kill -9 or sudo kill -9 command, but 80% of the time that they dont work. So i goggle a bit and found the following… (remarks: that still doesnt kill my stupid applications - itunes >_<)
Quoted from QSXFAQ:
by Adrian Mayo - Editor, OSXFAQ
Tuesday - Force-Quit
Use ‘kill’ or ‘killall’ to force-quit errant applications.
The ‘kill’ command requires a process ID, not an application name. Discover it with:
$ ps xc | grep -iw ical 6577 ?? S 0:41.67 iCal
(Put the application name in quotes if it contains spaces or characters special to the shell.)
Quit it with:
$ kill -QUIT 6577Force-quit it with:
$ kill -KILL 6577Do it on one line by creating a bash function:
$ function killer () { kill -KILL $(ps xc | grep -wi “$*” | awk ‘{print $1}’); }
$ killer icalKill applications belonging to other users. Add option ‘a’ to the ‘ps’ command so it lists processes owned by other users too. You must either be root or use ’sudo’ to issue the ‘kill’ command.
Kill a process by name. Use the ‘killall’ command.
$ killall ical
No matching processes belonging to you were found
$ killall iCal(Killall is case-sensitive.)
Killall can match process names by regular expressions too - check out the man page.
To shut down the computer from the command line:
$ sudo shutdown -r now