In this article we will talk about some Best Practices and baseline settings that are useful if you are running a 'headless' Mac mini server in the datacenter. 

Note that some of these settings are already done if you are renting a Mac with us, but it's always good to double check.

Most of these settings can be done via the GUI, but we will mention the Terminal commands here, so you can also automate this in your deploy scripts. 

Disable Spotlight indexing

Unless you are using the remote Mac as a desktop, you will likely not use the Spotlight search function often on the server. Spotlight can have a very bad impact on the server performance and we have seen a lot of cases where it interferes with other processes and affects stability of the server. Therefore, it is a good to just disable Spotlight indexing altogether. 

sudo mdutil -a -i off /
sudo mdutil -a -i off

Energy, sleep and boot settings

In order for remote reboot to work, the Mac will need to start itself after a 'power failure'. Furthermore, we want to disable all sort of sleep, hibernate and standby modes. In case you accidentally shut down your server, we set it to start automatically every morning. 

These settings are recommended to accomplish this. Make sure you run these after every OS upgrade as well, as sometimes the settings are lost! 

sudo systemsetup -setallowpowerbuttontosleepcomputer off
sudo pmset sleep 0
sudo pmset displaysleep 0
sudo pmset autorestart 1
sudo pmset womp 1
sudo pmset repeat wakeorpoweron MTWRFSU  07:00:00
sudo pmset -c powernap 0
sudo systemsetup -setcomputersleep Off
sudo pmset -a standby 0
sudo pmset -a disksleep 0
sudo pmset -a hibernatemode 0
sudo systemsetup -setrestartfreeze on
sudo defaults write /Library/Preferences/ loginWindowIdleTime 0

Disable WiFi and Bluetooth

We don't need WiFI and Bluetooth, so let's disable those

sudo networksetup -setnetworkserviceenabled Wi-Fi off
sudo networksetup -setnetworkserviceenabled "Bluetooth PAN" off
sudo networksetup -setnetworkserviceenabled "Bluetooth DUN" off

sudo defaults write /Library/Preferences/ ControllerPowerState '0' 
sudo defaults write /Library/Preferences/ BluetoothAutoSeekKeyboard '0' 
sudo defaults write /Library/Preferences/ BluetoothAutoSeekPointingDevice '0'