Skip to content

Instantly share code, notes, and snippets.

@vookimedlo
Last active February 23, 2024 12:17
Show Gist options
  • Star 11 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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

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