Change the System Volume from the Command Line in Mac OS X
There are several ways to go about changing the volume on your Mac, but did you know you can use the command line? I’m a big command line junkie so the more things I can do from the Terminal the better.
If you want to adjust your system volume level directly from the command line, you can do so with the ‘osascript’ command, which is basically a terminal front-end to AppleScript and all that it can do.
For the purposes of changing system volume via Terminal in just about every single version of Mac OS X ever to exist, here are the necessary commands:
Mute your Mac:
This turns volume to 0, effectively muting the Mac speaker output:
sudo osascript -e "set Volume 0"
This sets the volume to the highest it will go:
sudo osascript -e "set Volume 10"
This is about midrange audio output:
sudo osascript -e "set Volume 5"
Each of these commands will ask for your root password because of the usage of ‘sudo’ which runs the osascript command as the administrator.
As you may have guessed, you can fill in other numbers in place of 0 and 10 for other sound levels too. Try it out yourself, or choose a number that works for the speaker volume you are aiming for.