Set Output Volume from the Terminal with osascript

AppleScript's set volume command gives you precise 0–100 output volume control from the shell — handy in scripts.

macOSaudioosascriptvolumeLow risk
Run `osascript -e 'set volume output volume 40'` to set the speaker volume to 40%.

01Command

Command
$ osascript -e 'set volume output volume 40'

02What it does

Unlike muting, which is a boolean, output volume accepts any integer from 0 to 100, letting scripts restore a specific listening level. Read the current value back with `osascript -e 'output volume of (get volume settings)'`, which is perfect for saving and restoring volume around a screen recording or presentation. `set volume without output muted` un-mutes as part of the same statement.

03Risk

RiskLow risk

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

Last verified: 2026-09-17 · Category: Media

06Related solutions