Put a Mute button on the menu bar

Hi All, I’m a newbie and this is my first post.

I’m comfortable with programming but don’t know Applescript, I’ve searched this forum and tried the books with no luck so here’s my (simple?) question…

I want to put a button on my top menu bar that mutes/un-mutes audio when I click on it.

Could any kind folk point me in the right direction please?

Thank you.


the easiest way is to press F10 (or fn F10) :wink:
It is not possible to create a StatusMenuItem on the main menu bar with AppleScript.
This requires some Objective-C code

Thank you for replying Stefank. Unfortunately that is not an option as I’ve had to disable the function keys due to the Apple Remote Control bug interfering with Logic studio. (thats a long story!).

So it cant be done then?

What about with other methods? RealBasic, Cocoa?

Objective-C = Cocoa.

Search Google for Menulet, there are some tutorials

And thank you again Stefan. This is very helpful. So now I know what I ned to write - a Menulet!

So from what I gather XCode is the development environment for writing cocoa apps?

I trained in C many years ago so I should be able to work this out…hopefully!

Quick & Dirty


It contains the whole Xcode project

As a menulet has no GUI and you want to change the volume level by clicking on the menu item,
Mute.app can be terminated only by Terminal.app or Activity Monitor.app

Wow thank you Stefan, I’ll have a look when I get home. Back to work for now!

Many thanks!

Hi stefan, many thanks for doing this. I really appreciate it.

I built and ran it and and the icon appears in the menu, I can click on it and the volume goes to zero. So it looks close to what I need, but I notice it doesn’t acutely mute the sound but I think sets the volume to zero? Is it possible to change this to just toggle mute on/off? I ask since there is actually a difference between zero volume and mute on/off.

So far I haven’t figured out how to make it a stand alone app from xcode, as I’d like, when its finished, to have it as a log-in item. I’ll investigate xcode as to how to do this. I assume its some sort of compile command?

I guess there’s some sort of apple cocoa reference I can use to find the mute command?

Thank you once again.

In the popup menu “Active Build Configuration” select Release and press the Build button.
Then you can find the app in ./Mute/Build/Release

It’s probably included in CoreAudio.Framework as well as the “setVolume” API

Thank you again for helping me Stefan, but I’ve no idea what the above means!! But I’ll go and study it!

How about using:

set volume without output muted
set volume with output muted

In Objective-C

NSString *applescript = @"set volume without output muted";
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:applescript];
[script executeAndReturnError:nil];

I haven’t looked at the CoreAudio.Framework, so like Stefan said, there is probably a way to do it from there as well. Also, the CoreAudio implementation will be faster. There will be a slight delay using the AppleScript version.

This is the CoreAudio version of Mute with “real” muting

Thanks Guys, I need to explain; its a couple of decades since I programmed and that was in C and on PCs so Im a complete novice on macs, so craig I understood what you wrote but have no idea what to do with it!

But thank you anyway. I do appreciate it.

Perhaps someone could point me at a really good beginners tutorial (preferably video based)?

Have you tried my lastest version in the post above? “Mute” is a link

[script release];


oops sorry Stefan, didn’t realise there was a link in that post!

Tried it but it doesn’t work at all !

I’ve no idea what Martins comment means!

Of course you have to compile the code first. I posted the source code as you mentioned you are experienced in programming.


Martin’s comment means: Do your memory management homework :wink:

Thank Stefan,
I think its better to say i WAS experienced in programming!! :lol:

I did compile it and the ‘notes’ icon appears in the bar but when I click or double click on it nothing happens.