Skip to main content

Command Palette

Search for a command to run...

Build a macOS Menu Bar App Using Python (Rumps) – Step by Step

- By Pratyush Mishra

Published
β€’3 min read
Build a macOS Menu Bar App Using Python (Rumps) – Step by Step
P

Do you need help with programming? You are not the only one. In this channel, we tackle gradual programming topics and end the videos on cool projects you can work on for practice to improve your skills on that given topic, step by step. Join us as we use fun and practical projects to grow our programming skills.πŸ˜ŠπŸ’».

macOS menu bar apps are lightweight, fast, and extremely useful for building productivity tools, automations, and system utilities.
While most developers assume you need Swift + Xcode, you can actually build native macOS menu bar apps using pure Python.

In this article, we’ll build a fully functional macOS menu bar app using Python and the rumps library, and I’ll explain how everything works step by step.


πŸŽ₯ Full Video Tutorial

If you prefer learning visually, I’ve explained the entire project line by line in this YouTube video:

πŸ‘‰ Watch the full tutorial:
https://youtu.be/Rc-mepbhrLo


🧠 What Is Rumps?

rumps stands for Ridiculously Uncomplicated macOS Python Statusbar Apps.

It is a Python library built on top of PyObjC, which allows Python to interact with native macOS APIs. Using rumps, you can:

  • Create menu bar (status bar) apps

  • Add clickable menu items

  • Show native notifications and alerts

  • Run lightweight background utilities

All without touching Swift or Xcode.


πŸ› οΈ Prerequisites

Before starting, make sure you have:

  • macOS

  • Python 3.8 or later

  • Basic knowledge of Python

Install dependencies:

pip install rumps pyobjc

🧩 Project Overview

Our menu bar app will include:

  • A menu bar icon

  • β€œSay Hello” notification

  • Checkbox toggle menu item

  • Native macOS alert dialog

  • Custom quit option

This structure is ideal for building real-world tools like timers, focus apps, or automation utilities.


πŸ§ͺ Complete Source Code

You can find the full working source code here:

πŸ‘‰ GitHub Repository:
https://github.com/Proxlight/My-Menu.git


πŸ§‘β€πŸ’» Complete Python Code

import rumps


class MyMenuApp(rumps.App):
    def __init__(self):
        super(MyMenuApp, self).__init__(
            name="MyMenu",
            title="🧠",
            quit_button=None
        )

        self.menu = [
            rumps.MenuItem("Say Hello"),
            rumps.MenuItem("Enable Feature"),
            None,
            rumps.MenuItem("Show Alert"),
            None,
            rumps.MenuItem("Quit App")
        ]

    @rumps.clicked("Say Hello")
    def say_hello(self, _):
        rumps.notification(
            title="Hello",
            subtitle="macOS Menu App",
            message="This app is built using Python & rumps"
        )

    @rumps.clicked("Enable Feature")
    def toggle_feature(self, sender):
        sender.state = not sender.state

    @rumps.clicked("Show Alert")
    def show_alert(self, _):
        rumps.alert(
            title="Alert",
            message="This is a native macOS alert from Python."
        )

    @rumps.clicked("Quit App")
    def quit_app(self, _):
        rumps.quit_application()


if __name__ == "__main__":
    MyMenuApp().run()

πŸ” Code Explanation (High Level)

Creating the App

We inherit from rumps.App, which represents a macOS menu bar application.

class MyMenuApp(rumps.App):

Initializing the Menu Bar

The title is what appears in the menu bar. Emojis work well for minimal UI.

super().__init__(name="MyMenu", title="🧠", quit_button=None)

Defining Menu Items

Each MenuItem becomes a clickable option.
None adds a separator line.

self.menu = [
    rumps.MenuItem("Say Hello"),
    rumps.MenuItem("Enable Feature"),
    None,
    rumps.MenuItem("Show Alert"),
    None,
    rumps.MenuItem("Quit App")
]

Handling Click Events

The @rumps.clicked() decorator binds menu items to functions.

@rumps.clicked("Say Hello")

Checkbox Toggle

Menu items can act like checkboxes using sender.state.

sender.state = not sender.state

Alerts and Notifications

Rumps provides native macOS dialogs:

rumps.notification(...)
rumps.alert(...)

πŸš€ What You Can Build Next

Once you understand this pattern, you can easily extend it to build:

  • Pomodoro or study timers

  • Clipboard managers

  • Focus mode toggles

  • System automation tools

  • Lightweight productivity utilities


πŸ“Œ Final Thoughts

Python is not just for scripts and backend services. With tools like rumps, you can build real native macOS applications quickly and cleanly.

If you’re interested in more Python + macOS projects, consider subscribing to the channel and exploring the GitHub repository.