MacOS – ‘currentHost’ for, in defaults

defaultshostsmacospreferences

There are many webpages given over to listing defaults commands in order to configure various parts of the OS. Some of them include the flag -currentHost.

The man page for the defaults command documents the option -currentHost, as "restricting preferences operations to the host that the user is currently logged in on."

Similarly, the -host flag allows a hostname to be specified for the preference.

What is the purpose of explicitly setting these flags? Under what circumstances would a preference affect some other host? (Or indeed, when would a user be logged in on a different host?)

Best Answer

In the case of networked accounts and networked home folders, a user can login to any Mac on for example a company network and see their own files and have their own preferences set.

This is the case where you can use the -host feature. Say that you want for example one wallpaper on your own desktop, but another when you login to the shared office Mac in the meeting room. Or any other type of setting than wall paper ofcourse.