How To Change macOS Process Priority

macOS allows users to change the priority of a process using Terminal, the command-line utility. This article will tell you the steps of how to change the priority of a process using Terminal.

1. How To Change macOS Process Priority In Terminal.

  1. Open Terminal on your Mac. You can do this by clicking on the Spotlight search icon (magnifying glass) in the top-right corner of your screen and typing “Terminal“. Then select Terminal from the search results.
  2. Type the following command in Terminal to view a list of running processes along with their Process IDs (PIDs):

    ps aux
  3. Identify the PID of the process whose priority you want to change.
  4. Type the following command in Terminal to change the priority of the process:

    sudo renice -n priority_value -p pid
  5. Replace “priority_value” with the new priority value you want to set for the process (a lower value means a higher priority), and “pid” with the PID of the process you want to modify.
  6. For example, if you want to increase the priority of a process with PID 1234 to the highest possible value (-20), you would enter the following command:

    sudo renice -n -20 -p 1234
  7. Enter your administrator password when prompted by Terminal.
  8. The priority of the process should now be changed, and it should receive more system resources and priority than other processes with lower priority values.

2. How To Get macOS Process Priority In Terminal.

  1. In macOS version 10.15 (Catalina), the process priority feature has been removed from the Activity Monitor application.
  2. However, you can still view some information about process priority using the Terminal application.
  3. Here are the steps to get process priority in macOS version 10.15.
  4. Open the Terminal window, type the following command and press Enter.
    ps -axo pid,ppid,%cpu,%mem,ni,command
  5. This will show a list of all running processes on your system, along with some information about each process, including the process priority (ni).
  6. To identify the priority of a specific process, locate its process ID (PID) in the list and look for the “ni” column.
  7. The “ni” column shows the process priority, with a lower number indicating a higher priority. The default priority for all processes is 0.
  8. Note: The process priority shown in the “ni” column is not the same as the priority values used in earlier versions of macOS.
  9. In macOS version 10.15, the process priority values range from -20 (highest priority) to 20 (lowest priority).
  10. If you want to get the process priority by it’s PID, you can run the below command.
    ps -axo pid,ppid,%cpu,%mem,ni,command | grep 764
     764     1  14.6  1.9 -20 /System/Applications/Utilities/Activity Monitor
  11. The above command will show all the information ( includes the process priority, the ni column ) of the process identified by the process PID.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.