You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

How to adjust system Volume by command.

I want to write a script that can be automatically run before I turn off the MAC book. Every time I turn on the MAC, it makes the sound 'Dong.' It is highly unwelcome in a quiet environment. I want to adjust the system volume to zero just before I turn off the computer.

How can I do it? Thank you.

MacBook Air 13″, macOS 11.2

Posted on Apr 14, 2021 6:50 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 15, 2021 11:43 AM

Controlling the volume (or, in this case, mute setting) is trivial. It's literally one line:


set volume with output muted


Triggering this to run when the system is about to shutdown is a whole other story. There is no built-in trigger to run a script at shutdown (at least without digging under the hood).


The simplest solution would actually be to have a stay-open script that sits in the background and does nothing until quit, at which point it mutes the volume before quitting. This way you can leave it running in the background and when the OS quits the app (as part of shutdown), it mutes the volume. It would have the side effect of muting any time the app quit, though, whether through shutdown or some other method.


The larger question, though, maybe why you're shutting down at all. The MacBook (like all laptops) is designed to sleep for an extended period, and waking the system is not only faster, but it doesn't play the startup chime. So maybe that's a better alternative?

1 reply
Question marked as Top-ranking reply

Apr 15, 2021 11:43 AM in response to bluebirdhouse

Controlling the volume (or, in this case, mute setting) is trivial. It's literally one line:


set volume with output muted


Triggering this to run when the system is about to shutdown is a whole other story. There is no built-in trigger to run a script at shutdown (at least without digging under the hood).


The simplest solution would actually be to have a stay-open script that sits in the background and does nothing until quit, at which point it mutes the volume before quitting. This way you can leave it running in the background and when the OS quits the app (as part of shutdown), it mutes the volume. It would have the side effect of muting any time the app quit, though, whether through shutdown or some other method.


The larger question, though, maybe why you're shutting down at all. The MacBook (like all laptops) is designed to sleep for an extended period, and waking the system is not only faster, but it doesn't play the startup chime. So maybe that's a better alternative?

How to adjust system Volume by command.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.