Monitor S.M.A.R.T. Status on a Mac as a Home Server

with smartmontools

Install smartmontools with Homebrew:

$ brew install smartmontools

Edit smartd.conf, comment out everything and add your configs, example:

/dev/disk0 -R 5! -m
/dev/disk1 -R 5! -m

Which means monitor disk0 and disk1, send an email to when any error occurs or when "Reallocated Sector Count" changes. Note that DEVICESCAN doesn't work on my Hackintosh. Make sure you test smartd in debug mode before deploying. Look up the documentation for details.

Add a plist file org.smartmontools.smartd.plist to /Library/LaunchDaemons with content to launch smartd on startup:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

The default interval is 30 minutes, it can be changed with -i option.

You'll receive an email from [user]@[hostname].localdomain if there's an error.

P.S. macOS does not support diagnosing external drives with S.M.A.R.T. technology. A driver is needed for external drives.