Consider this scenario.
You’re reading a long-form article on your Mac while also jotting down some notes. You take your hands of the keyboard and mouse and lean back in your chair a little.
Five minutes pass and while you’re in the middle of reading a sentence your Mac screensaver is actived and breaks your flow.
This will pervent your Mac from going to sleep. The command will continue to run indefinitely and will block the current Terminal instance, so you’ll need to start a new Terminal tab/window if you need to continue to work in the Terminal.
caffeinate -t 600
-t flag to set an optional timout in seconds. The example above will prevent the Mac from sleeping for 10 minutes.
You can press
control + c at any time to cancel the command.