Change System Volume from Command Line on Mac OS
Oftentimes the awesome GUI applications we love are simply gloss over a command line functionality. While I do love a visual app, it's always good to know how to do things from command line, if only for the sake of automation. I've covered loads of command line secrets, most notably Mac Camera Access, so I wanted to figure out if I could control volume from command line.
Change Mac System Volume
The secret to changing Mac system volume from command line is through osascript
:
# Max volume
sudo osascript -e "set Volume 10"
# Mute
sudo osascript -e "set Volume 0"
# 50% volume
sudo osascript -e "set Volume 5"
Values range from 0
(muted) to 10
(maximum volume). Note that you don't get to see a nice volume change indicator -- the volume simply changes without any feedback.
One major problem with creating UI components with the MooTools JavaScript framework is that there isn't a great way of allowing customization of template and ease of node creation. As of today, there are two ways of creating:
new Element Madness
The first way to create UI-driven...
My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...
One of the great parts of being a developer that uses Facebook is that I can get some great ideas for progressive website enhancement. Facebook incorporates many advanced JavaScript and AJAX features: photo loads by left and right arrow, dropdown menus, modal windows, and...
As more devices emerge and differences in device interaction are implemented, the more important good CSS code will become. In order to write good CSS, we need some indicator about device capabilities. We've used CSS media queries thus far, with checks for max-width and pixel ratios.
Thank you for this tip. Are you sure that the maximum value is 10? On my Mac with High Sierra, the maximum value get on 7. The 8, 9, 10 also change the value to maximum. I did double check it by viewing the pop-up small window on volume indicator on menu bar.
This is how it’s done on Mojave:
The deprecated way is to specify a number between 0 and 7 for “set volume”
Is there a way to similarly look up the current volume setting (let’s say, in Mojave or Catalina)?
Options to get the current volume setting:
or