Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rubenhak

macrumors newbie
Original poster
May 18, 2023
3
0
Hi All, new to the forum.
I need to be able to run a script whenever the Mac wakes up from sleep. Using Ventura. Would really appreciate help. Googling didn't help :(
Thanks!
 
So if you create a small program for it you can do something like this
Code:
NSWorkspace.sharedWorkspace().notificationCenter.addObserver(self, selector: "wakeUp:", name: NSWorkspaceDidWakeNotification, object: nil)

Then whenever the Mac wakes it turns the function wakeUp (mark with @objc) and you can set that up to call your script. Then you can put this application as a launch item so it runs when the computer boots up and just sits there in the background waiting on wake events.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.