MoonPoint Support Logo

 

Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals



Advanced Search
February
Sun Mon Tue Wed Thu Fri Sat
  5
         
2016
Months
Feb


Fri, Feb 05, 2016 4:07 pm

Muting audio on OS X from a Terminal window

If you want to check or set audio settings, such as the volume level or whether sound is muted, from a command line interface (CLI), aka "shell prompt", on an Apple OS X system, you can do so by using Apple's AppleScript scripting language utility, osascript.

To check the current volume setting, you can use the following command:

$ osascript -e 'output volume of (get volume settings)'
54

To check whether audio is muted, use the following command:

$ osascript -e 'output muted of (get volume settings)'
false

To mute the audio so no sound will be heard:

$ osascript -e 'set volume output muted true'
$ osascript -e 'output muted of (get volume settings)'
true

The osascript -e 'set volume output volume x', where x is a number between 0 and 100, can be used to change the sound level, i.e., to make the sound softer or louder:

$ osascript -e 'output volume of (get volume settings)'
54
$ osascript -e 'set volume output volume 25'
$ osascript -e 'output volume of (get volume settings)'
25

You can provide a number less than zero or more than 100 when issuing the set command, but the volume setting will never be less than 0 nor more than 100.

$ osascript -e 'set volume output volume -1'
$ osascript -e 'output volume of (get volume settings)'
0
$ osascript -e 'set volume output volume -25'
$ osascript -e 'output volume of (get volume settings)'
0
$ osascript -e 'set volume output volume 105'
$ osascript -e 'output volume of (get volume settings)'
100

If sound is muted and you change the volume level, then it will be unmuted.

$ osascript -e 'output muted of (get volume settings)'
false
$ osascript -e 'set volume output muted true'
$ osascript -e 'output muted of (get volume settings)'
true
$ osascript -e 'set volume output volume 55'
$ osascript -e 'output muted of (get volume settings)'
false

[/os/os-x] permanent link

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo