How do I gain write permission for the defaults shell command?
The defaults
command normally writes an entry into the relevant .plist
file. The whole point of property list files is to retain settings between boots. You should not need to re-apply them after each boot.
Consequently, you should not need to run the defaults command in a .bashrc
file, which runs at the start of every interactive shell session.
You should not need sudo for defaults commands such as these:
defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
defaults write -g AppleEnableMenuBarTransparency -bool false
defaults write -app Safari AutoOpenSafeDownloads -bool false
defaults write com.apple.screencapture include-date -bool false
If you're trying to write some other type of default
command to a system-level domain, then that might explain why you need sudo
. Otherwise, the need for sudo
is 'unexpected'.