How to kill a process on Mac

0
295

[ad_1]

Open Activity Monitor and find the process you want to kill by sorting it by resource usage or by process ID. Then click the X button at the top of Activity Monitor and select “Quit” or “Force Quit” to end the process.

Is any application or process causing problems on your Mac? Get rid of the problematic app by removing it using Activity Monitor or Terminal. You can also find and kill processes that use specific ports on your Mac.

How to kill a Mac process using Activity Monitor

The easiest way to find and kill a process that is causing a problem in macOS is to start Activity Monitor. You can do this using Spotlight (press Command + Space, then start typing “activity” and press Enter when you see the app) or by finding and starting the app in the Applications > Utilities folder.

Find running processes on macOS using Activity Monitor

Activity Monitor has several views that you can use to isolate problems. In the CPU tab, you can see which apps are using the most processing power right now (sort by “% CPU” tab to see the most hungry processes. You can also use “Memory” to sort by RAM usage, “Power ” to find which apps are using the most power, “Disk” to sort by disk usage, and “Network” to sort by data sent and received.

In addition to this, you can use the “Search” box in the upper right corner to search for a process name. You can find the core process and associated processes this way, for example, searching for Safari will find the main app, network processes, individual tabs, extensions, and more.

Find macOS processes that match "Safari" in Activity Monitor

Find the process you would like to kill, and then click the “X” button in the upper right corner of the screen. You can then choose between “Quit” and “Force Quit” to try to send an exit command (to give the process time to save its data) or a force exit command (to kill the process immediately, ideal if it crashes). Learn more about how to identify processes that are safe to kill on your Mac.

Quit the macOS process using Activity Monitor

How to kill a Mac process using Terminal

It is also possible to kill processes from the command line using Terminal on your Mac. To do this, first start Terminal (either using Spotlight or from the Applications > Utilities folder) and run the top command to see a list of running processes. Alternatively, use the ps -ax Command to display a list of processes along with the process ID (or PID for short).

List of running processes by PID in macOS Terminal

You’ll need the PID to kill a process, but tracing hundreds of processes can be a chore. Fortunately, we can identify processes using the ps ax | grep AppName command, where AppName is the name of the application you want to search for.

For example, write ps ax | grep Safari will return a list of processes with “Safari” in the title. Note that this command is case sensitive, so searching for “steam” will return different results than “Steam”

List of processes matching "Safari" In the terminal

Make a note of the PID number next to the process you want to kill, then kill it by running the kill PID domain. For example, kill 3500. To kill a process immediately (aka force quit) use kill -9 3500 instead.

You can also kill a process by using its name with the killall command, for example killall Safari. This will kill all processes with “Safari” in the name (again, processes are case sensitive).

How to kill a Mac process on a specific port

If you need to kill a process that is using a particular network port on your Mac, you’ll first need to find out which process is using that port. Fortunately, this is easy to do using Terminal. The command differs depending on the version of macOS you’re using.

For modern Mac computers (including Apple Silicon models) running macOS El Capitan or later, use the lsof command, for example: lsof -i tcp:51413 to find the process occupying port 51413. On older Mac computers, you can usenetstatFor example: netstat -vanp tcp | grep 51413 to find the process on port 51413.

List processes using a port on your Mac with the lsof Terminal command

Once you have the PID, you can end it using the kill command as described above. if you are using lsofyou can immediately kill a process depending on the port you are using with the kill -9 $(lsof -ti:portnumber) command, where portnumber is the port in question.

RELATED: Why are some network ports dangerous and how are they protected?

How to force close apps in the Dock

If the process you want to kill is an application in your database, you can force quit it, which should kill it even if it crashes and becomes unresponsive. To do this, find the app on your dock and right-click (or control-click), then hold down the “Option” key on your keyboard and choose “Force Quit” at the bottom of the list.

Force close a macOS app using the context menu

You can force close anything, whether it crashes or not, but you’re more likely to lose unsaved progress by doing so. If you find you need to do this frequently, learn how to troubleshoot crashing apps on your Mac.

[ad_2]