nix-darwin icon indicating copy to clipboard operation
nix-darwin copied to clipboard

system.defaults.dock.persistent-apps doesn't work

Open shishkin opened this issue 11 months ago • 3 comments

I've tried setting persistent Dock apps via system.defaults.dock."persistent-apps" option as shown in the docs:

system.defaults.dock."persistent-apps" = [
  "/Applications/Mail.app"
];

When I apply the settings, I get a question mark item in the Dock instead.

I've tried different variations of the string value ("Mail.app", file///Applications/Mail.app/ etc.) but nothing worked.

When I examined applied Dock default with defaults read com.apple.dock persistent-apps, I see the generated items look like:

        {
        "tile-data" =         {
            "file-data" =             {
                "_CFURLString" = "/Applications/Mail.app";
                "_CFURLStringType" = 0;
            };
        };
    },

...while a proper manually created items look like this:

        {
        "tile-data" =         {
            book = {length = 588, bytes = 0x626f6f6b 4c020000 00000410 30000000 ... 04000000 00000000 };
            "bundle-identifier" = "com.apple.systempreferences";
            "dock-extra" = 1;
            "file-data" =             {
                "_CFURLString" = "file:///System/Applications/System%20Settings.app/";
                "_CFURLStringType" = 15;
            };
            "file-label" = "System Settings";
            "file-mod-date" = 0;
            "file-type" = 1;
            "is-beta" = 0;
            "parent-mod-date" = 0;
        };
        "tile-type" = "file-tile";
    }

Has anyone managed to get persistent apps in Dock with nix-darwin?

I'm running MacOS Sequoia 15.2.

shishkin avatar Jan 03 '25 17:01 shishkin

Apparently, it works for default system applications with a path like "/System/Applications/Mail.app".

shishkin avatar Jan 03 '25 17:01 shishkin

If anyone can't get Safari to appear more than a question mark, Safari is /System/Cryptexes/App/System/Applications/Safari.app

0dragosh avatar Jul 28 '25 15:07 0dragosh

Experiencing the same in Sequoia 15.6. I'm guessing it might be that Sequoia stores dock metadata differently. It's particularly annoying because I can't seem to disable dock management, which means each time I apply my config or reboot the system it will empty my dock and I can't persistently override this.

agucova avatar Aug 11 '25 08:08 agucova