While it may be rare for your Mac to freeze or crash, you can set your system to automatically restart so that you don’t have to mess with it.
1. Click the Apple icon in the menu.
2. Select System Preferences.
3. In the Hardware section, select Energy Saver.
4. Check the Restart automatically if the computer freezes checkbox.