This may be a bit of a easy question, but I couldn't find anything about it after googling a bit, sorry!

Is there any way to make a command use both of my CPU cores? I am currently processing some PDF files using GhostScript, but whenever I run the command in the terminal, it uses only around 100% of my CPU. I have to run two instances of it to get it to use 200% of my CPU and thus be twice as fast. Even then, for some reason, 40% of my CPU is "idle," according to Activity Monitor, which may imply that I can run more instances.

Is there a way to make this GhostScript command use all of my CPU to be as fast as possible, without having to manually run multiple instances of the command?


Depending on the number of PDFs you have to process and the nature of the tasks, you may consider installing GNU parallel in brew.

GNU parallel allows you to execute several jobs concurrently. Example:

parallel ::: yes > /dev/null yes > /dev/null

An example script (containing small errors e.g. line 13 should start with find instead of ind!) how to use parallel and ghostscript can be found here: Quick shell script for parallel OCR on PDFs using ghostscript and tesseract

Please also check the extensive man pages of parallel.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .