Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is a fresh Mac not displaying my screen saver?

We wrote an application, Screensaver Ninja, that installs an screensaver for the user by copying it to ~/Library/Screen Savers. This works fine in my machine and the other developer's machine but in a testing machine I have, the file is there, if I let the screensaver activate, it selects it, but it doesn't appear on the list:

enter image description here

This is the code we use to install it:

func install() {
    var err: NSError?
    fileManager.copyItemAtURL(saverPackageUrl!, toURL: screensaversUrl!.URLByAppendingPathComponent("Ninja.saver"), error: &err)
    if err != nil {
        NSLog("Error installing Screensaver Ninja: \(err)")
    }
}

and this is how we select it as default:

func setAsDefault() {
    var mutable: NSMutableDictionary
    if let moduleDict = CFPreferencesCopyAppValue("moduleDict", "com.apple.screensaver") as? NSDictionary {
        mutable = moduleDict.mutableCopy() as NSMutableDictionary
    } else {
        mutable = NSMutableDictionary()
    }
    mutable.removeObjectForKey("displayName")
    mutable["moduleName"] = "Ninja"
    mutable["path"] = saverPath
    mutable["type"] = 0
    CFPreferencesSetValue("moduleDict", mutable as CFPropertyList, "com.apple.screensaver", kCFPreferencesCurrentUser, kCFPreferencesCurrentHost)
    CFPreferencesAppSynchronize("com.apple.screensaver")
}

This is how it looks in my own machine (what I expected) after running that code:

enter image description here

Any ideas why it wouldn't work on a pristine mac?

like image 830
pupeno Avatar asked Mar 31 '15 17:03

pupeno


People also ask

Why is my Mac not showing screensaver?

Click the System Preferences menu item. Click the “Desktop & Screen Saver” icon. Click the Screen Saver tab. Select any screen saver in the column on the left.

Why is my screensaver not coming on?

Go to Settings > Personalization. Click on Lock screen and click on Screen caver settings link. Select your preferred screensaver and Wait time. Check the box behind On resume, display logon screen.

How do I restore my screensaver on my Mac?

Open System and Preferences > Desktop & Screen Saver > Desktop tab. Now, scroll and try to find the previous image you used for the wallpaper. Select the image, and it will be set for the background once more.


1 Answers

What are the permissions for the Test user (could they be non-admin?) vs those for you and other Developers (I bet Admin or root)?

Use chmod 777 filename might fix it.

like image 114
Craig Roberts Avatar answered Oct 10 '22 04:10

Craig Roberts