Where is `defaults -currentHost write domain key value` written to?
When I use defaults write domain key value
the information is written to ~/Library/Preferences/domain.plist
.
When I use the -currentHost
flag, it has a higher priority then when I just use defaults
without a specified host.
But where is the value actually written to? It is consistent between system startups, so it must be somewhere on the disk...
Solution 1:
If you use -currentHost
with defaults
it acts on .plist
files in:
$HOME/Library/Preferences/ByHost/
As an example, I did not have a com.apple.finder
plist file at that location and when I executed the following command, one was created at that location.
defaults -currentHost write com.apple.finder GoToField "/foobar"
$ defaults -currentHost read com.apple.finder GoToField
/foobar
$
Note the full file name contains a UUID however you do not need to include it when -currentHost
is used, the normal naming is all that's needed as shown in the command line above.
Example: $HOME/Library/Preferences/ByHost/com.apple.finder.6966D045-28DC-544A-97C2-98CDB668DC8B.plist