I was able to get this to work.
TL;DR: Version
Tried brew uninstall --zap flox
, but it failed to unmount /nix
and couldn’t remove everything cleanly.
Install attempts kept failing — turns out the postinstall script choked because _nixbld8
already existed with UID 308
.
Manually deleted all _nixbld*
users.
After that, brew install flox
worked perfectly.
Big thanks @bryanhonof — tailing /var/log/install.log
helped isolate the issue!
Detailed Version
Tried brew uninstall --force --zap flox
, it asked to unmount the APFS volume Nix Store
- /nix
.
♪ brew uninstall --force --zap flox
==> Implied `brew uninstall --cask flox`
==> Removing launchctl service org.nixos.darwin-store
Password:
==> Removing launchctl service org.nixos.nix-daemon
==> Running uninstall script /usr/local/share/flox/scripts/uninstall
/usr/local/share/flox/scripts/uninstall: line 16: /usr/local/bin/nix: No such file or directory
==> Uninstalling packages with sudo; the password may be necessary:
com.floxdev.flox
==> Dispatching zap stanza
==> Running uninstall script /usr/local/share/flox/scripts/uninstall_zap
7: APFS Volume Nix Store 6.6 GB disk3s7
Unmount failed for /nix
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
Could not unmount /nix; make sure no processes using Nix or Flox are running, and then re-run this uninstaller.
Error: Failure while executing; `/usr/bin/sudo -E -- /usr/local/share/flox/scripts/uninstall_zap --zap` exited with 1. Here's the output:
7: APFS Volume Nix Store 6.6 GB disk3s7
Unmount failed for /nix
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
Load failed: 5: Input/output error
Try running `launchctl bootstrap` as root for richer errors.
Could not unmount /nix; make sure no processes using Nix or Flox are running, and then re-run this uninstaller.
Tried unmounting, but that didn’t help, so proceeded with deleting the volume Nix Store
.
♪ sudo diskutil apfs deleteVolume disk3s7
Started APFS operation
Deleting APFS Volume from its APFS Container
Unmounting disk3s7
Erasing any xART session referenced by 858D0DD9-0AF9-406D-AAC9-0C242EDA03CD
Deleting Volume
Removing any Preboot and Recovery Directories
Finished APFS operation
Even then the installation was failing, so tail-ed /var/log/install.log
as you suggested and that helped figure out the issue.
The installer was failing during the postinstall step because a system user named _nixbld8
already existed with UID 308
[snip]
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ echo 358
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + uid=358
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + task 'Setting up the build user _nixbld8'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo ''
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + ok '~~> Setting up the build user _nixbld8'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + _textout '\033[32m' '~~> Setting up the build user _nixbld8'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo -en '\033[32m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + shift
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + '[' '~~> Setting up the build user _nixbld8' = '' ']'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo '~~> Setting up the build user _nixbld8'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ~~> Setting up the build user _nixbld8
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo -en '\033[0m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + poly_user_exists _nixbld8
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + /usr/bin/dscl . -read /Users/_nixbld8
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ poly_user_id_get _nixbld8
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ dsclattr /Users/_nixbld8 UniqueID
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ /usr/bin/dscl . -read /Users/_nixbld8
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ /usr/bin/awk '/UniqueID/ { print $2 }'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + actual_uid=308
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + '[' 308 '!=' 358 ']'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + failure
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + header 'oh no!'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + follow=---------------------------------------------------------
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ echo '---- oh no! ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ++ head -c 80
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + header='---- oh no! --------------------------------------------------------------------'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo ''
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + _textout '\033[34m' '---- oh no! --------------------------------------------------------------------'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo -en '\033[34m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + shift
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + '[' '---- oh no! --------------------------------------------------------------------' = '' ']'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo '---- oh no! --------------------------------------------------------------------'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: ---- oh no! --------------------------------------------------------------------
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo -en '\033[0m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + _textout '\033[31m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo -en '\033[31m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + shift
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + '[' '' = '' ']'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + cat
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: It seems the build user _nixbld8 already exists, but with the UID
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: with the UID '308'. This script can't really handle that right
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: now, so I'm going to give up.
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: If you already created the users and you know they start from
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: 308 and go up from there, you can edit this script and change
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: NIX_FIRST_BUILD_UID near the top of the file to 308 and try
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: again.
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo -en '\033[0m'
2025-04-18 00:43:44+05:30 [snip] package_script_service[4279]: ./postinstall: + echo ''
[snip]
Previous installs had created these users…
♪ dscl . -list /Users | grep nixbld
_nixbld1
_nixbld10
_nixbld11
[snip]
_nixbld32
_nixbld4
_nixbld5
_nixbld6
_nixbld7
_nixbld8
_nixbld9
I cleared these using the following command.
♪ sudo dscl . -delete /Users/_nixbld1
[snip]
♪ sudo dscl . -delete /Users/_nixbld32
This time the install worked fine. 
♪ brew install flox
==> Downloading https://formulae.brew.sh/api/formula.jws.json
==> Downloading https://formulae.brew.sh/api/cask.jws.json
==> Downloading https://downloads.flox.dev/by-env/stable/osx/flox-1.4.0.aarch64-darwin.pkg
Already downloaded: /Users/[snip]/Library/Caches/Homebrew/downloads/47d2370d1a1177dfac509fe889420a9ad4d5930fa36f6eb50195d2087e6153fe--flox-1.4.0.aarch64-darwin.pkg
==> Installing Cask flox
==> Running installer for flox with sudo; the password may be necessary.
Password:
installer: Package name is Flox
installer: Installing at base path /
installer: The install was successful.
🍺 flox was successfully installed!
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Autoremoving 1 unneeded formula:
libgit2@1.7
Uninstalling /opt/homebrew/Cellar/libgit2@1.7/1.7.2... (105 files, 4.5MB)
Removing: /Users/[snip]/Library/Caches/Homebrew/Cask/keycastr--0.10.2.zip... (2.4MB)
Pruned 0 symbolic links and 3 directories from /opt/homebrew
♪ flox --help
Flox is a virtual environment and package manager all in one.
With Flox you create environments that layer and replace dependencies just where
it matters, making them portable across the full software lifecycle.
[snip]