Fixing your install after OSX upgrade

Hi. Recently went through the experience of having to repair my install post OSX update. 2nd time it happened, so this time kept some better notes.

My nix usage: Installed nix (multiuser), and using home-manager as a brew replacement. - so nothing fancy.

First time I upgraded osx, it just replaced the /etc/zshrc, so that was easy to fix. This latest time, the osx upgrade borked the automounting of my Nix Store, so that was a bit more involved to fix. Collected all the info in this gist, which I’ll keep updating every time my install breaks and I learn to fix it.

Please feel free to suggest was to make this better.

2 Likes

Check if /Library/LaunchDaemons/org.nixos.darwin-store.plist exists. If not, you can recreate it

Did this actually happen to you?

yes.

Upgraded osx yesterday (nothing major, just usual patch).

this time, all those were missing,(synthetic, fstab, darwin-store automount, etc/zshrc reset) which led to me making this so in a few months when it happens again i can check back to my notes :smiley:

1 Like

Which update was this?

Would be the upgrade fto 12.4 Monterey.

The macOS installer has changed a lot over the last few years to keep up with changes Apple has made (sometimes in minor updates) and it’s possible that we’ll have to start that cycle again this summer when the macOS 13 beta comes out.

When details keep changing, it’s easy for people to land on old threads and end up with unhelpful impressions or recommendations, so (I think) it’s important to be very specific, and try to get to the bottom of what the update did.

For posterity (I’ll try to remember to update this if we learn anything else…):

  • I’m not sure what went sideways here, but I don’t think this is normal for any update, including 12.4.

    • It would be pretty bad if this is very common. If anyone else sees /etc/synthetic.conf, /etc/fstab, or /Library/LaunchDaemons/org.nixos.darwin-store.plist go missing after the update to macOS 12.4, macOS 12.5, or any future version–please drop by the Nix on macOS channel on Matrix or open an issue against the Nix repository.

    • AFAIK no one else has reported these files going missing as a result of the 12.4 update (so far–it’s only been out ~10 days I think).

    • At least one person reported taking this update on 3 machines without witnessing this problem.

  • It has (unfortunately) become normal for macOS updates to nuke /etc/zshrc over the past few years. There’s a long-running issue here: macOS updates often break nix installation (updates replace path-hooks on multi-user install) · Issue #3616 · NixOS/nix · GitHub. Previous attempts to relocate the Nix hook to a different init file have caused their own problems.

Thanks for following up @abathur

I’ve gone and updated my gist to mention that I was going from 12.3.x > 12.4.

Yeah, very possible it could just be a ‘me’ problem. These upgrades are so opaque, who knows what happened.

At least this is a starting place for anyone else (and me) next time something breaks - i can at least check these, and having the links back to the install scripts are also handy (i think)

as far as init hook, i’m testing out moving it to the top of my ~/.zshrc and so far this hasn’t caused any issues. Things still work as expected.

1 Like

:heart:

Yes. Hard to say. Could be common. Could be rare. Could be just you :grin:.

Being able to gather info about someone’s setup/device, from /etc/, the install log, and the Relocated Items folder can all help a bit.

Yep! Nothing wrong with teasing these out and helping people understand them–as long as they know that they might go stale, and roughly when things were relevant.

Yes–that should be fine. It might cause a little trouble if you set up some daemons/agents that use Nix. I’m not quite sure. It’s a shame that the hook issue has festered this long. :frowning:

In relocated folder I only find bashrc.system_default - which is funny, i don’t even use bash.

If you know where apple updates logs stuff, lmk, i will be happy to try to pull the log and look through to see if I can notice anything. I tried looking through console.app but didn’t find anything relevant.

I think it may be /var/install.log, though I haven’t had to look at one of these in a bit and am not 100% on that. IIRC it’ll be pretty big and mostly irrelevant, but there may be a clue lurking in it.

went through some of the logs, nothing useful. (they were in var/log/…)

1 Like

MacOS update to Sanoma 14.6.1 caused this issue for me today. Adding the zshrc entries from the Github gist above fixed the issue for me:

# Nix
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
  . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# End Nix

NOTE: I actually added the entries to ~/.zshrc as suggested to prevent this in the future.
A lot of other great trouble shooting advice in the Gist to if the above does not fix your issue.

1 Like