Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Switchfoot

macrumors member
Original poster
Oct 8, 2004
88
31
Does anyone know of a way to mute an app from the Terminal command line? What I want to do is be able to type "ps" or "top" or something and be able to say something like "mute pid#". Is something like this possible?
 
I did a quick Google search, and didn't find anything that worked. But if you'd like to know, you can use the "say'' command to make your computer talk to you. That and xDoctor are all I need for a whole night of fun. :D
 
For a specific application that has an AppleScript volume command, you can use something like this:
Code:
tell application "iTunes"
        set the sound volume to 40
end tell
Otherwise, I think you'd have to apply a system-wide mute operation, which can be done with this Terminal command:
Code:
/usr/bin/osascript -e 'set volume 0'
 
This will only work if you have 10.3.5 I belive. It's basically just an apple script and if you use Doctor Q's method this should work in the command line or you can just make a script out of it. If you don't have 10.3.5 go with one of the other suggestions. A note about this is that it works like the mute button on the keyboard or the check box in system prefs, so if you unmute it, the volume will automatically go back to where it was.

set volume output muted 1

and to undo this it would be

set volume output muted 0

hope this helps
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.