Mac OS X,  Mac OS X Server

Invoke ScreenSaver in Mac OS X with a Script

While troubleshooting some issues with a Screen Saver that just wouldn’t fire up. Even when you told the ScreenSaver to open (timed or via Expose) it wouldn’t work. Given the security implications for the given environment having a Screen Saver invoked automatically and manually are both requirements. So I found how to open it from the shell. From the
/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/ScreenSaverEngine.app/Contents/MacOS working directory simply do:

./ScreenSaverEngine

The Screen Saver opened from the shell so I figured I would try it from an AppleScript, so isolated the application id to com.apple.ScreenSaver.Engine and launched it manually:

osascript -e ‘tell application id “com.apple.ScreenSaver.Engine” to launch’

This didn’t work.  Replaced the ScreenSaver.Framework (located in /System/Library/Frameworks) with one from a known good working host, issues resolved and server reinstallation averted. Yay.