1

I've made a bit of a mess with my Mac (macOS Ventura 13.5) whose shell is zsh. The problems started when I used python syntax to run commands, as it's a requirement apart of the project I'm doing to implement CIS benchmarks on my computer.

  • I never had AutomaticCheckEnabled on this Mac, so I was trying to make that change first with:
command = f"sudo defaults write {self.path} \"^{self.key}\" -int {target}"

Which in the terminal is:

sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate "^AutomaticCheckEnabled" -int 1

That incorrect formatting made the field exactly as "^AutomaticCheckEnabled", because I thought I had to do it similar to bash with python.

I tried to use delete the field I accidentally made, with the command

defaults delete /Library/Preferences/com.apple.SoftwareUpdate "^AutomaticCheckEnabled"

It didn't work and in which errors to:

Domain (/Library/Preferences/com.apple.SoftwareUpdate) not found. Defaults have not been changed.

So, I'm trying to figure out the best way to resolve this.

I eventually added the field with the right format, as you can see below here in the output of defaults read /Library/Preferences/com.apple.SoftwareUpdate. The old, incorrectly formatted field is at the bottom that I accidentally added, needing to be removed.

{
    AutomaticCheckEnabled = 1;
    LastAttemptBuildVersion = "13.4.1 (22F82)";
    LastAttemptSystemVersion = "13.4.1 (22F82)";
    LastBackgroundSuccessfulDate = "2023-07-24 13:19:33 +0000";
    LastFullSuccessfulDate = "2023-07-24 13:39:11 +0000";
    LastRecommendedMajorOSBundleIdentifier = "";
    LastRecommendedUpdatesAvailable = 1;
    LastResultCode = 2;
    LastSessionSuccessful = 1;
    LastSuccessfulDate = "2023-07-24 13:39:11 +0000";
    LastUpdatesAvailable = 1;
    PrimaryLanguages =     (
        "en-US",
        en
    );
    RecommendedUpdates =     (
                {
            "Display Name" = "macOS Security Response 13.4.1 (c)";
            "Display Version" = "13.4.1 (c)";
            Identifier = "MSU_UPDATE_22F770820d_patch_13.4.1_rsr";
            MobileSoftwareUpdate = 1;
            "Product Key" = "MSU_UPDATE_22F770820d_patch_13.4.1_rsr";
        }
    );
    SplatProductVersion = "macOS Security Response 13.4.1 (c) 13.4.1";
    TimeOfSemiSplatCompletion = "2023-07-24 13:22:41 +0000";
    "^AutomaticCheckEnabled" = 1;
}

I'm looking for guidance on how to fix the

Domain (/Library/Preferences/com.apple.SoftwareUpdate) not found. Defaults have not been changed.

error from running the command

defaults delete /Library/Preferences/com.apple.SoftwareUpdate "^AutomaticCheckEnabled"
4
  • I'm putting this on hold. @Anagonye Could you review my edits that hopefully help you complete the last sentence. What specifically do you need help with? What does "does not work" look like to you? Do you not know how to test this? Do you need specific help on cleaning things up? If you have a follow on question - please learn from all the questions - we may need you to pick a much clearer issue to help going forward. Once this is edited to have a specific question - please flag for a moderator to review my close and possible reopen this for an answer.
    – bmike
    Commented Jul 25, 2023 at 20:25
  • Comments have been moved to chat; please do not continue the discussion here. Before posting a comment below this one, please review the purposes of comments. Comments that do not request clarification or suggest improvements usually belong as an answer, on Ask Different Meta, or in Ask Different Chat. Comments continuing discussion may be removed.
    – bmike
    Commented Jul 25, 2023 at 20:25
  • There's no need to remove it. A setting that isn't used by the application will simply be ignored.
    – Barmar
    Commented Jul 28, 2023 at 19:47
  • Yeah but I need to know about it for future references.
    – Anagonye
    Commented Jul 29, 2023 at 20:10

2 Answers 2

1

I can't currently test this on anything with a sealed system volume, however, even prior to that there are a couple of things missing/wrong.

Firstly, you need sudo to change that parameter.
Secondly, I don't think it's wise to delete it as it's an 'always there' parameter, just set it the way you'd prefer it.
Thirdly, your 'command' is wrong. No quotes "" & no spurious ^ symbol. You set it with a boolean.

To disable, you need
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool false
& to enable, set the boolean the other way
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true

Confirmed this works on Mojave, as noted I can't test on anything newer right now.

The key, as it should appear in the file, is simply

<key>AutomaticCheckEnabled</key>
<true/>
8
  • Thank you for answering btw! But it's how it was formatted. I'm trying to delete a field I accidentally added a field through creating it through python and I formatted it wrongly, not a field that was already inside my system. So I'm deleting it due to it being unneccessary.
    – Anagonye
    Commented Jul 24, 2023 at 16:37
  • I really don't know how it would respond to a python command.
    – Tetsujin
    Commented Jul 24, 2023 at 16:48
  • Python is only being used to call the terminal commands
    – Anagonye
    Commented Jul 24, 2023 at 16:50
  • Then I don't understand why you're not using correct syntax.
    – Tetsujin
    Commented Jul 24, 2023 at 16:52
  • I used the incorrect syntax when I first created the field because I was doing it with bash in mind, not zsh. When doing parsing for terminal calls through python, you needed to do that type of syntax with bash. It was incidental.
    – Anagonye
    Commented Jul 24, 2023 at 17:18
0

The simplest fix is to delete all the preferences set for this one key by issuing this command:

defaults delete com.apple.SoftwareUpdate

Then restart the Mac. The reason is we can't guess what random garbage was written by your attempts. Deleting the update preferences are very safe as Apple will establish the default ones when it restarts. You can then view the System Settings to make sure you like the updates. Then you can be more methodical with the following:

defaults read com.apple.SoftwareUpdate

You want to use the new key and not the old /Library notation IMO. Once you have a dump of the exact default (or current if you change from the GUI) you can take the knowledge you've learned in this very worthwhile experiment and try with pure shell syntax to script your CIS changes. Those are very very tricky to do correctly so many people work together to share scripts open source style.

Each release has different syntax and you can browse the Jamf scripts for guidance or to use them within the license granted.

3
  • Hello bmike, that didn't work. It seemed like it didn't delete anything really or it didn't receive it. I did the first command successfully and tried the second defaults read command and it gives the error Domain com.apple.SoftwareUpdate does not exist. I'm assuming its because com.apple.SoftwareUpdate never existed on my laptop. I tried to do the same process with the path that actually holds the incorrect value and it still gives me the same error as in the question. I get errors of Domain (/Library/Preferences/com.apple.SoftwareUpdate) not found. Defaults have not been changed.
    – Anagonye
    Commented Jul 27, 2023 at 14:54
  • Thanks @Anagonye what is the macOS version number and build ?
    – bmike
    Commented Jul 27, 2023 at 15:10
  • MacBook Pro, macOS Ventura 13.5
    – Anagonye
    Commented Jul 28, 2023 at 11:59

You must log in to answer this question.

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