Skip to main content
16 of 19
added 182 characters in body

defaults delete is not working

I've made a bit of a mess with my Mac 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".