Nix daemon crash on macOS 26 Beta
Describe the bug
When trying to install/run packages on macOS 26 Developer Beta 1, Nix exits with a "daemon disconnected unexpectedly" error:
Steps To Reproduce
- Install macOS 26 Developer Beta 1
- Install Nix (using either official or Determinate Nix installer; both succeed but Nix fails so I'm assuming it's an error with Nix)
- Try to run e.g.
nix run nixpkgs#helloornix shell nixpkgs#hello - Observe error: "Nix daemon disconnected unexpectedly (maybe it crashed?)"
Expected behavior
nix run nixpkgs#hello produces "Hello, world!"
Metadata
nix-env (Nix) 2.29.0
Additional context
In /var/log/nix-daemon.log, there is the following error:
accepted connection from pid 8877, user andre4ik3
objc[8879]: +[NSCharacterSet initialize] may have been in progress in another thread when fork() was called.
objc[8879]: +[NSCharacterSet initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.
Checklist
- [x] checked latest Nix manual (source)
- [x] checked open bug issues and pull requests for possible duplicates
Add :+1: to issues you find important.
This issue can be reproduced with the official Nix installer, the Determinate installer when installing upstream Nix, and the Lix installer.
But Determinate Nix works fine:
See also: https://github.com/DeterminateSystems/determinate/issues/100
Having this issue too. Got this error after DFU restore on a Mac Mini 2024, and upgrading to 26 Tahoe.
When upgrading to macos 26 beta and having nix installed it works. But Reinstalling it I am not too sure if that causes an issue?
nix-info:
- system: `"aarch64-darwin"`
- host os: `Darwin 25.0.0, macOS 16.0`
- multi-user?: `yes`
- sandbox: `no`
- version: `nix-env (Nix) 2.28.3`
- channels(root): `"nixpkgs"`
- nixpkgs: `/nix/store/zxdp3r7mnikb6mjs8d8fl92d25j6p6c4-source`
Specs:
- model: `Macbook Pro`
- chip: `M4`
- Ram: `16gb`
- Storage: `1tb`
I haven't tested upgrading yet as I don't want to risk my main machine having issues. All of the errors described above were encountered on a M1 MacBook Pro or virtual machines that were both directly wiped and reset to the new beta IPSW file. They were not upgraded from any prior macOS version and they did not have Nix installed on them previously.
When upgrading to macos 26 beta and having nix installed it works. But Reinstalling it I am not too sure if that causes an issue?
On my MacBook Pro 2024 M4 it does work. This seems to be only an issue after a fresh install of Nix on macOS 26 most likely.
Just in-case of a case of confusion
I have:
- Mac Mini 2024 M4 - Affected machine after a DFU mode restore.
- MacBook Pro 2024 M4 - Not affected, Nix installed on macOS Sequoia, upgraded to 26 Tahoe... still functions.
Having the same issue after updating my mac to macOS 26.
Im not a nix expert, but i've been trough a lot of debugging by now and it seems to be related to the substituters.
This worked for me:
nix develop --option substituters "https://cache.nixos.org"
With direnv:
use flake --option substituters "https://cache.nixos.org"
This worked for me:
nix develop --option substituters "https://cache.nixos.org"
Doesn't work for me. And also https://cache.nixos.org is the default substituter, so I don't see how that option would change anything (unless you had extra custom substituters defined?)
But again this is a clean, non-upgraded macOS 26 install. Maybe it is different when upgrading from previous macOS. I haven't tested upgrading yet but I'll try installing a macOS 15 VM, then installing Nix, then upgrading it to 26.
Okay, I tested upgrading. Here is a Nix installation in a macOS Sequoia VM:
And here it is upon upgrading:
So, it appears that any store paths already saved locally will continue to work. It's only working after upgrading because the store paths you are testing are saved locally. Removing those paths, or evaluating any new ones, will cause the daemon crash.
More precisely, since the daemon log explicitly calls out fork(), I believe that any operation that causes the Nix daemon to fork will crash it.
this sounds suspiciously similar to the general macos fork safety problem. might be worth trying to set OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES set in your daemon in /Library/LaunchDaemons/org.nixos.nix-daemon.plist, though ideally that shouldn't be needed. it looks like OBJC_DISABLE_INITIALIZE_FORK_SAFETY was removed from org.nixos.nix-daemon.plist in 8105307f0f3caeae1c1d0bca51bee3a417e4304a. for what it's worth i set up a vm via tart and it seems to be working okay despite OBJC_DISABLE_INITIALIZE_FORK_SAFETY not being set.
$ tart clone ghcr.io/cirruslabs/macos-tahoe-vanilla:latest tahoe-vanilla
$ tart run tahoe-vanilla
$ curl -L https://github.com/DeterminateSystems/nix-installer/releases/download/v3.6.2/nix-installer-aarch64-linux -o nix-installer
$ chmod +x nix-installer
$ NIX_INSTALLER_DETERMINATE=false ./nix-installer install --no-confirm
$ nix run nixpkgs#hello
Hello, world!
I can confirm that it works on Darwin 26 after setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES in daemon
I can also confirm that it works on Darwin 26 after setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES in the daemon environment.
Can also confirm it works on all affected systems (both clean installs and after upgrading) after setting OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES:
To script this workaround, e.g. for automation:
sudo plutil -insert EnvironmentVariables -dictionary /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo plutil -insert EnvironmentVariables.OBJC_DISABLE_INITIALIZE_FORK_SAFETY -string YES /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist
sudo launchctl bootstrap system /Library/LaunchDaemons/org.nixos.nix-daemon.plist
To script this workaround, e.g. for automation:
sudo plutil -insert EnvironmentVariables -dictionary /Library/LaunchDaemons/org.nixos.nix-daemon.plist sudo plutil -insert EnvironmentVariables.OBJC_DISABLE_INITIALIZE_FORK_SAFETY -string YES /Library/LaunchDaemons/org.nixos.nix-daemon.plist sudo launchctl unload /Library/LaunchDaemons/org.nixos.nix-daemon.plist sudo launchctl bootstrap system /Library/LaunchDaemons/org.nixos.nix-daemon.plist
Haha didn't know much about how I was going to do that, lol. I'm going to add that soon to my script, cheers for that!
Thank you @andre4ik3 for the solution! I can confirm it works on Tahoe Beta 2.
Can anyone confirm whether this is still needed on macOS 26 release?
Can anyone confirm whether this is still needed on macOS 26 release?
It is not needed anymore. Just installed nix through the determinate installer with curl -fsSL https://install.determinate.systems/nix | sh -s -- install on a new 26.0 macOS system and it works flawlessly.
Can also confirm that it works fine, using the official installer (not the Determinate one). No workaround needed anymore, so maybe it was a macOS bug in the beta. As such I'm closing the issue now.