Configure macOS power management settings, as one might do in System Preferences > Energy Saver. Commands that modify settings must begin with sudo.

# To display the current power management settings:
pmset -g

# To display the current power source and battery levels:
pmset -g batt

# To set display to never sleep when on charger power:
sudo pmset -c displaysleep 0

# To set display to sleep after 15 minutes when on battery power:
sudo pmset -b displaysleep 15

# To schedule computer to automatically wake up every weekday at 9 AM:
sudo pmset repeat wake MTWRF 09:00:00

# To restore to system defaults:
sudo pmset -a displaysleep 10 disksleep 10 sleep 30 womp 1