Old version Version 5 of 6
Finder on macOS is slowing down your Nix builds
You are reading an old version of this post. Read the latest version →
TLDR: Skip to the fix.
I’m one of those people who main Nix on a MacBook Pro. I will be the first to advocate for NixOS, but for a travel machine, I just want something reliable, that pairs with my AirPods, and can survive away from an outlet for a few hours.
I’ll admit that Apple’s ecosystem isn’t particularly welcoming to a tool like Nix, but support has improved drastically in recent years (thank you, dear contributors!). We’re at a point now where I can recommend both Nix and nix-darwin on macOS with a clear conscience.
Yet there’s one problem that has continued to plague me:
Finder likes to burn through an entire CPU core whenever Nix builds anything, performs garbage collection, or otherwise modifies the
/nix/store.
I figured this was just the reality of Nix on macOS, or some issue with APFS, where macOS didn’t give us a way to exclude this volume entirely from indexing.
The problem

What I recently realized is that the issue isn’t random or always present. You can actually trigger it yourself by opening a directory in Finder that has a symlink into the Nix store. This is quite common in Nix workflows. Just think of all the result links left behind by nix build, or symlinked configuration files in your home directory.
Once Finder has seen that symlink, anything that changes the Nix store sends Finder into a loop, and closing the window does absolutely nothing.
The only workaround that I knew of was to force relaunch Finder and avoid opening any windows until Nix was done doing its thing.
Digging into Finder
The first thing I did was sample Finder to see what it was actually doing. I also noticed that Finder was holding /nix/store open as a directory and had grown from 51 MB to 648 MB of memory. Every run showed the same hot path:
FSEvents thread
3228 TSystemNotificationTask::HandleFSEvent (in DesktopServicesPriv)
3228 TNode::HandleChange (in DesktopServicesPriv)
3228 TNode::FindChildButDontSynchronize (in DesktopServicesPriv)
3228 __psynch_mutexwait (in libsystem_kernel.dylib)
Sync thread
3228 TNode::HandleNodeRequest (in DesktopServicesPriv)
3228 TNode::HandleSync (in DesktopServicesPriv)
3205 TNode::SynchronizeChildren (in DesktopServicesPriv)
3015 TChildrenList::FindRenamedChild (in DesktopServicesPriv)The thread that receives the file system event waits on a lock while a second thread syncs the store. Most of the samples land in FindRenamedChild, which looks for renamed entries.

I tasked Claude with writing a couple of scripts to reproduce this behaviour systematically. It sampled Finder, added paths to the store, and counted the samples under TNode::HandleSync in the call tree. It then created some symlinks in a Finder window to trigger the behaviour and collected more samples.
What did not work
Issues with Finder and the Nix store are well known on macOS, and the various Nix installers already apply mitigations to stop the file system services from watching the store.
- The Nix store lives on its own volume
- The volume is mounted with
nobrowsein/etc/fstab - The
/nixmount is flaggedhidden
These flags stop Finder and Spotlight from walking into /nix, but not from following a symlink.
I had also previously tried adding the documented .fseventsd/no_log marker file to the volume. This stops the on-disk event history, but doesn’t actually stop the live events from arriving, as others have found.
Disassembly
At this point, I needed to dig deeper into what Finder was actually doing and what the functions in the stack traces were. I opened DesktopServicesPriv in Hopper and started digging through the functions.
When Finder shows a symlink, TNode::FollowAlias gets a node for the link target. This creates a node for each directory on the path, including /nix/store. When an event arrives, TNode::HandleChange looks up the event path in the node tree. If it finds a node, it synchronizes it: TNode::HandleSync calls TNode::SynchronizeChildren, which lists the full directory and builds a node for every entry. Nothing checks whether a window still shows the directory.


The undocumented marker
Without any obvious knobs to turn in Finder, I decided to dig into fseventsd, which actually generates the events. Loading the binary into Hopper, I found some curious strings right next to each other:
%s/.fseventsd/no_log
%s/.fseventsd/ignore
%s: mount_point(%s) dev(%d) will be completely ignoredThere’s the documented no_log marker, which we had already figured out does not help us. But there’s also another one called ignore. What’s interesting is that no_log shadows ignore. A volume with both markers behaves as if it only had no_log.

Let’s go try out ignore!
The fix
sudo mkdir -p /nix/.fseventsd
sudo touch /nix/.fseventsd/ignoreMake sure you don’t have a /nix/.fseventsd/no_log file in there, because it takes precedence over ignore.
Reboot the machine.
You can also remount the volume and relaunch Finder, but you might also have to relaunch various Nix services too.
Validation
I tested each marker in a clean macOS VM with a result symlink open in Finder while adding paths to the store.
Marker on /nix | Events for /nix/store | Finder CPU |
|---|---|---|
| none | 5 of 5 | 97% |
no_log | 5 of 5 | 96% |
ignore | 0 of 5 | idle |
Benchmarks
I also ran benchmarks in the VM: 4 cores, 8 GB memory, and about 135,000 entries in the store.
Each store change costs Finder O(n) in the number of store entries, up to one full core. You want enough paths in the store to saturate its queue for full effect. Keep in mind that the performance numbers here are inversely proportional to the number of CPU cores, so with N cores, the most you can lose is 1/N.
The first build has 89 small derivations: Perl modules and C libraries that run their test suites. Lots of short builds means lots of store changes.
That’s 24% faster with ignore. Without the marker, Finder used about 90% of a core for the entire build.
The second build has 50 larger derivations, like OpenSSL, curl, cairo, and a handful of image codecs.
The improvement is smaller this time, at 10%. The builds are spending more time compiling, so we’re not generating enough store changes to keep Finder busy. Still, it managed to burn through over 10 minutes of CPU time without the marker.
What’s next
I did a cursory search for this flag and haven’t see anyone talking about it yet. We should absolutely get this into every Nix installer out there ASAP. I’m already getting more battery life, faster builds, and my laptop is no longer as much of a space heater.
The trade-off here is that anything that relies on FSEvents won’t see any changes on the Nix volume. I think that’s generally a pro rather than a con, just because FSEvents is extremely slow, so I don’t think you really want it enabled on the store anyway. kqueue-based watchers should still work.
I suppose the other downside is that the marker is undocumented, so it’s kind of private API. But that’s par for the course on macOS.
docs(writing): add build benchmarks to finder post
+24 −0 lines · +1,348 −0 characters · since version 4
Validation
{.inline} +## Benchmarks+ +I also ran benchmarks in the VM: 4 cores, 8 GB memory, and about 135,000 entries in the store.+ +Each store change costs Finder O(n) in the number of store entries, up to one full core.+You want enough paths in the store to saturate its queue for full effect.+Keep in mind that the performance numbers here are inversely proportional to the number of CPU cores, so with N cores, the most you can lose is 1/N.+ +The first build has 89 small derivations: Perl modules and C libraries that run their test suites.+Lots of short builds means lots of store changes.+ +{.inline}+ +That's 24% faster with `ignore`.+Without the marker, Finder used about 90% of a core for the entire build.+ +The second build has 50 larger derivations, like OpenSSL, curl, cairo, and a handful of image codecs.+ +{.inline}+ +The improvement is smaller this time, at 10%.+The builds are spending more time compiling, so we're not generating enough store changes to keep Finder busy.+Still, it managed to burn through over 10 minutes of CPU time without the marker.+ ## What's next I did a cursory search for this flag and haven't see anyone talking about it yet.
Other files
default.nixchangedfigures/build-long.tomladdedfigures/build-short.tomladded