What you need
- Multimeter for macOS 13 or later, $19.99 once.
- The direct download version of Multimeter from this site (the Script source isn’t in the Mac App Store version).
- Multimeter 1.1.1 or later. Earlier versions can’t ask macOS for permission to talk to other apps. Choose Check for Updates… from any meter’s menu.
- Apple Mail with at least one account set up.
Set it up
- Here’s the command. It asks Mail for the unread count of the Inbox, the one at the top of Mail’s sidebar that combines your accounts, and prints a placeholder when Mail isn’t running:Command
osascript -e 'if application "Mail" is running then' -e 'tell application "Mail" to return unread count of inbox' -e 'else' -e 'return "{\"value\": 0, \"formatted\": \"closed\"}"' -e 'end if' - In Multimeter, choose Add Meter… from any meter’s menu, pick Script and paste the command.
- Set Refresh every to 1 minute. Mail answers in well under a second, but there’s no reason to ask it more often, and 5 minutes is fine for a quieter inbox.
- Set the label to
MAIL, the range to 0 to 50, and alerts to High values with a warning at 10 and critical at 25 if you want the number to change color as mail piles up. - With Mail open, wait for the first refresh. macOS asks once: “Multimeter” wants access to control “Mail”. Allowing control will provide access to documents and data in “Mail”, and to perform actions within that app. Below it is Multimeter’s reason: “Multimeter runs your script meters, and scripts that read other apps (like Things, Reminders, Mail or Music) need your permission to control them.” Click Allow. Until you do, the meter shows a dash; the number appears at the next refresh, or right away with Refresh Now in the meter’s menu.
Multimeter settings
In Customize This Meter… (from the meter’s menu):
| Setting | Value |
|---|---|
| Source | Script |
| Command | the osascript line above |
| Refresh every | 1 minute or slower |
| Range | 0 to 50 |
| Alerts | High values: warning 10, critical 25 (optional) |
| Label | MAIL |
| Face | Label & Value or LCD Readout |
| Width | 120 pt for Label & Value |
Tested: Set up on October 31, 2026 in Multimeter 1.1.1 on macOS 27, with one test mail account holding 7 unread messages. macOS showed the Automation prompt with Multimeter’s reason at the first refresh; after Allow the menu bar showed MAIL 7 in Label & Value and LCD Readout. After 2 messages were marked read it showed MAIL 5 at the next refresh. With Mail quit, both meters showed closed and Mail stayed closed for the next two refreshes; reopening Mail brought back MAIL 5. The command took about half a second when run in Terminal.
Script meters need the direct download version of Multimeter from this site, which is the one on sale now. How commands run, the PATH they see and the 10 second limit are in the Script meters guide.
Limits
- Mail must be open. That’s on purpose: asking a closed Mail would launch it.
- The count is the Inbox only. Unread mail that rules moved to other mailboxes isn’t included; see the variation below for one mailbox.
- If Mail is set to show Categories, its Dock badge can count Primary only. This meter counts every unread message in the Inbox.
Variations
One account’s inbox
Replace inbox with the account’s mailbox. The account name is the one in Mail’s sidebar:
osascript -e 'if application "Mail" is running then' -e 'tell application "Mail" to return unread count of mailbox "INBOX" of account "Work"' -e 'end if'Notify me when mail arrives
Set alerts to High values with a critical level of 1 and turn on Notify me when it goes critical. Multimeter waits 15 minutes between notifications for the same meter, so a busy inbox won’t keep pinging you.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| The meter says closed | Mail isn’t running. The command skips Mail when it’s closed so it never launches it. | Open Mail. The number shows at the next refresh. |
| The meter shows a dash while Mail is open | Multimeter isn’t allowed to control Mail: you clicked Don’t Allow, or the question is still waiting on screen (the script stops after 10 seconds while it waits). | Answer the prompt if it’s open. If you turned it down, open System Settings, Privacy & Security, Automation, click the arrow next to Multimeter and turn on Mail. The next refresh shows the number. |
| Works in Terminal, nothing in the meter | Terminal and Multimeter each need their own permission. Allowing Terminal to control Mail doesn’t allow Multimeter. | Look for Multimeter, not Terminal, under System Settings, Privacy & Security, Automation, and turn on Mail there. |
| The script didn’t print a number | The command failed or printed an error message instead. | Run the exact command in Terminal. If it works there, check for tools that live outside the meter’s PATH and use their full path (which tool). |
| The script took longer than 10 seconds | A slow network call. Multimeter stops scripts after 10 seconds. | Keep the -m timeout on curl, and refresh less often. |
| Scripts need the version from multimeterapp.com | This copy of Multimeter came from the Mac App Store, which can’t run scripts. | Use the direct download version, or run the command from cron or launchd and point a File meter at its output. |
Questions
Does this work in the Mac App Store version?
Script meters need the direct download version from multimeterapp.com, because the App Store sandbox doesn’t let apps run your commands. Web Address, File and Sent Value meters work in every version.
Does Multimeter read my email?
No. The command asks Mail for one number, the unread count, and nothing else. macOS’s prompt describes the permission in general terms (“access to documents and data in Mail”) because it covers any script you might write; the one on this page reads only the count.
Why AppleScript and not my mail provider’s API?
Mail already knows the count for every account you’ve added, Gmail, iCloud, Exchange or your own server, so one line covers all of them without tokens or passwords.