On macOS you have the classical nice
command similar to linux to reduce the process priority. You can use it like this:
nice -n 20 myProcess
The priority can be adjusted over a range of -20 (the highest – the quickest) to 20 (the lowest – the slowest).
But you can go further and reduce also the disk IO. There is no ionice
command on macOS but you can use taskpolicy
as described in this article:
taskpolicy -b myProcess
With the 2 commands I was able to divide per 5 the speed of a process (it’s sometimes useful when you want to simulate a degradation of the runtime environment)
Baptiste Mathus on twitter proposed also a solution when you can use docker:
https://twitter.com/bmathus/status/1275437132417396740?s=21