Keyboard shortcut to mute audio in OS X El Capitan? I can't find the default keybinding to mute the sound in OS X El Capitan. I just want the whole OS to be muted.

Running osascript -e "set Volume X" from the terminal is not what I want to do. Because I need to store the current volume somewhere and launch a script on a specific key. It just seems like wrong approach.

F10 and any combinations of it with Command or Control did not help.
Try toggling the F-key functionality in System Prefs > Keyboard > Keyboard

If your generic keyboard has no Mac-compliant  Fn  key, it may be your only solution. The hardware keys don't transmit in the same way as 'regular' keys.



This script works for Yosemite, but not El Capitan…

set myVolume to get volume settings
if output muted of myVolume is false then
    set volume with output muted
else
    set volume without output muted
end if


An additional possibility could be to switch to another Sound output, one that is currently silenced, like, for example, Digital Out.

From Using Apple Script to Manage Sound Output Selection

You could save this as a Service in Automator, then call it with a hot-key

(*
Applescript to toggle between two sound outputs by Line number, ¬
as they appear in the Sound Control Panel. Based on code by ¬
Arthur Hammer https://apple.stackexchange.com/a/209434/85275
*)

set outputA to 3 --change this to the actual 'line number' of your first desired output
set outputB to 4 --change this to the actual 'line number' of your second desired output
--the rest of the script will use these vales as a switch

tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.sound"
end tell


tell application "System Events"
    tell application process "System Preferences"
        repeat until exists tab group 1 of window "Sound"
        end repeat
        tell tab group 1 of window "Sound"
            click radio button "Output"
            if (selected of row outputA of table 1 of scroll area 1) then
                set selected of row outputB of table 1 of scroll area 1 to true
            else
                set selected of row outputA of table 1 of scroll area 1 to true
            end if
        end tell
    end tell
end tell
--tell application "System Preferences" to quit
--remove the comment '--' tag above to make the control panel quit afterwards, leave for testing.