opensourceprojects.dev

A broadsheet for software that doesn't ask for your email

Custom macOS menu bar programs in three easy steps, no third step
GitHub RepoImpressions2

Project Description

View on GitHub

Build Custom macOS Menu Bar Apps With Just a Shell Script

You've got a shell script that fetches some data you care about—build status, server health, the weather, whatever. Wouldn't it be nice if that output just lived in your macOS menu bar instead of a terminal window you keep forgetting to check? That's exactly the problem SwiftBar solves, and it does it with a shell script and one extra step you don't even have to think about.

What It Does

SwiftBar is a macOS application that turns executable scripts into menu bar programs. The entire premise is right there in the tagline: write a shell script, add it to SwiftBar, and there is no third step. When SwiftBar detects a new file in your designated Plugin Folder, it makes the file executable if needed and runs it. The script's standard output becomes what you see in the menu bar and its dropdown menu.

The architecture is deliberately simple. A plugin is just an executable script in whatever language you want—shell, Python, Ruby, you name it. SwiftBar parses the script's output into two blocks: a Header that controls what appears in the menu bar itself, and a Body that populates the dropdown menu contents. Errors go to standard error, output goes to standard out, and SwiftBar handles the rest. It runs on macOS Monterey (12) and later.

The plugin API is adopted from BitBar and xbar, which means SwiftBar can run any existing BitBar or xbar plugin without modification. That's a meaningful detail—there's an entire ecosystem of plugins already written that you can drop in and use immediately.

Why It's Cool

The naming convention is genuinely clever. Plugin files follow the format {name}.{time}.{ext}, where the time portion encodes the refresh interval. A file named date.1m.sh refreshes every minute. Want something every three hours? Name it something.3h.sh. The duration modifiers cover milliseconds, seconds, minutes, hours, and days. Your refresh schedule is baked into the filename instead of buried in a config file, which means you can look at a directory listing and immediately understand what's running and how often.

It meets you where you already are. You don't need to learn Swift or Xcode or any macOS-specific framework. If you can write a script that prints to stdout, you can build a menu bar app. That's a remarkably low barrier to entry for something that used to require actual application development.

The Plugin Folder is flexible in ways you'd want it to be. Nested folders are traversed, including symlinks, so you can organize your plugins however makes sense. Hidden folders are ignored. There's even support for a .swiftbarignore file to exclude specific files from being imported. And if you want to hide a folder from the system, you can prepend a dot or use chflags hidden.

Reorder your menu bar the way you'd expect. Plugins initially appear in no particular order, but you can hold Cmd and drag them to rearrange. That position gets remembered—unless you rename the plugin file, in which case you'll need to reposition it. It's a small detail, but it respects how people actually want to manage their menu bar space.

There's a plugin repository built in. You don't have to write everything yourself. SwiftBar bundles a Plugin Repository accessible through the "Get Plugins..." menu item, and you can also pull from the well-known BitBar plugin repository. Between the two, there's a good chance someone's already built what you need.

How to Try It

Getting started is straightforward. You can download from GitHub Releases or use Homebrew:

brew install swiftbar

Once installed, launch SwiftBar and it'll ask you to set your Plugin Folder on first run. Every file in that folder gets imported as a plugin, so pick a directory you're comfortable filling with scripts.

To create your first plugin, write an executable script and drop it in that folder with the naming format {name}.{time}.{ext}. For example, date.1m.sh would refresh every minute. SwiftBar makes the file executable if it isn't already, runs it, and displays the output.

If you'd rather build from source, clone the repository, open SwiftBar/SwiftBar.xcodeproj, and press play. The whole project is at github.com/swiftbar/swiftbar.

For plugins, check the bundled repository via SwiftBar's menu, or browse the BitBar plugin collection for inspiration and ready-made options.

Final Thoughts

SwiftBar is for anyone who's ever wanted a piece of information permanently visible without opening a terminal or a dashboard. The three-step pitch is accurate—there really isn't a third step, and that's the point. It's best suited to developers and power users who are comfortable writing scripts and want a lightweight way to surface their output. If you've got a script lying around that checks something important, you're about ten minutes away from having it live in your menu bar.

Back to Projects
Project ID: a8049b1c-fc4f-4448-8e9a-6e8809610421Last updated: September 25, 2026 at 02:50 AM