Home » Questions » Computers [ Ask a new question ]

Is there any way to set the priority of a process in Mac OS X?

Is there any way to set the priority of a process in Mac OS X?

I have a background process running at 100% CPU on Mac OS X. All other applications are very slow because of it.

Asked by: Guest | Views: 419
Total answers/comments: 4
Guest [Entry]

"From the command line (Terminal.app or whatever) use nice and renice, just like on other unixes.

Use nice when launching a process:

nice -n <priority> <command> <arguments to command>

The default priority is zero, positive values are ""nicer"" (that is lower priority) and negative values are ""less nice"" (higher priority). Looks like Mac OS runs from +10 to -10.

Use renice to change the priority of a process already running (from the renice man page on 10.5):

renice priority [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]
renice -n increment [[-p] pid ...] [[-g] pgrp ...] [[-u] user ...]

The part you're interested in here is the pid bit. That is the process id for the job and you can find it using ps -u <your username> and looking for the process name, but I prefer top -o in this case, because the process you're interested in will be near the top.

Note: Without superuser privileges you can never increase a process's priority. For normal users, nice and renice are one way streets. And small changes in priority can have large effects on running time. So go easy on this until you understand it."
Guest [Entry]

"renice 20 $(pgrep ImageOptim)

Or use the name of your program instead of ImageOptim"
Guest [Entry]

You can set the nice value (priority) for the daemon permanently using the variable in the PLIST file for the app. To find out how type MAN plist in a terminal window.
Nipfzi [Entry]

lipitor 40mg without prescription <a href="https://lipiws.top/">atorvastatin uk</a> order lipitor pill