How to Configure macOS smartd (S.M.A.R.T. Daemon) for Predictive NVMe Failure Alerts

The transition from spinning mechanical hard drives to solid-state NVMe storage brought monumental performance increases to macOS. However, it also fundamentally changed how drives fail. When a mechanical HDD was dying, it would audibly click, read/write speeds would drop noticeably, and the OS would often hang—giving the user time to back up their data. NVMe drives, conversely, degrade silently. When the NAND flash finally exhausts its write cycles or the controller fails, the drive frequently dies instantly, without any auditory warning, resulting in total data loss.

While macOS Disk Utility provides a basic “S.M.A.R.T. Status: Verified” check, it is a binary, point-in-time assessment. It does not actively monitor the drive, nor does it alert you when internal error counters begin to rise dangerously high.

To proactively defend against catastrophic drive failure, systems administrators must deploy smartd (the S.M.A.R.T. Daemon) from the open-source smartmontools suite. This daemon runs continuously in the background, aggressively interrogating the NVMe controller’s health logs, and can automatically execute shell scripts (like sending a Slack webhook or an email) the moment the drive registers a predictive failure anomaly.

This guide explains how to install, configure, and automate smartd on macOS.

Understanding S.M.A.R.T. on NVMe

Self-Monitoring, Analysis and Reporting Technology (S.M.A.R.T.) operates differently on NVMe than it did on SATA drives.

Instead of relying on arbitrary vendor attributes (like “Spin Up Time”), the NVMe specification mandates a standardized Health Information Log. smartd reads this log directly from the PCIe bus, tracking critical metrics such as:

  • Available Spare: The percentage of reserved NAND blocks remaining. If this drops below the threshold, the drive is dying.
  • Percentage Used: An estimation of the drive’s life based on TBW (Terabytes Written).
  • Media and Data Integrity Errors: The number of times the controller detected unrecoverable data corruption. This should absolutely be zero.

Step 1: Installing smartmontools

Because Apple heavily restricts direct hardware access, macOS does not ship with an aggressive hardware polling daemon. You must install the industry-standard smartmontools suite via Homebrew.

Open the macOS Terminal and install the package:

brew install smartmontools

Verify that the tools can communicate with your internal Apple NVMe drive (usually located at /dev/disk0):

sudo smartctl -a /dev/disk0

You should see a comprehensive readout of the NVMe Health Information Log, including the exact critical warning counters.

Step 2: Configuring the smartd Daemon

The smartctl command is for manual checks. To enable continuous monitoring, we must configure smartd.

The configuration file is located at the Homebrew prefix path:

sudo nano /usr/local/etc/smartd.conf

(Note: On Apple Silicon Macs, the Homebrew path is /opt/homebrew/etc/smartd.conf).

By default, the file contains the DEVICESCAN directive. We will replace this with a strict, explicit rule for the primary drive.

Clear the file and add the following configuration:

/dev/disk0 -a -m [email protected] -M exec /usr/local/bin/smartd-alert.sh -s (S/../.././02|L/../../6/03)

Breaking down this syntax:

  • /dev/disk0: Explicitly targets the internal macOS SSD.
  • -a: Monitors all standard NVMe health attributes.
  • -m [email protected]: The email address to alert (ignored if using a custom script, but required by syntax).
  • -M exec /usr/local/bin/smartd-alert.sh: Instead of using the local mailer (which is disabled on modern macOS), execute a custom shell script when an error is detected.
  • -s (S/../.././02|L/../../6/03): Schedules automatic Self-Tests. A Short test (S) runs every day at 2:00 AM. A Long test (L) runs every Saturday at 3:00 AM.

Step 3: Creating the Alert Script

Create the bash script that smartd will execute when it detects an impending failure.

sudo nano /usr/local/bin/smartd-alert.sh

You can configure this script to trigger an enterprise alerting system (like PagerDuty) or a Slack webhook. Here is a basic Slack payload example:

#!/bin/bash
# The smartd daemon passes the error message as an environment variable $SMARTD_MESSAGE

WEBHOOK_URL="https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
HOSTNAME=$(hostname)

curl -X POST -H 'Content-type: application/json' --data '{"text":"🚨 *CRITICAL NVMe ALERT on '$HOSTNAME'* 🚨\n'"$SMARTD_MESSAGE"'"}' $WEBHOOK_URL

Make the script executable:

sudo chmod +x /usr/local/bin/smartd-alert.sh

Step 4: Registering smartd with launchd

To ensure smartd runs continuously in the background and survives reboots, we must register it as a root daemon with macOS launchd.

Homebrew provides the service file automatically. Start the service with root privileges:

sudo brew services start smartmontools

Verify that the daemon is actively running and polling the drive:

sudo grep smartd /var/log/system.log

You should see entries indicating that smartd successfully started, parsed the smartd.conf file, and registered the monitoring routines for /dev/disk0.

Conclusion

Relying on the native macOS Disk Utility to warn you about impending solid-state drive failure is a dangerous gamble. By deploying the smartd daemon, macOS power users and systems administrators can aggressively monitor the low-level PCIe health counters of their NVMe storage, ensuring they receive automated, real-time alerts the moment the hardware begins to exhibit anomalous behavior, allowing for critical data backup before total failure occurs.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.