If you need a way of preventing your Mac from going to sleep whilst it performs a specific task or utility, Brett Terpstra explains how to use the Mac OS X command caffeinate
to do just this.
Many apps don't offer a built-in option to prevent the Mac from going to sleep so if you're often changing your Mac's Energy Saver preferences, it's a great tip to know.