Skip to content

Instantly share code, notes, and snippets.

@vookimedlo
Last active June 13, 2024 16:07
Show Gist options
  • Save vookimedlo/c35d5d681d7798b5150330795ab43f4e to your computer and use it in GitHub Desktop.
Save vookimedlo/c35d5d681d7798b5150330795ab43f4e to your computer and use it in GitHub Desktop.
MacOS: mute & unmute from command line

Mute volume

osascript -e "set volume with output muted"

Unmute volume

osascript -e "set volume without output muted"

Is volume muted?

osascript -e "output muted of (get volume settings)"
@esbenboye
Copy link

Great solution - Short and to the point!
Thank you!

@geolaw
Copy link

geolaw commented Jan 13, 2023

I use the alt - m keystroke with skhd to mute/unmute via a bash script using these commands :

#!/bin/bash
current=$(osascript -e "output muted of (get volume settings)")
if [ "$current" == "true" ]; then
osascript -e "set volume without output muted"
else
osascript -e "set volume with output muted"
fi

@raminxp
Copy link

raminxp commented Jun 13, 2024

I use the alt - m keystroke with skhd to mute/unmute via a bash script using these commands :

#!/bin/bash current=$(osascript -e "output muted of (get volume settings)") if [ "$current" == "true" ]; then osascript -e "set volume without output muted" else osascript -e "set volume with output muted" fi

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment