How to Install xbar and Put Script Output in Your macOS Menu Bar

Updated

xbar is a free, open-source macOS app that puts the output of any executable script or program into your menu bar. To get started, download xbar from xbarapp.com, install it, then either add a pre-built plugin from the built-in directory or drop your own script into the xbar plugin folder. Your script's first line of output becomes the menu bar title, and each additional line becomes a dropdown menu item. The steps below cover installation, using pre-built plugins, writing your own, and fixing a plugin that doesn't show up.

Install xbar and confirm it's running

  1. Go to xbarapp.com and click Download xbar for macOS.
  2. Open the downloaded file and move xbar to your Applications folder, then launch it.
  3. Look at the right side of your menu bar. xbar runs as a menu bar item rather than a Dock app, so the app's own icon appearing there is your confirmation that it launched.
  4. Click the xbar icon to open its menu. This is where you manage plugins and preferences.

If macOS blocks the first launch because the app wasn't downloaded from the App Store, open System Settings → Privacy & Security and allow it to open.

Add a pre-built plugin

xbar ships with access to hundreds of pre-built plugins organized by category. The site lists categories including AWS Cloud, Cryptocurrency, Dev, E-Commerce, Email, Environment, Finance, Games, IoT, Lifestyle, Music, Network, Politics, Science, Sports, System, Time, Tools, Travel, Weather, and Web.

  1. From the xbar menu, open the plugin browser (the option to browse or add plugins).
  2. Pick a category, for example Network or System.
  3. Select a plugin and install it. xbar places the plugin file in its plugin folder and starts running it.
  4. The plugin's output should appear in your menu bar within one refresh cycle. Click it to see the dropdown details.

Examples from the directory give a sense of what to expect: a Network Info plugin shows internal and external IPv4/IPv6 addresses, Whois information, and Speedtest.net results; a Battery Apple Bluetooth Trackpad plugin shows the trackpad's battery percentage; and a Simple RSS reader lists the latest feed items with links.

Write your own plugin

Any executable script or program works, in any language. The key rules are about output format and file placement.

Output format

  • First line → the text shown in the menu bar.
  • Each following line → a dropdown menu item.
  • A line containing only --- creates a separator in the dropdown.

A minimal example in Python:

#!/usr/bin/env python3
print("Hello")
print("---")
print("This is a menu item")

The menu bar shows Hello, and clicking it reveals a separator and the item "This is a menu item."

File placement and naming

  1. Make the script executable, for example chmod +x myscript.py.
  2. Place it in the xbar plugin folder. You can open this folder from the xbar menu.
  3. Name the file so xbar knows how often to refresh. The filename includes a refresh interval, for example myscript.1m.py refreshes every minute, and myscript.5m.sh every five minutes. The extension tells xbar which interpreter to use.
  4. xbar picks up the file and runs it on that schedule. If the output doesn't appear immediately, wait for the first refresh or trigger a manual refresh from the menu.

The site links a Writing plugins guide and notes plugins can be written "in any language," so check that guide for the current naming and formatting conventions before publishing a plugin.

Troubleshoot a plugin that doesn't appear

Symptom Likely cause Check
No menu bar item at all Script isn't executable or isn't in the plugin folder Run chmod +x and confirm the file sits in the xbar plugin folder
Item appears but dropdown is empty Only one line of output Add more print lines; each line after the first becomes a menu item
Output never updates Refresh interval missing or too long Include an interval in the filename (e.g. .1m.) and wait one cycle
Script errors silently Interpreter or path problem Run the script manually in Terminal first to confirm it produces output

Testing the script in Terminal before adding it to xbar is the fastest way to separate script problems from xbar configuration problems.

What to know before you rely on it

xbar is MIT-licensed and the site asks users who find it useful to sponsor the project on GitHub; the page does not state pricing terms beyond that, so check the download and GitHub pages for current details. The site lists version v2.1.7-beta as of its last update, so expect beta-level behavior in some releases. Because plugins run arbitrary scripts on a schedule, only install plugins from sources you trust, and review a script's contents before adding it.