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 in just about every single version of Mac OS X ever to exist, here are the necessary commands:
Mute your Mac:
sudo osascript -e "set Volume 0"
sudo osascript -e "set Volume 10"
sudo osascript -e "set Volume 5"
Both 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.