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.
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
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- osascript — execute AppleScript (macOS man page)Evidence: osascript runs AppleScript from the shell; `set volume output volume N` accepts 0-100.
Last verified: 2026-09-17 · Category: Media