> man caffeinate
EXAMPLE
caffeinate -i make
caffeinate forks a process, execs "make" in it, and holds an
assertion that prevents idle sleep as long as that process is
running.
THIS COMES PRE-INSTALLED IN MACOS!
I've always installed apps for this.