Suspend vagrant before Mac sleep
Lately I was getting a lot of problems with my VM and even with the bluetooth on Mac. Just because the vmware VM was not recovering well after my macbook waking up.
I use a VM everyday and I always forget to suspend/halt that before sleep my macbook. So I find out is possible to configure scripts to be executed on wakeup/sleep the machine through SleepWatcher.
This blog post Mac OS X: Automating Tasks on Sleep by Kodiak explain really well how to setup the sleepwatcher.
Summarizing:
# 1. install
# 2. create a script "~/.sleep" to be executed before the machine sleep
# in my case was "cd <vm-directory> && vagrant suspend"
# 3. set full permissions to the owner
# 4. start the watcher then put your machine to sleep to test the script is working
# configure the deamon