How to create a Menubar application for Mac

Solution 1:

NSStatusItem is what you are looking for. Also add LSUIElement with string value of 1 to your Info.plist to hide it from Dock.

Solution 2:

I've found Codebox's Popup to be a great starting point. It is ripe for forking on Github.

enter image description here

Though it works nicely, they do note on their site...

P. S. In Lion, Apple is adding a new class for popovers like in iOS. So, after OS X 10.7 is released, you would better to rely on native Cocoa classes where it is possible. In other cases, the Popup project should still be usable.

Solution 3:

BitBar is an application on GitHub that can "Put anything in your Mac OS X menu bar".

It runs shell or other executable scripts (which it calls Plugins - see the many examples in the plugins repo) and displays the results in the menu bar. You can write your own plugin and have it run simply by adding it to the 'Plugins folder'. As well as displaying information, it can also run pre-defined bash scripts interactively from the plugin menus you define.

Since I first posted this answer it's popularity has exploded (52 contributors currently) and there is now even a distributable version with which you can package your own plugins.

A very simple (non-interactive) example to show live Bitcoin price:

enter image description here

Solution 4:

As Apple added NSStatusBarButton property to NSStatusItem in Yosemite, we can implement menubar app a lot simpler. I just created a sample project on github.

https://github.com/taichino/PopupTest