Muting Mac on Sleep/Wake? I would like my Mac to mute every time it wakes from sleep to avoid unintentionally playing loud music/videos when I'm at a meeting.

I found this related question: 
Mute volume of macbook on sleep

but the answer may be outdated, and I can't comment because my reputation isn't high enough. Does anyone have an updated fix?

Here is what I did:

I installed SleepWatcher, ran the script, then the following code:

$ sudo mkdir -p /usr/local/sbin /usr/local/share/man/man8 
$ sudo cp ~/Desktop/sleepwatcher_2.2.1/sleepwatcher /usr/local/sbin 
$ sudo cp ~/Desktop/sleepwatcher_2.2.1/sleepwatcher.8 /usr/local/share/man/man8


Then, per the answer to the previous question, I did:

$ /usr/local/sbin/sleepwatcher --verbose --sleep /usr/bin/osascript -e 'set volume with output muted'


I get the following error:


  sleepwatcher: invalid option -- e


If I remove e, it says 


  sleepwatcher: superfluous arguments ignored: "set volume with output muted ..."
Sleepwatcher only accepts a single executable/script, so you have to put the command you want to run in its own file.

Create a file mute.applescript:

#!/usr/bin/osascript
set volume with output muted


Set it as executable:

chmod +x mute.applescript


Then do:

/usr/local/sbin/sleepwatcher --verbose --sleep /path/to/mute.applescript