MacOS – How to kill a process by its name

macosterminal

Sometimes I notice that the process Python hung up. Then I'll kill it via the Activity Monitor and everything is fine.

I'd like to kill that process in the Terminal instead. However, looking up the PID seems kind of unecessary because there's only one process by the name Python.

Is it possible to kill a process by its unique name?

Best Answer

You should be able to run the command sudo killall Python.

You need to run as root because Python belongs to root, not the user.