macos: hide /nix from Finder and stop fseventsd journaling#183
Draft
macos: hide /nix from Finder and stop fseventsd journaling#183
Conversation
Mic92
commented
Apr 14, 2026
| tracing::warn!(?err, path = %metadata_never_index.display(), "Could not remove Spotlight opt-out marker"); | ||
| } | ||
|
|
||
| let no_log = self.mount_point.join(".fseventsd").join("no_log"); |
Member
Author
There was a problem hiding this comment.
I have to do a bit of research if there is anything that will stop working if we do this.
On a mature Nix store (>500k entries), Finder and the system open/save
panel XPC service (com.apple.appkit.xpc.openAndSavePanelService) walk the
/nix synthetic firmlink whenever the user browses near / and cache one
_FileCache + NSURL object per store entry inside DesktopServicesPriv.
On a 700k-entry store this leaks ~950 MB RSS in Finder and ~900 MB in the
open-panel service, plus ~50% CPU re-syncing TNode::SynchronizeChildren ->
getattrlistbulk on every fsevent. The existing fstab nobrowse option hides
the *volume* from the sidebar and from Spotlight/mds, but not the firmlink
directory entry under / that DesktopServices enumerates.
Add a SuppressVolumeIndexing action that, on the mounted /nix volume:
- runs chflags hidden /nix (UF_HIDDEN on the volume root inode hides
the firmlink from Finder/NSOpenPanel
directory listings; persists across
remounts)
- drops .fseventsd/no_log (Apple-documented per-volume fseventsd
journal opt-out; cuts write I/O during
builds and GC)
Spotlight needs no extra marker: nobrowse already opts the volume out, and
.metadata_never_index is undocumented and unreliable on recent macOS.
Wire it into CreateNixVolume after enable_ownership, when the volume is
mounted and owned. Revert is best-effort since uninstall removes the
volume anyway.
5414ba4 to
104134a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
On a mature Nix store (>500k entries), Finder and the system open/save panel
XPC service (
com.apple.appkit.xpc.openAndSavePanelService) walk the/nixsynthetic firmlink whenever the user browses near
/and cache one_FileCache+NSURLobject per store entry insideDesktopServicesPriv.On a 700k-entry store this leaks ~950 MB RSS in Finder and ~900 MB in the
open-panel service, plus ~50 % CPU re-syncing
TNode::SynchronizeChildren → getattrlistbulkon every fsevent. The existingfstab
nobrowseoption hides the volume from the sidebar (and fromSpotlight/mds), but not the firmlink directory entry under
/thatDesktopServices enumerates.
Adds a
SuppressVolumeIndexingaction that, on the mounted/nixvolume:chflags hidden /nix— setsUF_HIDDENon the volume root inode soFinder/NSOpenPanel skip the firmlink in directory listings; flag persists
across remounts. This is the load-bearing fix for the RSS leak.
/nix/.fseventsd/no_log— Apple-documented per-volume fseventsdjournal opt-out
(FSEvents Programming Guide); cuts write I/O during builds and
GC.
Spotlight needs no extra marker:
nobrowse(MNT_DONTBROWSE) already optsthe volume out of mds, and
.metadata_never_indexis undocumented andreported unreliable on recent macOS, so it is intentionally not written.
Wired into
CreateNixVolumeafterenable_ownership(volume mounted andowned). Revert is best-effort since uninstall removes the volume anyway.
Evidence (heap / sample on a 700k-entry store)
Object count tracks
ls /nix/store | wc -l. Same signature inopenAndSavePanelService.Checklist
tests/fixtures/macos/macos.json