Syntax taskpolicy [-d policy] [-g policy] [-c clamp] [-b] [-t thruput_tier] [-l latency_tier] [-a] [-s] program [arg1 [...]]
taskpolicy [-b|-B] [-t thruput_tier] [-l latency_tier] [-p pid] Key -a Run the program with the resource management policies given to applications. -b Downgrade an existing process (specified with -p) to run in the background. Runs the program after calling setpriority(2) with a priority of PRIO_DARWIN_BG. -B Removes the specified process from running in the background. On Apple silicon, the process may now run on the efficiency or performance cores. This only works on processes that have been downgraded to the background, and not processes that started in the background. Move target process out of PRIO_DARWIN_BG. -c clamp Run the program using the specified QoS clamp. The argument can be either "utility", "background", or "maintenance", which is interpreted case-insensitively. -d policy Run the program after calling setiopolicy_np(3) with an iotype of IOPOL_TYPE_DISK, a scope of IOPOL_SCOPE_PROCESS, and the specified policy. The argument can either be an integer, or a symbolic string like "default" or "throttle", which is interpreted case-insensitively. -g policy Run the program after calling setiopolicy_np(3) with an iotype of IOPOL_TYPE_DISK, a scope of IOPOL_SCOPE_DARWIN_BG, and the specified policy. The argument is interpreted in the same manner as -d. -l Set latency tier of the process to latency_tier. -p pid Change settings for the process specified by pid. -s Run the given command in the suspended state. This is useful to allow a debugger to attach to the process right at the start of execution. (calls posix_spawnattr_setflags(3) with POSIX_SPAWN_START_SUSPENDED). -t Set throughput tier of the process to thruput_tier.
The taskpolicy program uses the setiopolicy_np(3) and setpriority(2) APIs to execute a program with altered I/O or scheduling policies.
All children of the specified program also inherit these policies.
There are two types of CPU core in Apple’s M1 chips which are used by different types of software:
taskpolicy has some limitations in its ability to promote or demote the type of core processes your threads will run on, read more about this here.
Promote pid #64 to run on both E and P cores:
$ taskpolicy -B -p 64
Demote pid #64 to run only on E cores:
$ taskpolicy -b -p 64
“Money will buy a pretty good dog, but it won’t buy the wag of his tail” ~ Henry Wheeler Shaw
Local man page: taskpolicy - Command line help page on your local machine.
bg - Send to background.
fg - Send job to foreground.
jobs - List active jobs.