LnL7 / nix-darwin

nix modules for darwin
MIT License
2.82k stars 431 forks source link

Cannot use system.defaults when running darwin-rebuild switch as non-root user #1047

Open adahl5 opened 1 month ago

adahl5 commented 1 month ago

I'm running into an issue where I get an error if I try to set any system defaults as a non-root user. For example, trying to set system.defaults.dock.autohide = true (this is the only default I'm setting) causes this error:

Unsurprisingly, this is same error returned if I were to run run defaults write com.apple.dock autohide true without sudo. I'm able to use sudo darwin-rebuild switch to apply the defaults. The real issue comes in when I try to use homebrew since it no longer supports being ran as root, so running sudo darwin-rebuild switch returns this error:

I was able to isolate the conflict to homebrew and system.defaults:

I'm able to manually run sudo defaults write and have granted Full Disk Access to my terminal application (kitty), but I also have the issue in Terminal and Alacritty when running darwin-rebuild switch without sudo.