Summary
hs.power.lockScreen() fails because it tries to launch a hard-coded CGSession binary that is absent on the current macOS installation.
Error
2026-09-14 17:40:31 - Error: hs.power.lockScreen: failed to launch CGSession: Error Domain=NSCocoaErrorDomain Code=4 "The file “CGSession” doesn’t exist." UserInfo={NSFilePath=/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession}
Investigation
The implementation currently uses:
let cgSession = "/System/Library/CoreServices/Menu Extras/User.menu/Contents/Resources/CGSession"
process.executableURL = URL(fileURLWithPath: cgSession)
process.arguments = ["-suspend"]
That path does not exist on this system, so the function always fails before a lock request is made. This appears to be an application implementation issue rather than a user configuration problem.
Expected behavior
hs.power.lockScreen() should lock the screen on supported current macOS versions, or use a supported fallback when CGSession is unavailable.
Summary
hs.power.lockScreen()fails because it tries to launch a hard-codedCGSessionbinary that is absent on the current macOS installation.Error
Investigation
The implementation currently uses:
That path does not exist on this system, so the function always fails before a lock request is made. This appears to be an application implementation issue rather than a user configuration problem.
Expected behavior
hs.power.lockScreen()should lock the screen on supported current macOS versions, or use a supported fallback whenCGSessionis unavailable.