Lazy Guide to re-install Nixos on Macos
I had resigned myself to re-installing Nixos each time I did a system update on Macos. Recently, though, there seems to be an issue where you have to actually think and fix the issue without re-installing. The lazy bastard in me gawked at all the words in that github issue and with each swipe down the page, fought the undeniable urge to find a yak to shave. So I just typed sh <(curl -L https://nixos.org/nix/install)
as I had done countless times over to reinstall Nixos and was hit with:
It seems the build group nixbld already exists, but with the UID 30000. This script can't really handle that right now, so I'm going to give up.
Lazy searching of the error message revealed someone on Stackoverflow telling someone else to delete the group and users (for the subsequent error that would also show up after deleting the group) and try again. So I did that. For all you Mac users, here’s how to delete a group:
sudo dscl . delete /groups/nixbld
And here’s how to delete the users. First, find the users to delete:
dscl . list /users
Gaze at the list in awe and then copy all the _nixbld??
usernames to a file. The ?
is a representation for any digit 0-9
. Then delete them:
cat nix_users.txt|xargs -I{} sudo dscl . delete /users/{}
I specifically use a file so that I can’t accidentally delete users I’m not supposed to delete on my Mac. Be very aware that you can royally screw up your mac if you don’t do this correctly and accidentally paste a user account that is not _nixbld??
Then re-run sh <(curl -L https://nixos.org/nix/install)
and your nix-shell should work just fine.