Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

applications not linked in a way finder can find them #1079

Open
mknudsen opened this issue Sep 17, 2024 · 5 comments
Open

applications not linked in a way finder can find them #1079

mknudsen opened this issue Sep 17, 2024 · 5 comments

Comments

@mknudsen
Copy link

I have a bunch of apps installed through nix-darwin and I can launch them from command line, i.e. Zoom with zoom.

I also see them in /run/current-system/Applications/. I however cannot find them through finder. How do I make macOS aware or those apps?

darwin-rebuild check tells me everything is ok.

Here are my software versions

darwin-version 
24.11pre674705.b833ff01a0d6+darwin4

Darwin myhostname 24.0.0 Darwin Kernel Version 24.0.0: Mon Aug 12 20:49:48 PDT 2024; root:xnu-11215.1.10~2/RELEASE_ARM64_T8103 arm64
@antoineco
Copy link
Contributor

antoineco commented Sep 17, 2024

There are multiple problems with the way macOS applications are added to the /Applications directory right now.

  • Because symlinks aren't supported by Spotlight, it is unable to index Nix applications properly without a "trampoline" application located outside of /Applications/Nix Apps. ("You can’t open the application Zoom.app because it may be damaged or incomplete.")

  • The macOS dock needs to be updated on any update of the application due to its path changing in the Nix store.

  • Although something like mac-app-util is able to both generate a trampoline application and update the macOS dock upon performing a system switch, this sometimes results in two application icons in the dock when the application is open: one for the trampoline, the other for the "target" app inside Nix Apps.

  • Applications started through the Finder at /Applications/Nix Apps appear as a single command name, without application icon, inside the macOS privacy settings. They also remain referenced there after their deletion.

The thread at NixOS/nix#7055 is very informative, and proposes an interesting solution which leverages filesystem aliases instead of symlinks: NixOS/nix#7055 (comment)

@emilazy
Copy link
Collaborator

emilazy commented Sep 17, 2024

Aliases also have significant issues; see nix-community/home-manager#1341 for discussion. Probably copying is the best solution. That’s what Homebrew settled on eventually too.

@antoineco
Copy link
Contributor

@emilazy are you referring to these two points?

Aliases won't be categorized under "Applications" [by Spotlight]

Aliases are kind of awful to work with - you can't seem to create them from the CLI without pinging finder via AppleScript / osascript

@emilazy
Copy link
Collaborator

emilazy commented Sep 17, 2024

Yes, though also making aliases through Finder is a hack with its own set of problems so we’d want to use a native code solution to accomplish it even if we went that route. The Spotlight problem is pretty serious though. If there was something other than copying that worked well I expect Homebrew Cask would have already adopted it.

@reckenrode
Copy link

reckenrode commented Sep 17, 2024

Aliases can be created programatically (e.g., https://github.com/reckenrode/mkalias). Finder should not be scripted. It undermines TCC. macOS 15 also requires explicit approve Finder of scripting in Security & Privacy, making the experience even worse (probably to discourage scripting of Finder because it’s effectively equivalent to having Full Disk Access).

(I’m also pretty sure aliases share similar limitations to the trampoline method with references to the store in the dock and services not being available until an aliased application has been launched, but it’s been so long since I looked into it that I don’t remember for sure.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants