Checking whether a local dev server is up, running a quick command to see your active Git branch, or hunting through browser tabs for a staging dashboard takes only seconds once - yet repeating those checks dozens of times a day breaks focus.

SwiftBar puts that status right into the top macOS menu bar. A compact label like DEV Running sits in the bar, and clicking it expands a dropdown with check timestamps or clickable links. Any script that prints plain text works without building a native macOS app.

Below, we build a minimal date plugin first and then expand into a live local dev-server monitor, cross-checking setup details against the official SwiftBar documentation .

How Script Output Becomes a Menu Bar Item

In SwiftBar, a plugin is simply an executable file that prints menu lines. Here we use standard .sh Bash scripts supported out of the box on macOS.

When you run echo "Task Status" in a terminal, it prints text to standard output (stdout). SwiftBar reads that stdout stream and turns it into a menu bar label plus a dropdown menu:

DEV Running
---
URL: http://localhost:3000
Checked at: 09:30:00

Everything above the first --- becomes the menu bar Header, and everything below it forms the clickable dropdown Body. In this example, DEV Running stays visible in the menu bar while the URL and timestamp appear when clicked.

Because menu bar width is tight, keep the header to a single short line and push details into the dropdown body. Printing multiple lines above --- makes SwiftBar cycle through them as rotating titles, so stick to one line when starting out.

Installing SwiftBar and Choosing a Dedicated Plugin Folder

With Homebrew installed, run:

brew install --cask swiftbar

Both the current Homebrew cask formula and official README require macOS Monterey 12 or later (updated from older guides citing macOS 11+), so verify your macOS version first.

Launch SwiftBar from /Applications. On first launch, it asks for a Plugin Folder where it will scan for executable scripts. Create a dedicated directory in your home folder and select it:

mkdir -p "$HOME/SwiftBarPlugins"

All examples below save files inside $HOME/SwiftBarPlugins; adjust paths if you choose another directory.

Keeping the plugin folder dedicated avoids surprises: SwiftBar traverses subdirectories and symbolic links, so pointing it at an entire code repository can accidentally execute unrelated scripts. Hidden directories are ignored automatically, and you can exclude specific files via .swiftbarignore.

Writing Your First Date and Time Plugin

Start with a zero-dependency script to verify folder wiring and output syntax.

Encoding Refresh Intervals in the Filename

Create date.1m.sh inside SwiftBarPlugins. SwiftBar filenames follow a three-part pattern:

date.1m.sh
name.interval.extension

date names the plugin, 1m tells SwiftBar to re-run it every 1 minute, and .sh marks a shell script. Supported refresh units include:

UnitMeaningExample Filename
msMillisecondssample.500ms.sh
sSecondsdevserver.10s.sh
mMinutesdate.1m.sh
hHoursweather.1h.sh
dDayslinks.1d.sh

Note that 500ms above illustrates filename syntax rather than a recommendation to poll external APIs twice a second.

Writing the Date Script

Open date.1m.sh in a code editor and save it as plain UTF-8 text (making sure your editor does not silently append .txt):

#!/bin/bash

/bin/date '+%m/%d %H:%M'
echo '---'
echo "Today: $(/bin/date '+%Y-%m-%d')"
echo "Last check: $(/bin/date '+%H:%M:%S')"
echo 'Refresh now | refresh=true'

#!/bin/bash selects the Bash interpreter, /bin/date formats the current system clock, and $(...) substitutes command output inline.

The first date line sets the menu bar title, echo '---' starts the dropdown, and refresh=true on the final item tells SwiftBar to re-run the script immediately when clicked. Because the schedule runs once per minute, Last check shows the last execution timestamp rather than a live-ticking second hand.

Verifying Output in the Terminal

Mark the script executable and run it directly in your terminal first:

chmod +x "$HOME/SwiftBarPlugins/date.1m.sh"
"$HOME/SwiftBarPlugins/date.1m.sh"
echo "Exit code: $?"

Although SwiftBar grants execute permissions to new plugins by default, running chmod +x and testing in the terminal verifies both permissions and stdout formatting up front:

10/27 09:30
---
Today: 2026-10-27
Last check: 09:30:00
Refresh now | refresh=true
Exit code: 0

Exit code: 0 comes from your terminal check (reading $? right after execution) rather than the plugin file itself. Once SwiftBar picks up the file, the date appears in your menu bar; if not, confirm SwiftBar is running, check your Plugin Folder path, or trigger a manual reload:

open -g 'swiftbar://refreshallplugins'

Adding Colors, Icons, and Click Actions with Pipe Parameters

Appending | key=value attributes to any output line customizes appearance and click behavior (separating multiple attributes with spaces):

echo 'DEV Running | color=green sfimage=checkmark.circle'
echo '---'
echo 'Open in Browser | href=http://localhost:3000'
echo 'Check Status Now | refresh=true'

This renders green text paired with a native macOS SF Symbols icon (sfimage), opens http://localhost:3000 when clicking Open in Browser, and re-runs the check on Check Status Now.

Commonly used parameters include:

ParameterPurposeExample
colorSets label text colorcolor=green
sfimageRenders an SF Symbols iconsfimage=checkmark.circle
tooltipShows hover texttooltip=localhost:3000
hrefOpens a URL on clickhref=http://localhost:3000
refreshRe-runs the plugin on clickrefresh=true
bashExecutes a binary or script on clickbash=/usr/bin/open
terminalControls whether bash opens a Terminal windowterminal=false

Because | sits inside single quotes here, the shell prints it literally as SwiftBar’s attribute separator rather than piping commands.

To run a local command on click, pass an absolute executable path to bash and supply arguments via param1, param2, and so on:

echo 'Open Applications Folder | bash=/usr/bin/open param1=/Applications terminal=false'

Monitoring a Local Dev Server from the Menu Bar

Now let’s monitor whether a local dev server is listening on TCP port 3000 (http://localhost:3000). Save devserver.10s.sh inside SwiftBarPlugins (updating 3000 if your server binds another port):

#!/bin/bash

if /usr/sbin/lsof -nP -iTCP:3000 -sTCP:LISTEN >/dev/null 2>&1; then
  echo 'DEV Running | color=green sfimage=checkmark.circle'
else
  echo 'DEV Stopped | color=gray sfimage=pause.circle'
fi

echo '---'
echo 'Target: TCP port 3000'
echo "Last check: $(/bin/date '+%H:%M:%S')"
echo 'Open in Browser | href=http://localhost:3000'
echo 'Check Status Now | refresh=true'

/usr/sbin/lsof checks whether any process is actively listening on TCP port 3000, while >/dev/null 2>&1 discards raw lsof output so stray lines do not corrupt the dropdown menu.

Make it executable and test it once in the terminal:

chmod +x "$HOME/SwiftBarPlugins/devserver.10s.sh"
"$HOME/SwiftBarPlugins/devserver.10s.sh"

With .10s. in the filename, SwiftBar polls every 10 seconds, so starting or stopping your server can take up to 10 seconds to reflect unless you click Check Status Now.

Keep the scope of this check in mind: it only verifies that a process is listening on TCP port 3000. Another program could occupy that port, or your server could accept sockets while returning HTTP 500 errors. For full application health checks, extend the script with curl against a health endpoint and inspect the HTTP status code.

Extending the Pattern to Everyday Dev Tasks

Swapping out the status command adapts the same structure to other daily checks:

Use CaseMenu Bar HeaderDropdown Body
Git branchActive branch of a target repoRepo path and quick links
Disk spaceFree space or usage % on a target volumeTotal capacity and mount path
API healthPass/fail status of last probeHTTP status code and check timestamp
Deployment bookmarksShort project labelProduction, staging, and CI dashboard URLs

Static bookmark menus need zero polling logic - save links.1d.sh with your team’s real URLs:

#!/bin/bash

echo 'Project Links'
echo '---'
echo 'Production | href=https://example.com'
echo 'Staging | href=https://staging.example.com'
echo 'CI Dashboard | href=https://ci.example.com'

Note that a static link menu does not probe deployment health; seeing the project name in the bar only provides quick navigation. Match refresh intervals to how often data changes - daily (1d) for static bookmarks, seconds (10s) for local ports, and explicit request timeouts plus conservative intervals whenever calling external APIs to save battery and rate limits.

Troubleshooting Missing or Broken Menus

When a plugin misbehaves, run the script directly in Terminal first to separate command errors from SwiftBar formatting issues:

SymptomWhat to Check First
Item never appears in menu barSwiftBar running state, Plugin Folder path, filename format, and execute bit
Script runs with empty outputWhether every if/else branch prints a header line (empty stdout hides the plugin)
Raw command output floods dropdownRedirecting helper command stdout/stderr away from echo menu lines
Works in Terminal, fails in SwiftBarUsing absolute binary paths (/opt/homebrew/bin/...), env vars, and macOS permissions
Stale status persistsFilename interval suffix, Last check timestamp, and manual refresh behavior
Menu bar shows an error iconDropdown Error details and SwiftBar logs in macOS Console.app

Standard plugins run, emit stdout, and exit; if a script exits 0 with empty stdout, SwiftBar hides it from the menu bar, and any debug logs should go to stderr so they do not pollute menu items. Also remember GUI apps do not inherit your interactive shell PATH, which is why the scripts above use /bin/date and /usr/sbin/lsof (use command -v tool-name in Terminal to find paths for Homebrew binaries).

Start with the 1-minute date script to confirm your folder setup, then add one high-frequency local check with a short status header and links tucked neatly into the dropdown.

Reference: SwiftBar beginner and practical guide on Tistory , with system requirements and plugin behavior verified against official SwiftBar documentation.