0

My username is hrk and I am currently logged in as hrk on the hostname of Hrishikeshs-MacBook-Pro.
Why is the output of the following 2 commands different?
Shouldn't the output be the same?
Where can I find the official explanation besides the man defaults page?

defaults -host Hrishikeshs-MacBook-Pro read -globalDomain

{
    AKLastEmailListRequestDateKey = "2022-10-26 21:50:38 +0000";
    AKLastIDMSEnvironment = 0;
    AppleAntiAliasingThreshold = 4;
    AppleInterfaceStyle = Dark;
    AppleLanguages =     (
        "en-IN"
    );
    AppleLanguagesDidMigrate = "12.6";
    AppleLanguagesSchemaVersion = 2000;
    AppleLocale = "en_IN";
    AppleMeasurementUnits = Centimeters;
    AppleMetricUnits = 1;
    AppleMiniaturizeOnDoubleClick = 0;
    AppleShowAllExtensions = 1;
    AppleTemperatureUnit = Celsius;
    NSAutomaticCapitalizationEnabled = 1;
    NSAutomaticDashSubstitutionEnabled = 1;
    NSAutomaticPeriodSubstitutionEnabled = 1;
    NSAutomaticQuoteSubstitutionEnabled = 1;
    NSAutomaticSpellingCorrectionEnabled = 1;
    NSAutomaticTextCompletionEnabled = 1;
    NSLinguisticDataAssetsRequestLastInterval = 86400;
    NSLinguisticDataAssetsRequestTime = "2022-10-26 14:45:16 +0000";
    NSLinguisticDataAssetsRequested =     (
        en
    );
    NSLinguisticDataAssetsRequestedByChecker =     (
        en
    );
    NSPreferredWebServices =     {
        NSWebServicesProviderWebSearch =         {
            NSDefaultDisplayName = Google;
            NSProviderIdentifier = "com.google.www";
        };
    };
    NSUserDictionaryReplacementItems =     (
                {
            on = 1;
            replace = omw;
            with = "On my way!";
        }
    );
    WebAutomaticSpellingCorrectionEnabled = 1;
    "com.apple.finder.SyncExtensions" =     {
        collaborationMap =         {
        };
        dirMap =         {
        };
    };
    "com.apple.sound.beep.flash" = 0;
    "com.apple.springing.delay" = "0.5";
    "com.apple.springing.enabled" = 1;
    "com.apple.trackpad.forceClick" = 1;
    "com.apple.trackpad.scaling" = 1;
    userMenuExtraStyle = 2;
}

defaults -currentHost read -globalDomain

{
    "com.apple.mouse.tapBehavior" = 1;
    "com.apple.trackpad.enableSecondaryClick" = 1;
    "com.apple.trackpad.fiveFingerPinchSwipeGesture" = 2;
    "com.apple.trackpad.fourFingerHorizSwipeGesture" = 2;
    "com.apple.trackpad.fourFingerPinchSwipeGesture" = 2;
    "com.apple.trackpad.fourFingerVertSwipeGesture" = 2;
    "com.apple.trackpad.momentumScroll" = 1;
    "com.apple.trackpad.pinchGesture" = 1;
    "com.apple.trackpad.rotateGesture" = 1;
    "com.apple.trackpad.scrollBehavior" = 2;
    "com.apple.trackpad.threeFingerDragGesture" = 0;
    "com.apple.trackpad.threeFingerHorizSwipeGesture" = 2;
    "com.apple.trackpad.threeFingerTapGesture" = 0;
    "com.apple.trackpad.threeFingerVertSwipeGesture" = 2;
    "com.apple.trackpad.twoFingerDoubleTapGesture" = 1;
    "com.apple.trackpad.twoFingerFromRightEdgeSwipeGesture" = 3;
    "com.apple.trackpad.version" = 5;
}

PS -
Not a duplicate of - What is 'currentHost' for, in defaults?

1 Answer 1

1

defaults Manual

According to the defaults manual page, the host and currentHost flags limit the scope of the information shown:

-currentHost : Restricts preferences operations to the host the user is currently logged in on.

-host hostname : Restricts preferences operations to hostname.

Use the command man defaults to see this documentation.

CoreFoundation

This tool and the flags functionality are ultimately built upon macOS's CoreFoundation Preferences Utilities:

Core Foundation provides a simple, standard way to manage user (and application) preferences. Core Foundation stores preferences as key-value pairs that are assigned a scope using a combination of user name, application ID, and host (computer) names. This makes it possible to save and retrieve preferences that apply to different classes of users. Core Foundation preferences is useful to all applications that support user preferences.

3
  • I have updated my question. I had already gone through the manual page just forgot to mention it. Commented May 30, 2023 at 17:22
  • The defaults manual page is the only "official explanation", with the underlying CoreFoundation implementation being the original reference implementation. Commented May 31, 2023 at 13:34
  • Okay, but the main question remains unanswered as to why the difference in the two command's output. Commented May 31, 2023 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .