<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AFP548</title>
	<atom:link href="https://www.afp548.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.afp548.com</link>
	<description>Covering Apple IT</description>
	<lastBuildDate>Mon, 16 Nov 2026 21:23:10 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.4</generator>
	<item>
		<title>Glitch Disarms Mac Fleet: when last night&#8217;s macOS auto-update didn&#8217;t happen</title>
		<link>https://www.afp548.com/2026/11/15/glitch-disarms-mac-fleet-when-last-nights-macos-auto-update-didnt-happen/</link>
					<comments>https://www.afp548.com/2026/11/15/glitch-disarms-mac-fleet-when-last-nights-macos-auto-update-didnt-happen/#respond</comments>
		
		<dc:creator><![CDATA[Samuel Keeley]]></dc:creator>
		<pubDate>Sun, 15 Nov 2026 23:19:15 +0000</pubDate>
				<category><![CDATA[macOS]]></category>
		<category><![CDATA[AutoInstallProductKeys]]></category>
		<category><![CDATA[DDM]]></category>
		<category><![CDATA[gdmf]]></category>
		<category><![CDATA[install tonight]]></category>
		<category><![CDATA[softwareupdate]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387807</guid>

					<description><![CDATA[<p>macOS treats a failed update check as &#34;you're up to date&#34; and cancels tonight's install, and one of Apple's four update servers has been failing about a quarter of checks since November 12. Why last night's update didn't happen, and why fixing the server won't fix the Mac.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Update, November 16:</strong> Apple fixed <code>17.171.47.23</code>. Since about 21:05 UTC on November 16, every Mac and iOS model gets the update brain from it again. The macOS bug this post is about hasn&#8217;t changed.</p>
<p><strong>TL;DR</strong></p>
<ul>
<li><strong>macOS treats a failed update check as &quot;you&#8217;re up to date.&quot;</strong> When a scan fails for any reason (a server error, a timeout, a refused connection), softwareupdated publishes an empty list, drops the update from tonight&#8217;s queue and disarms install-tonight (the scheduled overnight install). It doesn&#8217;t distinguish a failed scan from a real &quot;nothing new&quot; when it replaces the list.</li>
<li><strong>One of Apple&#8217;s update servers made it a daily problem for four days.</strong> From November 12 to 16, <code>17.171.47.23</code>, one of the four addresses behind <code>gdmf.apple.com</code>, was missing the update brain every Mac needs for a scan, and Apple&#8217;s DNS handed it out in about a quarter of answers.</li>
<li><strong>Fixing the server won&#8217;t fix the Mac.</strong> Pulling a bad server out of DNS stops new hits, but armed Macs that already checked against it may have lost their night, and no error status I could find would change that on today&#8217;s Macs.</li>
<li><strong>A DDM declaration can stall on it too.</strong> If a declaration&#8217;s first scan hits a failure, it enforces nothing, reports no error, and may not try again until its daily DDM check.</li>
<li><strong>It looks completely clean.</strong> <code>install.log</code>, <code>softwareupdate</code> and System Settings all say &quot;nothing available,&quot; and DDM status has no <code>failure-reason</code>. Only the unified log has the error.</li>
<li><strong>A Command Line Tools key can cost the night.</strong> An empty scan can leave a Mac armed for the CLT alone, so the next overnight install is the CLT instead of macOS.</li>
</ul>
<p><a href="https://www.afp548.com/2026/11/13/the-morning-after-autoinstallproductkeys-waking-up-to-the-same-macos-a-field-guide/">The last post</a> was about the mornings a Mac didn&#8217;t update. Here&#8217;s another one, and this time the Mac did everything right until one routine check in the evening.</p>
<p>27.2.1 is downloaded, keyed and armed for tonight. In the evening, softwareupdated runs its routine check, and DNS sends it to the one broken Apple server, in North Carolina. It answers &quot;Assetset not found,&quot; softwareupdated disarms, and the Mac wakes up on the same macOS with the update still on disk.</p>
<p>Apple fixed the server. The real bug is on the Mac: macOS 27 treats any failed check as an empty one, on every Mac with automatic updates on, keyed or not. The server in North Carolina just made it happen to about a quarter of scans for four days in November.</p>
<h2 id="how-one-failed-scan-cancels-tonight">How one failed scan cancels tonight</h2>
<p>Follow that 404 through the Mac:</p>
<ol>
<li><strong>mobileassetd gets the 404 and gives up.</strong> It turns the HTTP status into a <a href="https://theapplewiki.com/wiki/MobileAsset">MobileAsset</a> error (a 404 is <code>MADownloadNotFound</code>) and marks it &quot;retry same,&quot; which sounds hopeful. The only retry it knows is falling back to Apple&#8217;s old XML catalog, and software update assets don&#8217;t have one. My own Mac logged the whole thought: <code>Failed MAPallasFailedRetrySame but asset type does not support XML fallback</code>.</li>
<li><strong>The scan drops what it couldn&#8217;t get.</strong> With no update brain, the scan fails with <code>7307</code>, and the side of the scan that failed (minor or major updates) comes back with no updates at all.</li>
<li><strong>softwareupdated publishes the list anyway.</strong> The <code>7307</code> goes back to whoever asked for the scan, but the code that sets <code>availableMobileSoftwareUpdates</code> doesn&#8217;t take an error. Whatever survived the scan gets published, which is usually nothing: <code>( )</code>.</li>
<li><strong>The disarm is a membership test.</strong> Right after publishing, if install-tonight has a queued update and it isn&#8217;t in the new list, softwareupdated cancels install-tonight: <code>Removing queued descriptor</code>, then <code>SUOSUScheduler: DISARMED</code>. It never looks at why the list is empty.</li>
</ol>
<p>An empty answer from Apple can mean an update was pulled, and dropping the arm is right. A 404 from one of four servers means nothing of the sort: the other three were offering 27.2.1 the whole time.</p>
<p>And it isn&#8217;t just 404s. Every way a check can fail ends the same way, and for network failures softwareupdated doesn&#8217;t even pass the error on. It logs <code>Not returning visible error to clients</code> and publishes the empty list.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>What the server does</th>
<th>What mobileassetd makes of it</th>
</tr>
</thead>
<tbody>
<tr>
<td>404 (the broken server)</td>
<td><code>MADownloadNotFound</code></td>
</tr>
<tr>
<td>Refuses the connection</td>
<td><code>MADownloadCannotConnectToHost</code></td>
</tr>
<tr>
<td>Times out</td>
<td><code>MADownloadTimedOutResource</code></td>
</tr>
<tr>
<td>Fails TLS</td>
<td><code>MADownloadNetworkingError</code></td>
</tr>
<tr>
<td>422</td>
<td><code>MADownloadNoMatchFound</code></td>
</tr>
<tr>
<td>429, and most other 4xx</td>
<td><code>MADownloadServerError</code></td>
</tr>
<tr>
<td>500 or 503, with or without <code>Retry-After</code></td>
<td><code>MADownloadServerInternalError</code></td>
</tr>
</tbody>
</table></div>
<p>All of them take the same path to a disarm: the first four in testing, the rest in the code, since mobileassetd pins <code>gdmf.apple.com</code> to Apple&#8217;s own CA and a proxy can&#8217;t fake them. I found nothing in mobileassetd or the software update frameworks that reads <code>Retry-After</code> or treats a 429 or 503 differently.</p>
<p>It doesn&#8217;t take Apple, either. A Mac that&#8217;s offline when a check is due waits for the network, but one that&#8217;s online with broken DNS, behind a captive portal, or loses Wi-Fi halfway through a check gets the same empty list.</p>
<h2 id="what-youll-see">What you&#8217;ll see</h2>
<p>From where an admin usually looks, nothing happened.</p>
<ul>
<li><code>install.log</code> shows a clean empty list, with no server error.</li>
<li><code>softwareupdate</code> says <code>No such update</code> for a label you know is out, and System Settings says &quot;Your Mac is up to date.&quot;</li>
<li>DDM status shows no <code>failure-reason</code>.</li>
</ul>
<p>Only the unified log has the error: the <code>7307</code> for the broken server, or <code>Not returning visible error to clients</code> for a network failure.</p>
<p>Nothing is thrown away. The update stays prepared, and the Mac re-arms at the next good check (about every six hours), or, if its unlock stash is gone, at the first password unlock after one. An unlock before a good check has nothing to arm, and softwareupdated says so in <code>install.log</code>:</p>
<pre><code>2026-11-13 13:37:30+00 Mac softwareupdated[283]: -[SUOSUServiceDaemon setClientExternalizedLocalAuthenticationContext:userId:forHarvestMode:completion:]_block_invoke: What? No available updates? This shouldn't have been called if that were the case.
</code></pre>
<p>If no good check comes before the night, the night is gone.</p>
<h2 id="a-declaration-that-does-nothing">A declaration that does nothing</h2>
<p>The same failure hits plain DDM software update declarations. When a declaration arrives, softwareupdated scans for its target version right away. If that scan lands on the broken server, the brain query fails, the fallback scan fails the same way, and that&#8217;s the end of it:</p>
<pre><code>-[SUOSUManagedServiceDaemon scanForDescriptorWithPMV:buildVersion:completion:]_block_invoke: No DDM updates found, fallback to scanning without PMV
SUOSUManagedServiceDaemon: No updates found for DDM to enforce
</code></pre>
<p>Nothing downloads, and <code>ManagedProductMarketingVersion</code> (the version pin the declaration set) is cleared. The Mac reports the declaration as active and valid, with no reasons and no <code>failure-reason</code>, so your MDM shows the declaration active and valid while nothing happens.</p>
<p>It doesn&#8217;t try again on its own, either. With the pin cleared, the next good background check logs <code>Found DDM enforced install</code> but handles the update like any other, and on a Mac without <code>AutoInstallProductKeys</code> it won&#8217;t download one that&#8217;s still ramped (<code>is ramped, not downloadable at this time</code>). The declaration may wait for its daily DDM check (more often near the deadline) or a change. An edit makes it scan again right away, but it also purges prepared updates on every Mac the declaration covers, and the new scan can hit the broken server again.</p>
<h2 id="the-command-line-tools-take-the-night">The Command Line Tools take the night</h2>
<p>In the last post I said a Command Line Tools key can ride along with a keyed macOS update, but can&#8217;t arm on its own. An empty scan broke the second part.</p>
<p>It removes macOS from the queue, but the CLT stays on its own install-later list. The next periodic check finds only the CLT eligible, because of its key, and arms for it alone. When a good scan brings macOS back, later checks log <code>already armed for later</code> and can&#8217;t add it. So the next overnight install is the Command Line Tools, which don&#8217;t even need a restart. You wanted macOS and got a new <code>clang</code>. Without the CLT key, the empty scan arms nothing and the next good check arms macOS.</p>
<p>So a CLT key can leave a Mac doing something you didn&#8217;t expect after a bad scan, and removing the key doesn&#8217;t cancel a CLT-only arm that&#8217;s already set.</p>
<h2 id="where-gdmf-lives">Where gdmf lives</h2>
<p><code>gdmf.apple.com</code> is where every Mac, iPhone and iPad asks Apple which updates exist (<a href="https://support.apple.com/en-us/101555">Apple lists it</a> as the software update catalog). It&#8217;s IPv4 only, with four addresses (edges) behind its CNAME, <code>gdmf.v.aaplimg.com</code>. Going by ping times, each is in one of Apple&#8217;s US data centers.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Edge</th>
<th>Apparent site</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>17.23.18.34</code></td>
<td>Mesa, Arizona</td>
</tr>
<tr>
<td><code>17.111.103.20</code></td>
<td>Reno, Nevada</td>
</tr>
<tr>
<td><code>17.137.162.3</code></td>
<td>Prineville, Oregon</td>
</tr>
<tr>
<td><strong><code>17.171.47.23</code></strong></td>
<td><strong>Maiden, North Carolina</strong></td>
</tr>
</tbody>
</table></div>
<p>Apple&#8217;s DNS hands all four out everywhere, so a Mac in Seattle can be sent to North Carolina. About a quarter of answers are the broken one, and a Mac lands on it on some scans and not others.</p>
<p>Apple could cheaply improve that for today&#8217;s Macs. Each answer has only one address. Put all four in every answer (plain round-robin DNS) and the Mac&#8217;s networking stack moves to the next one on its own when an edge refuses the connection or times out, so a dead edge costs a connection attempt instead of a night. It wouldn&#8217;t help with a 404 from an edge that connects fine, or a Mac still holding an open connection to a bad one.</p>
<h2 id="what-north-carolina-was-missing">What North Carolina was missing</h2>
<p>The North Carolina edge was missing some asset sets. A request modeled on a Mac&#8217;s got wrong answers back.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Query</th>
<th><code>17.171.47.23</code>, November 12 to 16</th>
<th>The other three</th>
</tr>
</thead>
<tbody>
<tr>
<td>The Mac update brain (every Mac model, from 15, 26 or 27)</td>
<td>404, &quot;Assetset not found&quot;</td>
<td>200</td>
</tr>
<tr>
<td>The macOS update list, for the 12 models listed below</td>
<td>422, &quot;getAsset_404&quot; (200 since November 15)</td>
<td>200</td>
</tr>
<tr>
<td>The macOS update list, every other model</td>
<td>200</td>
<td>200</td>
</tr>
<tr>
<td>The iOS update brain</td>
<td>422</td>
<td>200</td>
</tr>
</tbody>
</table></div>
<p>The 422 was odd on its own. It means &quot;Unprocessable Entity,&quot; but the body said <code>getAsset_404</code>, an internal &quot;not found.&quot; A 404 wearing a 422.</p>
<p>The update brain is an asset softwareupdated fetches as part of every scan; it carries the logic for applying updates (<a href="https://eclecticlight.co/2026/03/02/how-macos-26-tahoe-updates-1/">Howard Oakley&#8217;s walk through a Tahoe update</a> shows where it fits). No brain, no scan: softwareupdated logs <code>[SUMacControllerErrorScanNoUpdateBrainFound=7307] Failed to locate update brain asset</code> and gives up. So every Mac is affected, and until November 15 these 12 lost the update list too.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Identifier</th>
<th>Model</th>
</tr>
</thead>
<tbody>
<tr>
<td>iMac20,2</td>
<td>iMac (Retina 5K, 27-inch, 2020)</td>
</tr>
<tr>
<td>iMacPro1,1</td>
<td>iMac Pro</td>
</tr>
<tr>
<td>Mac13,1</td>
<td>Mac Studio (M1 Max)</td>
</tr>
<tr>
<td>Mac14,2</td>
<td>MacBook Air (M2, 2022)</td>
</tr>
<tr>
<td>Mac14,7</td>
<td>MacBook Pro (13-inch, M2, 2022)</td>
</tr>
<tr>
<td>Mac15,8</td>
<td>MacBook Pro (14-inch, 16-core M3 Max, Nov 2023)</td>
</tr>
<tr>
<td>Mac17,7</td>
<td>MacBook Pro (14-inch, M5 Max)</td>
</tr>
<tr>
<td>Mac18,2</td>
<td>iMac (24-inch, M6, 2026)</td>
</tr>
<tr>
<td>MacBookPro15,3</td>
<td>MacBook Pro (15-inch, 2019)</td>
</tr>
<tr>
<td>MacBookPro16,4</td>
<td>MacBook Pro (16-inch, 2019)</td>
</tr>
<tr>
<td>MacBookPro18,3</td>
<td>MacBook Pro (14-inch, M1 Pro, 2021)</td>
</tr>
<tr>
<td>Macmini9,1</td>
<td>Mac mini (M1, Late 2020)</td>
</tr>
</tbody>
</table></div>
<p>iPhones and iPads got a failed brain query there too, with their update lists fine.</p>
<p>On the North Carolina edge, a 27.0.1 Mac&#8217;s Software Update says it&#8217;s up to date:</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__14_bad_edge_up_to_date.png"><img fetchpriority="high" decoding="async" class="wp-image-387809" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__14_bad_edge_up_to_date.png" alt="Software Update on the broken server: &quot;Your Mac is up to date,&quot; macOS 27.0.1" width="756" height="641" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__14_bad_edge_up_to_date.png 1512w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__14_bad_edge_up_to_date-300x254.png 300w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__14_bad_edge_up_to_date-1024x868.png 1024w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__14_bad_edge_up_to_date-768x651.png 768w" sizes="(max-width: 756px) 100vw, 756px" /></a></p>
<p>A few minutes later on a good edge, the same Mac offers 27.2.1:</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__15_good_edge_offers_27_2_1.png"><img decoding="async" class="wp-image-387810" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__15_good_edge_offers_27_2_1.png" alt="Software Update on a good server: macOS 27.2.1, with Update Tonight and Update Now" width="756" height="641" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__15_good_edge_offers_27_2_1.png 1512w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__15_good_edge_offers_27_2_1-300x254.png 300w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__15_good_edge_offers_27_2_1-1024x868.png 1024w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__15_good_edge_offers_27_2_1-768x651.png 768w" sizes="(max-width: 756px) 100vw, 756px" /></a></p>
<p>Going by my logs, it was broken from at least November 12 at 06:12 UTC, when my lab Macs first got the brain 404 (my own Mac&#8217;s first was at 08:07). The update lists came back on November 15 at about 17:40 UTC, and the brain on November 16 between about 20:54 and 21:06 UTC, server by server.</p>
<h2 id="fixing-the-server-isnt-enough">Fixing the server isn&#8217;t enough</h2>
<p>Apple can fix the server or pull it from DNS, which reaches most Macs within the record&#8217;s five-minute TTL, though mobileassetd can keep using an open connection for a while. Neither gives anything back: any armed Mac that checked against it while it was in rotation may already have disarmed.</p>
<h2 id="how-to-check-a-mac">How to check a Mac</h2>
<p>How many of this Mac&#8217;s scans failed on the missing brain in the last two days:</p>
<pre><code>log show --last 2d --style compact --predicate 'process == &quot;softwareupdated&quot; AND composedMessage CONTAINS &quot;Event:ScanFailed State:ScanningForUpdateBrain&quot;' | grep -c '^20'
</code></pre>
<p>Which edge this Mac gets right now (the answer is cached for up to five minutes, so check again later rather than straight away):</p>
<pre><code>dscacheutil -q host -a name gdmf.apple.com
</code></pre>
<p>Which edge each scan actually used is harder, because mDNSResponder logs DNS answers only as per-Mac hashes. This script calibrates them with five lookups of its own (<code>gdmf.apple.com</code>, then <code>&lt;edge&gt;.sslip.io</code> for each edge, a third-party DNS service; <code>Calibrated 0 of 4</code> means your DNS blocks it), then matches each scan to the answer logged while it ran. Otherwise it only reads. It needs <code>swift</code> from Xcode or the Command Line Tools (without them, <code>swift</code> offers to install them): save it as <code>gdmf-scans.swift</code>, <code>chmod +x</code> it, and run <code>sudo ./gdmf-scans.swift</code>.</p>
<pre><code class="language-swift">#!/usr/bin/swift
// gdmf-scans.swift: which gdmf.apple.com server each of this Mac's recent update scans used, and how the scan ended.
// Read-only. Run it with sudo: sudo ./gdmf-scans.swift
/*
mDNSResponder logs DNS answers only as short hashes, the same on one Mac but different on every other. So the script first looks up gdmf.apple.com, then each known gdmf edge by a name that answers with that address (&lt;ip&gt;.sslip.io), and notes which hash this Mac logs for each. Then, for each scan, it reads the gdmf answer mDNSResponder logged during it.
*/
import Foundation
import OSLog

let EDGES = [&quot;17.23.18.34&quot;, &quot;17.111.103.20&quot;, &quot;17.137.162.3&quot;, &quot;17.171.47.23&quot;]
let BROKEN = &quot;17.171.47.23&quot;
let HOURS = 48.0

// The capture groups of the first match of a pattern, or nil. Compiled patterns are cached.
var compiled: [String: NSRegularExpression] = [:]
func search(_ pattern: String, _ text: String) -&gt; [String]? {
    if compiled[pattern] == nil { compiled[pattern] = try! NSRegularExpression(pattern: pattern) }
    guard let match = compiled[pattern]!.firstMatch(in: text, range: NSRange(text.startIndex..., in: text)) else { return nil }
    return (1..&lt;match.numberOfRanges).map { i in Range(match.range(at: i), in: text).map { String(text[$0]) } ?? &quot;&quot; }
}

// Log messages between two times for a predicate, keeping those that match a pattern. Each call opens the store again, because a store only sees entries logged before it was opened.
func logLines(_ predicate: String, from start: Date, to end: Date, matching pattern: String) -&gt; [(time: Date, message: String)] {
    guard let store = try? OSLogStore.local() else {
        print(&quot;Can't open the log store. Run it with sudo.&quot;)
        exit(1)
    }
    let entries = (try? store.getEntries(at: store.position(date: start), matching: NSPredicate(format: predicate))) ?? AnySequence([])
    var lines: [(time: Date, message: String)] = []
    for entry in entries {
        let done: Bool = autoreleasepool {
            if entry.date &gt; end { return true }
            let message = entry.composedMessage
            if search(pattern, message) != nil { lines.append((entry.date, message)) }
            return false
        }
        if done { break }
    }
    return lines
}

// Look a name up through mDNSResponder and return its IPv4 addresses.
func resolve(_ host: String) -&gt; [String] {
    var hints = addrinfo(ai_flags: 0, ai_family: AF_INET, ai_socktype: SOCK_STREAM, ai_protocol: 0, ai_addrlen: 0, ai_canonname: nil, ai_addr: nil, ai_next: nil)
    var result: UnsafeMutablePointer&lt;addrinfo&gt;?
    guard getaddrinfo(host, &quot;443&quot;, &amp;hints, &amp;result) == 0 else { return [] }
    defer { freeaddrinfo(result) }
    var addresses = Set&lt;String&gt;()
    var next = result
    while let info = next {
        let ip = info.pointee.ai_addr.withMemoryRebound(to: sockaddr_in.self, capacity: 1) { String(cString: inet_ntoa($0.pointee.sin_addr)) }
        addresses.insert(ip)
        next = info.pointee.ai_next
    }
    return addresses.sorted()
}

// 1. Calibrate: gdmf.apple.com first, then one lookup per edge.
let calibrationStart = Date().addingTimeInterval(-1)
_ = resolve(&quot;gdmf.apple.com&quot;)
let asked = EDGES.filter { resolve(&quot;\($0).sslip.io&quot;).contains($0) }
Thread.sleep(forTimeInterval: 1.5)  // mDNSResponder's lines reach the log a moment later

let pid = ProcessInfo.processInfo.processIdentifier
let soon = Date().addingTimeInterval(5)
let starts = logLines(&quot;process == \&quot;mDNSResponder\&quot; AND composedMessage CONTAINS \&quot;client pid: \(pid) \&quot;&quot;, from: calibrationStart, to: soon, matching: &quot;getaddrinfo start|DNSServiceQueryRecord START&quot;)
let results = logLines(&quot;process == \&quot;mDNSResponder\&quot; AND (composedMessage CONTAINS \&quot;getaddrinfo result\&quot; OR composedMessage CONTAINS \&quot;DNSServiceQueryRecord result\&quot;)&quot;, from: calibrationStart, to: soon, matching: &quot;type: (?:A|CNAME), rdata:&quot;)

// This script's own requests, in order, each name once: (request id, name hash).
var requests: [(id: String, name: String)] = []
for line in starts {
    if let g = search(#&quot;\[(R\d+)\] (?:getaddrinfo start|DNSServiceQueryRecord START) .*?(?:hostname|qname): \S+ &lt;dn:([^&gt;]+)&gt;&quot;#, line.message), !requests.contains(where: { $0.name == g[1] }) {
        requests.append((g[0], g[1]))
    }
}
// Every answer, by request id: (name hash, record type, address hash).
var answers: [String: [(name: String, type: String, rdata: String)]] = [:]
for line in results {
    if let g = search(#&quot;\[(R\d+)-&gt;Q\d+\] (?:getaddrinfo|DNSServiceQueryRecord) result .*?name(?: hash)?: &lt;dn:([^&gt;]+)&gt;, type: (A|CNAME), rdata: (?:&lt;private&gt; )?&lt;(?:ipv4|rd):([^&gt;]+)&gt;&quot;#, line.message) {
        answers[g[0], default: []].append((g[1], g[2], g[3]))
    }
}

guard !requests.isEmpty else {
    print(&quot;Couldn't find this script's own lookups in mDNSResponder's log.&quot;)
    exit(1)
}
let gdmfAnswers = answers[requests.removeFirst().id] ?? []
// The hash of the name the gdmf answers are logged under (gdmf.v.aaplimg.com).
guard let target = gdmfAnswers.first(where: { $0.type == &quot;CNAME&quot; })?.rdata ?? gdmfAnswers.first(where: { $0.type == &quot;A&quot; })?.name else {
    print(&quot;Couldn't calibrate the gdmf name.&quot;)
    exit(1)
}
var edgeFor: [String: String] = [:]  // address hash -&gt; edge
for (ip, request) in zip(EDGES, requests) where asked.contains(ip) {  // requests are in lookup order, one per edge
    if let a = (answers[request.id] ?? []).last(where: { $0.type == &quot;A&quot; }) {
        edgeFor[a.rdata] = ip
    }
}
print(&quot;Calibrated \(edgeFor.count) of \(EDGES.count) edges.\n&quot;)

// 2. The scans, from softwareupdated's own log.
struct Scan {
    var start: Date
    var kind: String
    var outcome = &quot;&quot;
    var end: Date? = nil
    var edge = &quot;&quot;
}
var scans: [Scan] = []
let scanLines = logLines(&quot;process == \&quot;softwareupdated\&quot; AND (composedMessage CONTAINS \&quot;Starting scan with options\&quot; OR composedMessage CONTAINS \&quot;Event:ScanFailed\&quot; OR composedMessage CONTAINS \&quot;Setting availableMobileSoftwareUpdates\&quot;)&quot;, from: Date().addingTimeInterval(-HOURS * 3600), to: Date(), matching: &quot;Starting scan|ScanFailed|availableMobileSoftwareUpdates&quot;)
for (time, message) in scanLines {
    if let g = search(#&quot;Starting scan with options: Background=(\d)&quot;#, message) {
        scans.append(Scan(start: time, kind: g[0] == &quot;1&quot; ? &quot;background&quot; : &quot;user or CLI&quot;))
        continue
    }
    guard var scan = scans.last, scan.end == nil else { continue }
    if message.contains(&quot;State:ScanningForSplatUpdates&quot;) { continue }  // the separate security-update check fails on every edge alike
    if let g = search(#&quot;Event:ScanFailed State:(\w+)&quot;#, message) {
        scan.outcome = &quot;failed (\(g[0]))&quot;
    } else if search(#&quot;Setting availableMobileSoftwareUpdates = \(\s*\)&quot;#, message) != nil {
        scan.outcome = &quot;empty&quot;
    } else if message.contains(&quot;Setting availableMobileSoftwareUpdates = (&quot;) {
        scan.outcome = &quot;offered&quot;
    } else {
        continue
    }
    scan.end = time
    scans[scans.count - 1] = scan
}

// 3. For each scan, the last fresh gdmf answer mDNSResponder logged while it ran.
let answerPattern = #&quot; result .*&lt;dn:&quot;# + NSRegularExpression.escapedPattern(for: target) + #&quot;&gt;.*type: A, rdata: (?:&lt;private&gt; )?&lt;(?:ipv4|rd):([^&gt;]+)&gt;.*expired: no&quot;#
for i in scans.indices {
    guard let end = scans[i].end else { continue }
    let from = end.timeIntervalSince(scans[i].start) &lt; 300 ? scans[i].start.addingTimeInterval(-2) : end.addingTimeInterval(-60)
    let lookups = logLines(&quot;process == \&quot;mDNSResponder\&quot;&quot;, from: from, to: end, matching: answerPattern)
    if let last = lookups.last, let g = search(answerPattern, last.message) {
        scans[i].edge = edgeFor[g[0]] ?? &quot;(unknown edge)&quot;
    } else {
        scans[i].edge = &quot;(no lookup during the scan)&quot;
    }
}

let formatter = DateFormatter()
formatter.dateFormat = &quot;yyyy-MM-dd HH:mm:ss&quot;
func pad(_ s: String, _ width: Int) -&gt; String { s.padding(toLength: max(width, s.count), withPad: &quot; &quot;, startingAt: 0) }

print(pad(&quot;Scan (local)&quot;, 19), pad(&quot;Kind&quot;, 11), pad(&quot;Outcome&quot;, 34), &quot;gdmf edge&quot;, separator: &quot;  &quot;)
for scan in scans where scan.end != nil {
    let flag = scan.edge == BROKEN ? &quot;  &lt;- the broken edge&quot; : &quot;&quot;
    print(pad(formatter.string(from: scan.start), 19), pad(scan.kind, 11), pad(scan.outcome, 34), scan.edge + flag, separator: &quot;  &quot;)
}
</code></pre>
<p>On a Mac that has been hitting the bad edge, it looks like this, trimmed to the last three scans:</p>
<pre><code>Calibrated 4 of 4 edges.

Scan (local)         Kind         Outcome                             gdmf edge
2026-11-15 02:06:13  background   offered                             (no lookup during the scan)
2026-11-15 08:10:07  background   failed (ScanningForUpdateBrain)     17.171.47.23  &lt;- the broken edge
2026-11-15 14:07:53  background   offered                             17.137.162.3
</code></pre>
<p><code>(no lookup during the scan)</code> means either the lines have aged out (mDNSResponder keeps about a day of them) or the scan reused an open connection and never looked the name up.</p>
<p>And what it cost:</p>
<pre><code>grep -E 'SUOSUScheduler: (ARMED|DISARMED)|Removing queued descriptor' /var/log/install.log | tail -6
</code></pre>
<p>An armed Mac going through one scan on the broken server looks like this:</p>
<pre><code>2026-11-14 12:35:15-08 Mac softwareupdated[281]: SUOSUScheduler: ARMED (mode=1, simulated=NO)
2026-11-14 12:36:30-08 Mac softwareupdated[281]: SUOSUInstallTonightManager: Removing queued descriptor SUMacControllerDescriptor(UUID:12FAA7C2-C30D-5464-8DE4-0D3CD0627DF4 SU:macOS 27.2.1 26B131 (Customer)(SU) ...
2026-11-14 12:36:30-08 Mac softwareupdated[281]: SUOSUScheduler: DISARMED (mode=1)
2026-11-14 12:37:45-08 Mac softwareupdated[281]: SUOSUScheduler: ARMED (mode=1, simulated=NO)
</code></pre>
<p>The disarm came a second after that scan started. (I forced the re-arm here with a background check and a password unlock; left alone, it waits for the next good check.) A <code>DISARMED</code> with no <code>ARMED</code> after it before the night is a lost night. Don&#8217;t run <code>softwareupdate -l</code> to hurry it: that&#8217;s a scan too, and every scan a script or EA runs is another chance to land on a broken edge.</p>
<h2 id="what-to-do-about-it">What to do about it</h2>
<ul>
<li><strong>Don&#8217;t pin a good edge fleet-wide.</strong> A <code>gdmf.apple.com</code> line in <code>/etc/hosts</code> pointing at a good edge fixes a Mac within a few minutes, but Apple moves these addresses, and a pin that goes stale breaks every update check on every Mac that has it.</li>
<li><strong>Don&#8217;t block the bad address either.</strong> A refused connection disarms the same way.</li>
<li><strong>Nudge a stalled declaration</strong> by moving the stalled Macs to their own copy of it, so the change doesn&#8217;t purge anyone else&#8217;s prepared update. A stalled Mac has logged <code>No updates found for DDM to enforce</code>, and your MDM shows the declaration active with no pending version.</li>
<li><strong>Leave a few days between a declaration and its deadline</strong>, since a failed first scan may not be retried until the next daily check.</li>
<li><strong>File a Feedback asking for software update to be resilient to server and network errors.</strong> The server will get fixed either way.</li>
</ul>
<p>The fix that matters is in softwareupdated and mobileassetd. Here&#8217;s what I&#8217;d ask Apple to change:</p>
<ol>
<li>Don&#8217;t cancel install-tonight when a scan errored, for any reason, including the 8400s that are hidden from clients. Keep the previous result and the arm instead of publishing an empty list.</li>
<li>Retry a failed asset query on a fresh connection, ideally to another address. mobileassetd keeps its connection open between requests, so a check half a minute after a bad one can still go to North Carolina.</li>
<li>On a transient failure, fall back to the brain already on disk for an update that&#8217;s prepared and armed, instead of failing the scan.</li>
<li>Retry a declaration&#8217;s scan after it fails, instead of waiting for the next daily check.</li>
<li>Let a later good scan add macOS to an arm that&#8217;s already set, instead of <code>already armed for later</code> keeping it out until another check.</li>
<li>Report a failed scan as a failure: in <code>install.log</code>, in Software Update and in DDM status&#8217;s <code>softwareupdate.failure-reason</code>.</li>
</ol>
<p>Most scans landed on one of the three good servers, and a Mac that lost its arm in the evening often got it back at the next good check. Apple has fixed the server in North Carolina, so this is back to being a bug you only hit on a bad network or a bad day at Apple. That&#8217;s still a bug. The Mac had the update downloaded, prepared and armed, and it let one 404 talk it out of installing.</p>
<p>Further reading:</p>
<ul>
<li><a href="https://eclecticlight.co/2026/03/02/how-macos-26-tahoe-updates-1/">How macOS 26 Tahoe updates</a>, Howard Oakley&#8217;s series, especially <a href="https://eclecticlight.co/2026/03/09/how-macos-26-tahoe-updates-3-catalogues-and-preparing-to-download/">part 3</a> on catalogs and <a href="https://eclecticlight.co/2026/03/18/how-macos-26-tahoe-updates-4-download-preparation-and-installation/">part 4</a> on download, preparation and installation.</li>
<li><a href="https://eclecticlight.co/2022/03/19/explainer-macos-updaters/">Explainer: macOS updaters</a>, also Eclectic Light, on what the update brain is.</li>
<li><a href="https://theapplewiki.com/wiki/MobileAsset">MobileAsset</a> on The Apple Wiki, and <a href="https://github.com/cj123/pallas">cj123/pallas</a> and <a href="https://github.com/blacktop/ipsw">blacktop/ipsw</a>, for the requests a Mac sends to <code>gdmf.apple.com</code>.</li>
<li><a href="https://jhftss.github.io/The-Nightmare-of-Apple-OTA-Update/">The Nightmare of Apple&#8217;s OTA Update</a>, Mickey Jin&#8217;s security research into the update path, including the brain.</li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2026/11/15/glitch-disarms-mac-fleet-when-last-nights-macos-auto-update-didnt-happen/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>The Morning After AutoInstallProductKeys: Waking Up to the Same macOS, a Field Guide</title>
		<link>https://www.afp548.com/2026/11/13/the-morning-after-autoinstallproductkeys-waking-up-to-the-same-macos-a-field-guide/</link>
					<comments>https://www.afp548.com/2026/11/13/the-morning-after-autoinstallproductkeys-waking-up-to-the-same-macos-a-field-guide/#respond</comments>
		
		<dc:creator><![CDATA[Samuel Keeley]]></dc:creator>
		<pubDate>Fri, 13 Nov 2026 19:22:44 +0000</pubDate>
				<category><![CDATA[macOS]]></category>
		<category><![CDATA[AutoInstallProductKeys]]></category>
		<category><![CDATA[DDM]]></category>
		<category><![CDATA[install tonight]]></category>
		<category><![CDATA[ManagedProductMarketingVersion]]></category>
		<category><![CDATA[softwareupdate]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387799</guid>

					<description><![CDATA[<p>Ramp resets kept Macs from updating for a month. This bug says &#34;hold my beer&#34;: three months stranded on an old macOS. A field guide to the mornings AutoInstallProductKeys didn't update your Mac, and how to fix each one.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>TL;DR</strong></p>
<ul>
<li><strong>macOS&#8217;s cleanup for a removed software update declaration has never worked.</strong> It leaves <code>ManagedProductMarketingVersion</code> behind, and from then on every scan asks Apple for the old version and nothing newer, for about three months. Delete it as root (and please don&#8217;t write it yourself). Retargeting a declaration in place is fine; taking it away from a Mac that hasn&#8217;t installed it yet isn&#8217;t.</li>
<li><strong>Remove a declaration while someone&#8217;s logged in and the Mac is still downloading, and the download usually wins.</strong> The Mac finishes the update you just took away. Remove at <code>prepared</code>.</li>
<li><strong>When <code>AutoInstallProductKeys</code> &quot;does nothing,&quot; it&#8217;s usually priorities.</strong> Its download is the lowest priority Software Update has, so an update that a declaration or the CLI prepared turns it away, and a superseded update never arms.</li>
<li><strong>A declaration can delete itself</strong> a few seconds after it arrives and take a stale prepared update with it: no 17 GB of free space, no timing. The predicate is below.</li>
<li><strong>The surprise &quot;schedule the software update for tonight&quot; prompt</strong> is Software Update re-queuing an update without a password, and Cancel wipes <code>AutoInstallProductKeys</code>.</li>
</ul>
<p><a href="https://www.afp548.com/2026/11/09/bypass-the-ramp-update-tonight-faster-macos-updates-with-autoinstallproductkeys/">The last post</a> ended with Macs updating overnight. This one is about the mornings they didn&#8217;t.</p>
<p>Say 27.2.1 is out, the script from the last post has added it to <code>AutoInstallProductKeys</code> on every Mac (I&#8217;ll just call that the key from here on), and most of them install it overnight, like they&#8217;re supposed to. A few wake up on 27.0.1. Same as yesterday. You check one: 27.2.1 is in <code>AutoInstallProductKeys</code>, nothing&#8217;s downloading, and System Settings is offering 27.2. Not 27.2.1. 27.2, the release 27.2.1 replaced. Every scan in the log is asking Apple for 27.2 by name.</p>
<p>Those Macs all had a software update declaration for 27.2 at some point, and it went away before they installed it. When a declaration goes away, macOS cleans up after it by setting <code>ManagedProductMarketingVersion</code> to nil. The setter only accepts strings. So the cleanup has never worked. Not once, on any Mac, whatever your MDM. The key stays, and the Mac keeps asking Apple for 27.2.</p>
<p>For how long? Until Apple stops serving 27.2, about 90 days after the next release replaces it.</p>
<p>In the last post, back-to-back releases kept resetting the ramp, so automatic updates could go a month without happening. I thought that was bad. This bug says &quot;hold my beer.&quot; Three months stranded on an old release, missing every security fix in between, and that&#8217;s before you count how old the release the Mac is running already was: a 27.0.1 Mac stranded in November is still offered nothing newer than 27.2 in February, by which point 27.0.1 is more than four months old.</p>
<p>Chasing that one led to the rest of this post: why the key sometimes does nothing, where that password prompt comes from, and how to get a declaration to delete itself on purpose. Each section starts with what you&#8217;d see, then why it happens, how to check, and what to do. I&#8217;ve tried to explain the why every time, because the next odd case won&#8217;t be in here.</p>
<p>Before that: Greg Neagle has written <a href="https://github.com/gregneagle/autoupdatehelper">autoupdatehelper</a>, a Swift take on the script from the last post. It builds its keys from <code>RecommendedUpdates</code> only, adds pending Safari and Command Line Tools updates, can wait a set number of days after an update appears before keying it (<code>updateDelayDays</code>, an easy way to run your own ramp), and logs to the unified log. If you&#8217;d rather deploy a binary than a JXA script, start there.</p>
<h2 id="three-things-that-decide-everything">Three things that decide everything</h2>
<p>Almost every case here comes down to one of three pieces of state.</p>
<ul>
<li><strong>The pin.</strong> <code>ManagedProductMarketingVersion</code> in <code>/Library/Preferences/com.apple.SoftwareUpdate.plist</code>. While it&#8217;s set, every scan asks Apple for that one version and gets nothing newer. Declarations set it. Nothing on the Mac reliably clears it after they&#8217;re gone.</li>
<li><strong>The prepared update, and its priority.</strong> Software Update works on one update at a time. &quot;Prepared&quot; means downloaded and staged to apply at the next restart. Control of that one slot goes to one client at a time, with a priority: <code>Background</code> (200) for the key&#8217;s background download, <code>ClientInitiated</code> (300) for nearly everything else. A lower priority can&#8217;t take the slot from a higher one.</li>
<li><strong>The arm.</strong> To restart and install with nobody there, Software Update needs the user&#8217;s password. A password unlock after the prepare captures it (Software Update calls that the stash), and then it arms: it schedules a <code>dasd</code> activity that fires during a Smart Power Nap, once the Mac has been locked with the display off for about two hours.</li>
</ul>
<h2 id="stuck-on-an-update-it-should-have-moved-past">Stuck on an update it should have moved past</h2>
<p><em>Applies to Macs that have had a DDM software update declaration.</em></p>
<p><strong>What you see.</strong> A Mac on 27.0.1 keeps offering 27.2, days after 27.2.1 came out. Your 27.2.1 key does nothing, and DDM status says it&#8217;s pending 27.2. Somewhere along the way the Mac had a software update declaration, and it went away (removed, rescoped, or replaced by one that doesn&#8217;t cover it) before the Mac installed what it asked for.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__10_pinned_pane_offers_only_27_2.png"><img decoding="async" class="wp-image-387802" width="756" height="640" src="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__10_pinned_pane_offers_only_27_2.png" alt="A 27.0.1 Mac pinned to 27.2: System Settings offers 27.2 and only 27.2, with 27.2.1 already out" srcset="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__10_pinned_pane_offers_only_27_2.png 756w, https://www.afp548.com/wp-content/uploads/2026/11/shots1x__10_pinned_pane_offers_only_27_2-300x254.png 300w" sizes="(max-width: 756px) 100vw, 756px" /></a></p>
<p><strong>Why.</strong> When an enforcement declaration is scheduled, <code>softwareupdated</code> writes its target version into <code>ManagedProductMarketingVersion</code>. From then on, every scan sends that version to Apple as <code>RequestedProductVersion</code>, and Apple answers with exactly that version. That&#8217;s how a declaration gets you 27.2 instead of whatever&#8217;s newest, and while the declaration is there, it&#8217;s what you want.</p>
<p>Two places in macOS try to clear the key once the declaration&#8217;s job is done. One of them works.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Path</th>
<th>When it runs</th>
<th>Works?</th>
</tr>
</thead>
<tbody>
<tr>
<td>The declaration&#8217;s own fallback</td>
<td>While the declaration is still active: once the Mac is on the declared version, its next pinned scan logs <code>Managed PMV (27.2) is the same as current OS</code>, then <code>No DDM updates found, fallback to scanning without PMV</code>, and clears the key</td>
<td>Yes</td>
</tr>
<tr>
<td>The clear on removal</td>
<td>When the declaration is removed or changed: <code>SoftwareUpdateSubscriber</code> sets the key to nil</td>
<td>Never. The setter only accepts a string, so nil fails a type check before anything is written: <code>SUPreferenceManagerErrorDomain Code=3</code></td>
</tr>
</tbody>
</table></div>
<p>So it comes down to which happened first. A Mac that reached the declared version while the declaration was still there is clean. A Mac that lost the declaration first keeps the pin.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_1_pin.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_1_pin.svg" alt="How the pin is written and cleared" /></a></p>
<p><strong>That&#8217;s a bug.</strong> The removal code clearly means to clear the key, and it can&#8217;t, because it hands nil to a setter that only takes strings. It isn&#8217;t one MDM&#8217;s problem either: I get the same <code>Code=3</code> from my lab MDM, <a href="https://github.com/jessepeterson/kmfddm">KMFDDM</a> on <a href="https://github.com/micromdm/nanomdm">NanoMDM</a>. And nothing else on the Mac cleans up after it. In my lab, a VM that lost its 27.2 declaration went on asking Apple for 27.2 at every scan, reboots included, and Apple kept answering, because it serves superseded versions to anyone who asks by name.</p>
<p>It does fix itself, eventually. Once Apple stops serving the pinned version, the pinned scan gets &quot;no match&quot; and <code>softwareupdated</code> deletes the key on its own. That&#8217;s about 90 days after the version was replaced, so a Mac pinned to 27.2 should come unstuck around early February. That&#8217;s three months of security fixes the Mac never sees, which makes this bug a security problem as much as an annoyance. And the unpin only fixes the scan: if an old ClientInitiated update is still prepared, the key is still refused afterward (the priorities section covers that).</p>
<p><strong>How to check.</strong> On a Mac with no active enforcement declaration:</p>
<pre><code>defaults read /Library/Preferences/com.apple.SoftwareUpdate ManagedProductMarketingVersion
</code></pre>
<p>Any value is a pin; &quot;does not exist&quot; is what you want to see. The scan says so too:</p>
<pre><code>/usr/bin/log show --last 1d --predicate 'process == &quot;softwareupdated&quot;' | grep -E 'a PMV was set|requestedPMV:[0-9]'
</code></pre>
<p><code>This system is managed and a PMV was set (27.2)</code> (on a supervised Mac) or <code>requestedPMV:27.2</code> (on any Mac), with no declaration for 27.2, is the stuck case.</p>
<p><strong>What to do.</strong> Delete it as root:</p>
<pre><code>sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate ManagedProductMarketingVersion
</code></pre>
<p>The next scan logs <code>Setting requestedPMV to nil</code>, no restart needed. Wait ten seconds or so before you scan, because the first scan right after a delete can still answer from the pinned view. And only do this on a Mac with no active enforcement declaration, because an active one writes its target back at its next action. (Those Macs don&#8217;t need it anyway: the declaration&#8217;s own fallback clears the key once the Mac installs the target.)</p>
<p>A declaration can&#8217;t clear it for you, with one exception. One for the installed version is rejected before it scans (<code>Invalid case - trying to set a version ... that's the same as current OS</code>), and one for an older version is invalid. One for a version Apple doesn&#8217;t serve, like 27.9, does clear it on arrival, and the self-canceling declaration below puts that to use.</p>
<p>If something&#8217;s already prepared, clearing the pin is only half the job. The priorities section covers the other half.</p>
<h3 id="changing-declarations-without-stranding-macs">Changing declarations without stranding Macs</h3>
<p>If you only ever used DDM the way it&#8217;s drawn up, the rule would be &quot;never take a declaration away from a Mac before it&#8217;s installed the target.&quot; Real rollouts don&#8217;t work like that. Say you&#8217;ve given everyone three weeks to install 27.2, and 27.2.1 comes out in week two. You want to swap the declaration to 27.2.1, same scope, same deadline you already announced, so nobody has to upgrade twice. That works. What matters is whether each Mac is left with <em>a</em> declaration, not whether it keeps the same one.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>What you do</th>
<th>The pin</th>
<th>What&#8217;s prepared</th>
<th>Verdict</th>
</tr>
</thead>
<tbody>
<tr>
<td>Retarget in place (27.2 to 27.2.1, same scope and deadline)</td>
<td>Moves to 27.2.1; clears once the Mac installs it</td>
<td>Purged; 27.2.1 downloads</td>
<td>Safe, and what you want</td>
</tr>
<tr>
<td>Change only the deadline or the time of day</td>
<td>Rewritten to the same target</td>
<td>Purged and downloaded again</td>
<td>Safe, but a full download for nothing</td>
</tr>
<tr>
<td>Remove it from Macs already on the target</td>
<td>Clears itself at the next scan</td>
<td>Nothing to purge</td>
<td>Safe</td>
</tr>
<tr>
<td>Remove it from Macs below the target</td>
<td>Stays at the old target</td>
<td>Purged; downloaded again if your keys still include the old target</td>
<td>The stuck case</td>
</tr>
</tbody>
</table></div>
<p>Any change to an enforcement declaration cancels first, the way a removal does, then schedules the target again. Whatever&#8217;s prepared is purged within seconds, with no free-space check, and every Mac in scope downloads the target from scratch. For a retarget that&#8217;s what you want: the prepared 27.2 goes and 27.2.1 replaces it. For a deadline tweak it&#8217;s 17 GB or so per Mac for nothing, so batch your edits and keep your content cache on. A change that lands mid-download is harmless; the new target wins. Removing a declaration from Macs that already reached the target is safe because a leftover pin to the installed version clears itself (Apple answers &quot;no match&quot; for a version that isn&#8217;t newer than the one installed). The last row covers ending a rollout early, excluding a Mac, or scoping the replacement to a narrower group, like 27.2.1 for 26.x Macs only, on the theory that the 27.0.1 Macs will catch up by themselves. They won&#8217;t.</p>
<p>So the rule is:</p>
<p><strong>Never leave a Mac that&#8217;s below a declaration&#8217;s target with no enforcement declaration at all.</strong> Retarget in place rather than swapping one declaration for a narrower one. When a Mac has to come out of scope before it&#8217;s updated, clear the pin as root right after.</p>
<p>That said, the real world breaks this rule all the time. Dynamic groups recalculate on their own schedule, a Mac gets excluded for a good reason, someone rescopes a declaration in a hurry, and a Mac that was offline for two weeks comes back to find its declaration gone. You won&#8217;t always know which Macs got stranded, or when. That&#8217;s what the rest of this post is for: the root delete above for the pin, the purge routes in the priorities section for the prepared update it leaves behind, and a declaration that finds and fixes stale prepares by itself. Follow the rule to keep the numbers small, and run the workarounds anyway.</p>
<h2 id="removing-a-declaration-while-a-mac-is-still-downloading">Removing a declaration while a Mac is still downloading</h2>
<p><em>Applies to Macs that have had a DDM software update declaration.</em></p>
<p><strong>What you see.</strong> You removed or rescoped a declaration, and most Macs threw its update away like they should. Some didn&#8217;t. A day later they have the old target prepared, no declaration, a pin to the old target, and a key that gets refused. Right after the removal, DDM status for those Macs shows <code>install-state</code> <code>downloading</code>, <code>install-reason</code> <code>[&quot;mdm&quot;]</code>, and a &quot;Software update failed.&quot; failure reason stamped at the minute you removed it. (That&#8217;s one of the places the generic &quot;Software update failed.&quot; comes from.)</p>
<p><strong>Why.</strong> A removal does one thing to the update, once. <code>remotemanagementd</code> hands it to <code>SoftwareUpdateSubscriber</code>, which waits while <code>softwareupdated</code> forgets the declaration, disarms the DDM deadline (not install-tonight) and sends a single cancel at ClientInitiated. That cancel doesn&#8217;t care who made the update, what state it&#8217;s in or what priority it has. What happens next depends only on where the Mac was.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Where the Mac was</th>
<th>What the removal does</th>
</tr>
</thead>
<tbody>
<tr>
<td>Nothing prepared, or prepared (by the declaration, the key, the CLI or a user click, armed or not)</td>
<td>Purged in a second or two</td>
</tr>
<tr>
<td>Already applying the install</td>
<td>Refuses the cancel, and the install finishes</td>
</tr>
<tr>
<td>Downloading or preparing, nobody logged in</td>
<td><code>softwareupdated</code> owns the download, nobody asks for it again, and it&#8217;s purged</td>
</tr>
<tr>
<td>Downloading or preparing, with a user logged in</td>
<td>Usually survives, and finishes with no declaration on the Mac</td>
</tr>
</tbody>
</table></div>
<p>The last row is a race, and I made it happen on purpose in a VM: assign a declaration, log in, let the download start, remove the declaration. The log shows the cancel killing the download, and then, about a second later, the user&#8217;s session asking for the same download again. As far as I can tell, every declared install is handed to the user&#8217;s <code>SoftwareUpdateNotificationManager</code> twice, and it runs the two one after the other, so the second request is already waiting in line. It comes from the same client at the same priority, so it&#8217;s handed the slot in the middle of the cancel. The cancel fails (<code>7509 AccessLost</code>; the subscriber logs <code>Error canceling</code> and <code>remotemanagementd</code> logs <code>Failed to remove configuration</code>), and the download carries on to <code>prepared</code>. Nothing in that second request checks whether the declaration still exists. <strong>That&#8217;s a bug.</strong> The server sent a removal, the Mac logged it, and the Mac finishes the removed declaration&#8217;s update anyway.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_2_removal_race.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_2_removal_race.svg" alt="What a declaration removal does, by state" /></a></p>
<p>The survivor ends up worse off than a plain stuck Mac. Its update is ClientInitiated, so the key can&#8217;t replace it. The pin clear failed as always, so every scan still asks for the old target. While that pin is there, the old target is the newest thing on offer, so if its key is still set, it arms and installs the old version, and the user upgrades twice after all. Once you clear the pin, it&#8217;s superseded and never arms. Either way it needs the root unpin plus one of the purge routes in the priorities section.</p>
<p>Two related cases:</p>
<ul>
<li><strong>Retargeting mid-download is fine.</strong> The cancel loses the same race at first, but the user session&#8217;s request then fails with &quot;The available software updates have changed,&quot; and the new target wins. A retarget with the update already prepared is a clean purge and a fresh download.</li>
<li><strong>A change followed soon after by a removal is the worst timing there is.</strong> The change purges every prepare in scope and restarts every download. Remove it half an hour later and most of those Macs are mid-download with users logged in, which is exactly the losing case. Give the downloads time to finish between a change and a removal.</li>
</ul>
<p><strong>How to check.</strong> On the Mac, look for <code>Error canceling</code> from <code>SoftwareUpdateSubscriber</code> and <code>Failed to remove configuration</code> from <code>remotemanagementd</code> at the removal time, then an update prepared at ClientInitiated with no declaration (the state file in the priorities section shows it). In DDM status, a Mac that lost the race shows <code>downloading</code> with the stamped failure reason right after the removal, and <code>prepared</code> later. One whose removal purged cleanly shows <code>none</code> with the same stamp.</p>
<p><strong>What to do.</strong></p>
<ul>
<li><strong>Remove or rescope only when the Macs in scope show <code>prepared</code> or nothing at all</strong>, not <code>downloading</code>. Prepared Macs always purge cleanly.</li>
<li><strong>If you can&#8217;t wait, a logout makes it clean.</strong> With the user logged out, the download continues under <code>softwareupdated</code> alone, and a removal purges it.</li>
<li><strong>Take the old version out of your install-tonight keys before the removal.</strong> The removal leaves the pin, and with the pin and the old key both still there, the next keyed check downloads the old target straight back.</li>
<li><strong>Clear the pin as root afterward</strong>, on every Mac that was below the target.</li>
<li><strong>For Macs that lost the race anyway</strong>, the self-canceling declaration finds them by itself. It only acts on a Mac that&#8217;s already <code>prepared</code>, so it never meets this race.</li>
</ul>
<h2 id="the-key-does-nothing-update-priorities">The key does nothing: update priorities</h2>
<p><em>Applies to every keyed Mac.</em></p>
<p><strong>What you see.</strong> When 27.2.1 came out, my lab&#8217;s base VM still had 27.2 prepared, because I&#8217;d prepared it with <code>softwareupdate --download</code> back when 27.2 was new. I keyed 27.2.1 on a clone and kicked off a background check. Software Update picked 27.2.1, exactly like it should, and then refused to download it. <code>install.log</code> said why:</p>
<pre><code>Code=7507 ... priority downgrades are not allowed (current:ClientInitiated requesting:Background)
</code></pre>
<p>The update I&#8217;d prepared with the CLI outranked the key. On your Macs it looks the same: the key for the newest release is right there in the plist, and the Mac sits on an older prepared update and never downloads the new one. Or there&#8217;s no error at all: an older update is prepared, and it never arms. (A pinned Mac doesn&#8217;t log the refusal, because its pinned scan only offers the old target, which is what&#8217;s prepared. It shows up once you clear the pin.)</p>
<p><strong>Why.</strong> Software Update only works on one update at a time, and it&#8217;s strict about who gets to touch it. <code>SUMacController</code> hands the slot to one client at a time, each with a priority. Two priorities matter on macOS.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Priority</th>
<th>Value</th>
<th>Who uses it</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>Background</code></td>
<td>200</td>
<td>Only <code>softwareupdated</code>&#8216;s own background download, which is the path the key uses</td>
</tr>
<tr>
<td><code>ClientInitiated</code></td>
<td>300</td>
<td>Everything else: <code>softwareupdate</code> on the command line, DDM installs (logged in or out), the &quot;Update Tonight&quot; and &quot;Update Now&quot; buttons, the password stash at an unlock, the install steps themselves and every cancel</td>
</tr>
</tbody>
</table></div>
<p>The rules: a request from the same client at the same or a higher priority takes the slot, and a lower one is refused. A request from a different client needs a strictly higher priority. Scans have their own, separate access control and never change the update&#8217;s priority.</p>
<p>So the key&#8217;s download is at the bottom of the pecking order. That&#8217;s fine when nothing&#8217;s prepared, or when the key prepared what&#8217;s there (Background against Background takes over). It&#8217;s a problem when the prepared update came from anywhere else. A declaration or a <code>softwareupdate --download</code> leaves a ClientInitiated prepare, and every keyed background check after that is refused.</p>
<p>One raise is normal. The first password unlock after a keyed prepare stashes the password at ClientInitiated (<code>priority upgrade from Background to ClientInitiated allowed</code>), then arms. That raise lives in memory only. After a restart the update is back to Background, because what&#8217;s saved on disk is the priority it was prepared at. In between, a newer keyed release is refused on that Mac, which is fine: it&#8217;s armed for tonight, and the newer one follows.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_3_priorities.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_3_priorities.svg" alt="Update priorities and the keyed download" /></a></p>
<p>What actually keeps a Mac stuck is that a superseded prepared update won&#8217;t arm. At the unlock, Software Update compares what the last scan offered with what&#8217;s prepared, sees 27.2.1 on offer and 27.2 on disk, and logs:</p>
<pre><code>Don't proceed with auto update b/c updates are not downloaded yet
</code></pre>
<p>So the old update can&#8217;t arm, and if it&#8217;s ClientInitiated, the new one can&#8217;t download past it. And Software Update never drops a prepared update by itself just because something newer came out. I&#8217;d call that a design gap rather than a plain bug, but the result is a Mac that can sit on a superseded update forever, with nothing on the Mac that will ever move it. (One other cause of that same line: <code>MSURestrictToFullReplacements</code> left set to true makes Software Update want the full image, so a perfectly good patch looks &quot;not downloaded&quot; and never arms. Delete it wherever you find it.)</p>
<p><strong>How to check.</strong> The priority the update was prepared at is saved in <code>SUMacController</code>&#8216;s state file. As root:</p>
<pre><code>c=$(getconf DARWIN_USER_CACHE_DIR)
for f in &quot;${c}softwareupdated/SUMacController/SoftwareUpdateMacController.state&quot; &quot;${c}SUMacController/SoftwareUpdateMacController.state&quot;; do [ -f &quot;$f&quot; ] &amp;&amp; plutil -extract SUCorePersistedStatePolicySecureCodedObjectsFields.PersistedAccessControlContext raw -o - &quot;$f&quot; 2&gt;/dev/null | base64 -D | plutil -p - | grep 'Priority&quot;'; done
</code></pre>
<p>The two paths cover 27.x and 26.x. 200 is Background, 300 is ClientInitiated, and no output means nothing is held. The live value, which is what a new request is checked against, is in the unified log:</p>
<pre><code>/usr/bin/log show --last 1d --predicate 'subsystem == &quot;com.apple.SoftwareUpdateMacController&quot;' | grep -E -o '(CurrentAccessControlContext[:= &quot;]+|Setting current client access control context: )(AccessControlContext\(clientID:[^|]*\|priority:[A-Za-z]+|\(null\))' | tail -1
</code></pre>
<p><code>(null)</code> means nothing holds the slot right now. <code>softwareupdate --dump-state</code> and <code>/System/Volumes/Update/Update.plist</code> don&#8217;t tell you any of this, and neither does DDM status: no status item reports priority, the pin or whether a Mac is armed, and a refusal never shows up as a failure reason.</p>
<p><strong>What to do.</strong> Clear any pin first (see the stuck-update section), or everything below fetches the pinned version again. Then it depends on what&#8217;s prepared:</p>
<ul>
<li><strong>A Background (200) prepare</strong> needs nothing: the next keyed background check cancels it and downloads the key&#8217;s build.</li>
<li><strong>A ClientInitiated (300) prepare</strong> has to be thrown away, and these are the ways that work:</li>
</ul>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Route</th>
<th>What it costs</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>softwareupdate --download &quot;macOS 27.2.1-26B131&quot;</code> as root, for the newest label</td>
<td>Purges the old prepare within seconds, then <code>softwareupdated</code> downloads and prepares the new one itself (about 15 minutes), even if you kill the CLI. It needs about 17.2 GB of plain free space (ask for 18 to be safe), and it doesn&#8217;t count the 19 GB the old prepare is sitting on. It scans first, so it disarms an armed Mac. Its last step fails (error 104) and leaves a badge on System Settings. A label that isn&#8217;t on offer gets <code>No such update</code> and exits 0.</td>
</tr>
<tr>
<td>The user clicks &quot;Update Tonight&quot; or &quot;Update Now&quot; in System Settings</td>
<td>Purges within 2 seconds and downloads the new update at ClientInitiated. &quot;Update Tonight&quot; arms it, and rewrites <code>AutoInstallProductKeys</code> to just that one product, so your script should put the others back. Same free space.</td>
</tr>
<tr>
<td>Removing or changing an enforcement declaration</td>
<td>Purges whatever&#8217;s prepared in a second or two, at any priority, armed or not, including with users logged out, with no free-space check. It only loses against a download a logged-in user&#8217;s session is running, so remove at <code>prepared</code>. It leaves a pin, so clear that afterward.</td>
</tr>
<tr>
<td>A declaration that cancels itself (next section)</td>
<td>Purges in under 10 seconds, with no free-space check and no timing on your side.</td>
</tr>
<tr>
<td>Wait about three months</td>
<td>Free, and no work at all. Around 90 days after the pinned version is replaced, Apple stops serving it, and the pin clears itself. The prepared update is still there, so the key is still refused, and the Mac spent a quarter of a year missing security fixes. Please don&#8217;t. (The 27.9 declaration in the next section uses the same &quot;no match&quot;, without the three months.)</td>
</tr>
</tbody>
</table></div>
<p>Things that don&#8217;t throw a prepared update away: restarting, removing its keys, thinning local snapshots, <code>softwareupdate --background</code> in any form, removing a software update <em>settings</em> declaration, Check for Updates (or Command+R) in System Settings, which never downloads, purges, arms or disarms anything, and a new enforcement declaration due more than 24 hours out, which logs <code>not purging yet</code> and treats the stale build as already prepared. (One due within 24 hours does purge on arrival, but then you&#8217;re enforcing that deadline.)</p>
<p>One 26.x note: there, the unlock&#8217;s stash goes out at whatever priority the client was left at, often Background, so against a ClientInitiated prepare it fails (<code>7749</code>). On a macOS 26 Mac with a declared 27 major prepared, most of its password captures fail that way. That&#8217;s a bug, and 27 fixed it. In 27.0.1 the stash sets ClientInitiated before it asks.</p>
<h2 id="a-declaration-that-cancels-itself">A declaration that cancels itself</h2>
<p><em>Applies to supervised Macs, from an MDM that lets you send your own declarations with activation predicates. KMFDDM does, and it&#8217;s what I built this with.</em></p>
<p>This is a declaration whose only job is to delete itself, and take the stale update with it on the way out.</p>
<p>I wanted a way to throw away a stale prepared update that didn&#8217;t need 17 GB free, didn&#8217;t need me to time two MDM actions around a download, and kept working after I stopped watching it. It turns out a declaration can do it to itself.</p>
<p>It works because removing an enforcement declaration purges whatever&#8217;s prepared, whoever does the removing, including the Mac. A DDM activation carries a predicate, and while the predicate is false, the configurations it references aren&#8217;t installed. When a predicate goes from true to false, the Mac takes those configurations away through the same path as a removal from the server, and the purge comes with it.</p>
<p>So you build an activation that&#8217;s true only on a Mac with a stale prepare, and whose own arrival makes it false.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_4_self_canceling.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_4_self_canceling.svg" alt="A declaration that cancels itself" /></a></p>
<p>The engine re-checks the predicate on its own about five seconds after any software update status item it names changes, so there&#8217;s nothing to schedule. On my M4 Air the whole loop took about eight seconds.</p>
<p>The enforcement configuration&#8217;s payload (its type is <code>com.apple.configuration.softwareupdate.enforcement.specific</code>):</p>
<pre><code class="language-json">{
  &quot;TargetOSVersion&quot;: &quot;27.9&quot;,
  &quot;TargetLocalDateTime&quot;: &quot;2027-11-12T12:00:00&quot;
}
</code></pre>
<p>There&#8217;s no 27.9, so if the configuration ever stays installed, it enforces nothing, and its arrival clears any pin (Apple answers &quot;no match,&quot; and the fallback clears the key). It&#8217;s the same &quot;no match&quot; a stranded Mac finally gets about 90 days after its pinned version is replaced. Asking for a version that has never existed just gets it on day one. While it&#8217;s installed, System Settings says the Mac is up to date, which is why it should only stay for the few seconds this design gives it.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__12_up_to_date_under_27_9.png"><img loading="lazy" decoding="async" class="wp-image-387804" width="756" height="640" src="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__12_up_to_date_under_27_9.png" alt="While the 27.9 configuration is installed, a 27.0.1 Mac says it&apos;s up to date, with 27.2.1 out. Here it&apos;s only there for a few seconds" srcset="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__12_up_to_date_under_27_9.png 756w, https://www.afp548.com/wp-content/uploads/2026/11/shots1x__12_up_to_date_under_27_9-300x254.png 300w" sizes="auto, (max-width: 756px) 100vw, 756px" /></a></p>
<p>Without a <code>TargetLocalDateTime</code> the configuration is rejected as an invalid payload, and keep that deadline in the future: a past-due one makes the Mac rescan about every minute while it&#8217;s installed. If your MDM won&#8217;t take a version that doesn&#8217;t exist yet, use the current release instead. The cost is one &quot;Managed Update&quot; banner the user might see, and a pin left at that release, which is harmless because it points where you want the Mac to go anyway.</p>
<p>The activation predicate, all one line:</p>
<pre><code>@status(device.operating-system.version) BEGINSWITH &quot;27.&quot; AND @status(softwareupdate.install-state) == &quot;prepared&quot; AND @status(softwareupdate.pending-version)[&quot;os-version&quot;] BEGINSWITH &quot;27.&quot; AND NOT (@status(softwareupdate.pending-version)[&quot;build-version&quot;] IN {&quot;26B131&quot;}) AND NOT (&quot;declaration&quot; IN @status(softwareupdate.install-reason)[&quot;reason&quot;]) AND SUBQUERY(@status(management.declarations)[&quot;configurations&quot;], $c, $c.identifier CONTAINS &quot;&lt;your enforcement configuration identifier&gt;&quot;).@count == 0
</code></pre>
<p>Six clauses, and most of them are there because something went wrong without them.</p>
<ul>
<li><strong><code>device.operating-system.version BEGINSWITH &quot;27.&quot;</code></strong> is required. A 26.x Mac preparing its 27 major has a pending version starting with &quot;27.&quot; too, and without this clause I watched one purge a keyed major upgrade in 6 seconds.</li>
<li><strong><code>install-state == &quot;prepared&quot;</code></strong> is the anchor. Missing status values are nil, and <code>NOT (x IN nil)</code> is true, so every &quot;not&quot; clause needs a positive one next to it, or the predicate is true on a Mac with nothing prepared.</li>
<li><strong><code>pending-version[&quot;os-version&quot;] BEGINSWITH &quot;27.&quot;</code></strong> keeps it to the 27 line.</li>
<li><strong><code>NOT (... IN {&quot;26B131&quot;})</code></strong> is the allow-list: the builds you want to keep. Put every build your keys and declarations ask for in it. Adding a build touches nothing on any Mac; taking one out purges it everywhere it&#8217;s prepared. Use the universal build (here <code>26B131</code>, the one in <code>RecommendedUpdates</code>, not a hardware-specific one), and update the list when a release posts, at the same time as your keys.</li>
<li><strong><code>NOT (&quot;declaration&quot; IN ... install-reason[&quot;reason&quot;])</code></strong> is what makes it cancel itself. It also keeps it off a Mac whose prepare came from a real declaration that arrived earlier.</li>
<li><strong>The <code>SUBQUERY</code> over <code>management.declarations</code></strong> covers the one case the rest can&#8217;t see: this activation and a real enforcement declaration arriving in the same sync.</li>
</ul>
<p>Without that guard, both configurations schedule within milliseconds, their scans collide, both find nothing, this one purges, and the real declaration is left active and valid with nothing scheduled until someone changes it. (That last part is a bug: a declaration whose scan failed on a collision should try again.) The guard only checks that a configuration whose identifier contains your real enforcement configuration&#8217;s identifier is present. Don&#8217;t add <code>active == YES</code>: a configuration arriving in the same sync is listed but not active yet, so that form lets it through. Use the configuration identifiers your MDM gives your real enforcement declarations (<code>OR</code> several inside the <code>SUBQUERY</code>), and make sure the pattern never matches this declaration&#8217;s own identifier, or it keeps itself off every Mac. Inactive leftover copies of a past declaration are listed too, so they&#8217;d keep this off those Macs; drop retired ones from the list.</p>
<p>The predicate engine is picky.</p>
<ul>
<li><code>@status()</code> takes a whole status item. Read fields with subscripts, like <code>[&quot;build-version&quot;]</code>. A dotted path fails, and <code>@status(x).build-version</code> is parsed as a subtraction.</li>
<li>String <code>&lt;</code> and <code>&gt;</code> compare lexically (<code>&quot;26B99&quot; &lt; &quot;26B131&quot;</code> is false), which is why this uses an allow-list instead of a version comparison.</li>
<li>Don&#8217;t use <code>FUNCTION()</code>. It crashed <code>remotemanagementd</code> and left every declaration on the Mac in <code>Error.MissingState</code> until the next push. A predicate shouldn&#8217;t be able to crash the daemon, so that&#8217;s a bug, but until it&#8217;s fixed, stay away.</li>
<li>The <code>softwareupdate.*</code> status items are supervised-only on macOS 14 and later.</li>
</ul>
<p>After it fires, the configuration shows <code>Error.ActivationFailed</code> in your MDM, which is cosmetic. It stays quiet across restarts, and it fires again by itself if a stale prepare ever comes back. The one thing it doesn&#8217;t do is cancel an install that&#8217;s already armed for tonight. That&#8217;s next.</p>
<h2 id="it-armed-and-then-it-didnt-or-it-did-anyway">It armed, and then it didn&#8217;t, or it did anyway</h2>
<p><em>Applies to every keyed Mac.</em></p>
<p><strong>What you see.</strong> A Mac armed, and in the morning it&#8217;s still on the old version. Or the opposite: you removed the keys from a Mac, or purged its update, and it installed overnight anyway.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm.png"><img loading="lazy" decoding="async" class="wp-image-387779" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm.png" alt="What an arm looks like in log stream: the key matches, the unlock stashes the password, and SUOSUScheduler arms. The 2 a.m. &quot;predicted start&quot; is a guess, not a schedule" width="943" height="247" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm.png 1886w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm-300x79.png 300w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm-1024x268.png 1024w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm-768x201.png 768w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__08_log_stream_arm-1536x402.png 1536w" sizes="auto, (max-width: 832px) 100vw, 832px" /></a></p>
<p><strong>Why.</strong> Last time I said <code>softwareupdate -l</code> can cancel an armed install, and that it did on 2 of 16 scans. That&#8217;s still true, but now I know why it&#8217;s only sometimes, and what else does and doesn&#8217;t do it.</p>
<p>An arm is an activity <code>softwareupdated</code> submits to <code>dasd</code> (<code>com.apple.SUOSUScheduler.tonight.install</code>), plus the update it queued. Only two things really take it down: a scan whose result doesn&#8217;t include the queued update, and a restart.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_5_arming.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_5_arming.svg" alt="What arms, what disarms, and what leaves the arm in place" /></a></p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Event</th>
<th>Disarms?</th>
<th>Installs at the next Smart Power Nap?</th>
</tr>
</thead>
<tbody>
<tr>
<td>A scan whose result is missing the queued update</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>A restart</td>
<td>Yes</td>
<td>No</td>
</tr>
<tr>
<td>A background check or <code>softwareupdate -l</code> that lists the update</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Check for Updates or Command+R in System Settings</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Removing every key</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Purging the update (declaration removal, the self-canceling declaration)</td>
<td>No</td>
<td>Yes</td>
</tr>
<tr>
<td>Logging out</td>
<td>No</td>
<td>Yes</td>
</tr>
</tbody>
</table></div>
<p>The <code>softwareupdate -l</code> case is a race. The CLI&#8217;s scan runs next to a legacy catalog scan, and when the catalog scan finishes it starts a second update scan. If the first one is still fetching the update&#8217;s documentation at that moment, the second loses control, comes back empty, and <code>softwareupdated</code> decides the available updates have changed, drops the queued update and disarms. Both take about 1.7 seconds, so whether a given run disarms comes down to network latency. A catalog download that timed out after the Mac sat idle did it once too. Any scan that comes back without the update counts; the CLI is just the one admins run.</p>
<p>Look at the bottom three rows. I armed a VM, removed every key and locked it. At Smart Power Nap it fired on schedule (<code>Tonight activity fired!</code>) and started downloading the update to install it, at ClientInitiated and past the ramp, with no keys at all. Removing the keys, purging the prepared update and logging out all leave the <code>dasd</code> activity in place, and with nothing prepared, the firing just downloads the update it queued. Meanwhile, the unlock that would normally arm a new prepare logs <code>Don't proceed with auto update b/c already armed for later</code>.</p>
<p>Getting re-armed after a real disarm takes two things, in order: a background check that lists the update again, then a password unlock. An unlock before that check logs <code>What? No available updates? This shouldn't have been called</code> and captures nothing, and so does every unlock after a boot until <code>softwareupdated</code> has run its first background check. From everything I&#8217;ve seen, a Touch ID unlock doesn&#8217;t capture the password, so on a Mac whose user lives on Touch ID, one disarm can cost days, often until Software Update makes them type the password.</p>
<p>And one thing that doesn&#8217;t stop any of it: a software update settings declaration with downloads and installs set to <code>AlwaysOff</code>. The key&#8217;s download and the arm both go ahead.</p>
<p><strong>How to check.</strong></p>
<pre><code>grep -E 'SUOSUScheduler: (ARMED|DISARMED)|Removing queued descriptor|Tonight activity fired' /var/log/install.log | tail -5
</code></pre>
<p>Only <code>SUOSUScheduler: DISARMED</code> (with <code>Removing queued descriptor</code>) is a disarm. A logout logs an <code>SUOSUAppQuitObserver ... disarming</code> line too, but the arm survives it. And don&#8217;t date an arm from the files: <code>/System/Volumes/Update/Update.plist</code> changes at every stash, and <code>FirstInstallTonightDateDictionary</code> in the preferences only keeps the first arm.</p>
<p><strong>What to do.</strong></p>
<ul>
<li><strong>Don&#8217;t run <code>softwareupdate -l</code> on a schedule.</strong> Read <code>RecommendedUpdates</code> from the plist instead; Software Update&#8217;s own background check keeps it current.</li>
<li><strong>If a Mac must not restart tonight, removing its keys isn&#8217;t enough.</strong> Restart it, which really disarms it, or keep it from looking away long enough for Smart Power Nap (a <code>caffeinate</code> assertion does it).</li>
<li><strong>After a purge on an armed Mac, expect an install that night</strong> unless you restart it.</li>
</ul>
<p>The other big cause of lost nights is an app that won&#8217;t quit at the overnight logout, which deserves a post of its own.</p>
<h2 id="a-password-prompt-to-schedule-tonights-update">A password prompt to schedule tonight&#8217;s update</h2>
<p><em>Applies to keyed Macs without a declaration for the update.</em></p>
<p><strong>What you see.</strong> At some random point in the day, a keyed Mac asks: &quot;Enter your password to schedule the software update for tonight.&quot; If the user clicks Cancel, <code>install.log</code> says <code>Clearing product keys to auto install</code>, and <code>AutoInstallProductKeys</code> is empty.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__02_password_prompt_schedule_tonight.png"><img loading="lazy" decoding="async" class="wp-image-387775" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__02_password_prompt_schedule_tonight.png" alt="The prompt, here from clicking Update Tonight before any password unlock; the re-queue shows the same one" width="751" height="637" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__02_password_prompt_schedule_tonight.png 1503w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__02_password_prompt_schedule_tonight-300x254.png 300w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__02_password_prompt_schedule_tonight-1024x869.png 1024w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__02_password_prompt_schedule_tonight-768x651.png 768w" sizes="auto, (max-width: 751px) 100vw, 751px" /></a></p>
<p>Greg Neagle ran into this on a macOS 26 (Tahoe) Mac and asked me about it: it had armed at 10:33, then put up this prompt around 5 p.m., with the same <code>softwareupdated</code> running all day. I&#8217;d never seen it, because every Mac I&#8217;d tested was either declared or freshly armed at an unlock.</p>
<p><strong>Why.</strong> Every six hours, <code>softwareupdated</code>&#8216;s periodic action asks the notification agent to arm whatever&#8217;s eligible. The agent checks that the Mac isn&#8217;t already armed, that the update is downloaded, that the user has a stash from an earlier unlock, and that the key makes the update eligible. If all of that passes, it queues the update for tonight, and that needs the user&#8217;s password. The password from the unlock was used once, at the original arm, and isn&#8217;t kept. So if that arm went away during the day (a scan that disarmed it, a night an app blocked, a new release, a purge), the re-queue has no password to use.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_6_password_prompt.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_6_password_prompt.svg" alt="Where the schedule-tonight password prompt comes from" /></a></p>
<ul>
<li>For an update a DDM declaration manages, it logs <code>This is a DDM managed product, using BT for auto update</code> and quietly uses the bootstrap token.</li>
<li>For anything else, it logs <code>Prompting for LAContext since one isn't set already</code> and puts up the prompt.</li>
</ul>
<p>It logs <code>ARMED</code> before it asks, so the arm looks fine in the log until the user answers. OK arms it properly. Cancel cancels the queued install, disarms, and clears the product keys. A password typed at the lock screen afterward is captured, but it doesn&#8217;t dismiss the prompt that&#8217;s already up, which is a small bug of its own.</p>
<p><strong>How to check.</strong></p>
<pre><code>/usr/bin/log show --last 1d --predicate 'process == &quot;SoftwareUpdateNotificationManager&quot;' | grep -E 'Prompting for LAContext|using BT for auto update'
grep -E 'Clearing product keys|Remove all products from install later' /var/log/install.log | tail -5
</code></pre>
<p><strong>What to do.</strong> Fewer disarms mean fewer prompts, so everything in the previous section helps here too. Beyond that:</p>
<ul>
<li><strong>A declaration for the same update makes it silent</strong>, because the re-queue uses the bootstrap token instead of asking.</li>
<li><strong>Decide what a Cancel means to you.</strong> The script in the last post writes the keys back on its next run, so a user who cancels gets asked again later. That might be what you want (the update is still coming), or it might not (they said no). If you want to respect it, look for <code>Clearing product keys to auto install</code> in <code>install.log</code> and skip that build for that Mac.</li>
</ul>
<h2 id="safari-and-command-line-tools-never-update">Safari and Command Line Tools never update</h2>
<p><em>Applies to Macs you&#8217;re keeping on macOS 26 or 15, and every Mac with Command Line Tools.</em></p>
<p><strong>What you see.</strong> Macs on macOS 26 that never get Safari 27.2 unless someone clicks, and Command Line Tools that sit on an old version everywhere.</p>
<p><strong>Why.</strong> Neither one is a macOS update in the sense the ramp and the key usually deal with. They&#8217;re products in Software Update&#8217;s older catalog, with product keys in the old <code>NNN-NNNNN</code> form (<code>142-16640</code> is Safari 27.2 for macOS 26, <code>142-50405</code> is Command Line Tools for Xcode 27.2), and macOS downloads them with &quot;Download new updates&quot; on, then waits for a click forever. On macOS 27, Safari ships with the OS.</p>
<p>The key list takes these product keys too, but they can&#8217;t arm on their own: install-tonight only asks for a password while a macOS update is prepared, so with only Safari or CLT pending, a password unlock captures nothing. Next to a keyed, prepared macOS update, they ride along.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_7_ride_along.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-02-morning-after-charts__post02_7_ride_along.svg" alt="Safari and Command Line Tools riding along with a keyed macOS update" /></a></p>
<p>On a 27.2 Mac with CLT pending, the unlock arms both: <code>Proceed with autoupdate with updates: (&quot;142-50405&quot;, &quot;MSU_UPDATE_26B123_patch_27.2_minor&quot;)</code>. On a 26.6.2 Mac keyed for 26.7.2 and Safari, the night goes like this:</p>
<pre><code>Set products to install later 142-16640
Tonight activity fired!
Logout finished with success=1
Installed &quot;Safari&quot; (27.2) / Success: Finished installing non-BaseSystem update : 142-16640
SUOSUPostLogoutInstallOperation: Applied MSU update
</code></pre>
<p>I tried the Command Line Tools trick on Safari first: install the staged package with <code>installer</code> and skip Software Update altogether. Safari refused. Safari for 26 writes the App cryptex on the Preboot volume, and only Software Update&#8217;s own install is allowed to write there. Installed the supported way, with <code>softwareupdate --install</code>, it&#8217;s silent if Safari isn&#8217;t running, but if Safari is open it stops and asks, even when root runs it.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__13_safari_must_close.png"><img loading="lazy" decoding="async" class="wp-image-387801" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__13_safari_must_close.png" alt="Installed directly, Safari 27.2 for macOS 26 asks the user to close Safari first, even when root runs it. Overnight, the logout has already closed it" width="590" height="430" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__13_safari_must_close.png 1180w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__13_safari_must_close-300x219.png 300w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__13_safari_must_close-1024x746.png 1024w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__13_safari_must_close-768x560.png 768w" sizes="auto, (max-width: 590px) 100vw, 590px" /></a></p>
<div class="table-wrap"><table>
<thead>
<tr>
<th></th>
<th>Safari for macOS 26</th>
<th>Command Line Tools</th>
</tr>
</thead>
<tbody>
<tr>
<td>Downloaded</td>
<td>At a daily catalog scan, about a day after Apple posts it (the catalog marks it ramped, and the first scan that sees it hides it: <code>142-16640 is unseen ramped</code>)</td>
<td>At the first daily catalog scan after Apple posts it</td>
</tr>
<tr>
<td>Installs by itself</td>
<td>No</td>
<td>No</td>
</tr>
<tr>
<td>Rides along with a keyed macOS update</td>
<td>Yes, if it&#8217;s downloaded before the unlock that arms</td>
<td>Yes, same</td>
</tr>
<tr>
<td><code>installer</code> works</td>
<td>No</td>
<td>Yes: the staged packages in <code>/Library/Updates/&lt;key&gt;/</code> install as root in about a minute and a half</td>
</tr>
<tr>
<td>Needs a restart</td>
<td>No</td>
<td>No</td>
</tr>
</tbody>
</table></div>
<p><strong>What to do.</strong> Greg&#8217;s autoupdatehelper adds the pending Safari and CLT keys for you. If you&#8217;re using the script from the last post, add any <code>RecommendedUpdates</code> entry with an <code>NNN-NNNNN</code> product key to the list next to the macOS key.</p>
<h2 id="what-managedproductmarketingversion-really-does-and-why-you-shouldnt-set-it-yourself">What ManagedProductMarketingVersion really does, and why you shouldn&#8217;t set it yourself</h2>
<p><em>Applies to anyone tempted to write it.</em></p>
<p>Once you know a root-written string can pin a Mac to a version, it&#8217;s tempting to use it on purpose: to hold a Mac on what it&#8217;s running, or to send it to one particular release. I tried both. Some of it works, most of it doesn&#8217;t, and I&#8217;d leave the key to macOS.</p>
<p><strong>What it is.</strong> A string in the root Software Update domain, <code>/Library/Preferences/com.apple.SoftwareUpdate.plist</code>. Normally only <code>softwareupdated</code> writes it, and only for an enforcement declaration: once the declaration&#8217;s scan finds the target, it writes the declaration&#8217;s version there, plus <code>ManagedProductBuildVersion</code> next to it. Deferrals, the software update settings declaration and Restrictions never write it. A configuration profile can&#8217;t set it either, because Software Update reads it from the any-user domain and never looks at the managed value. Root can write it, with or without MDM, and on an unmanaged Mac it pins exactly the same way.</p>
<p><strong>What it does.</strong> Every macOS scan (the background check, <code>softwareupdate</code>, System Settings) sends it to Apple as <code>RequestedProductVersion</code>, and Apple answers with that version and nothing else. It only narrows the macOS update. On a supervised Mac it also drops the deferral from the request, though a deferral on the Mac still hides the pinned release from the user (not from the key, which downloads it anyway). <code>ManagedProductBuildVersion</code> is never sent to Apple and pins nothing on its own; it&#8217;s only used inside the declaration&#8217;s install to pick the declared build out of the scan result. Nothing ever clears that one either. It&#8217;s harmless, but delete both when you clean up.</p>
<p><strong>When it clears itself, and when it doesn&#8217;t.</strong></p>
<ul>
<li><strong>Apple&#8217;s &quot;no match&quot; clears it.</strong> Whenever Apple answers a pinned scan with &quot;no match&quot; (a 422), <code>softwareupdated</code> deletes the key within a second or two. That happens for a version Apple doesn&#8217;t serve (27.9), and, because a real Mac sends its installed version along, for any version that isn&#8217;t newer than the one installed. Until that scan, a Mac pinned to its own version is offered nothing at all. If that scan is a Check for Updates, System Settings says &quot;Unable to check for updates&quot; once, then works.</li>
<li><strong>Apple keeps serving superseded versions, for about 90 days.</strong> On November 13, a 27.0.1 Mac asking for 27.2 by name still got 27.2, days after 27.2.1 replaced it. Asking from a 26.6.2 Mac, Apple still answered for 26.6.1, which 26.6.2 had replaced 88 days earlier, and refused 26.6, replaced 99 days earlier. That lines up with the 90-day limit on deferrals, which only works if Apple keeps a release around for 90 days after it&#8217;s replaced. So a pin to a newer version stays until something deletes it or that window closes, and when it closes, the next scan gets &quot;no match&quot; and the Mac unpins itself. What&#8217;s prepared stays prepared, though.</li>
<li><strong>Rebooting doesn&#8217;t clear it.</strong> <code>softwareupdated</code> does try at launch, but only when the pin is older than the running OS, and even then it&#8217;s refused (<code>Not authorized to clear preference ManagedProductMarketingVersion</code>), because it runs before the helper that writes preferences for it is ready. That&#8217;s a bug, if a harmless one: the only pins it would ever clear, the next scan clears anyway.</li>
<li><strong>The removal clear never works</strong> (<code>Code=3</code>, from the stuck section). Only the declaration&#8217;s own fallback, while it&#8217;s still active, does.</li>
</ul>
<p>So, the things you might try:</p>
<ul>
<li><strong>Freezing a Mac on the version it&#8217;s running doesn&#8217;t work.</strong> A pin to the installed version gets a &quot;no match&quot; at the next scan and clears. I wrote a LaunchDaemon that put the pin back the moment it disappeared, and it still lost: <code>softwareupdate --list</code> runs two scans about a second apart, the second one already unpinned, and it got through five times out of five. A user pressing Retry in System Settings gets through too. To hold Macs back, use a deferral.</li>
</ul>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__11_pin_to_installed_unable_to_check.png"><img loading="lazy" decoding="async" class="wp-image-387803" width="756" height="640" src="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__11_pin_to_installed_unable_to_check.png" alt="A pin to the installed version: the check finds nothing, and the same scan clears the pin. Retry a couple of times and 27.2.1 shows up" srcset="https://www.afp548.com/wp-content/uploads/2026/11/shots1x__11_pin_to_installed_unable_to_check.png 756w, https://www.afp548.com/wp-content/uploads/2026/11/shots1x__11_pin_to_installed_unable_to_check-300x254.png 300w" sizes="auto, (max-width: 756px) 100vw, 756px" /></a></p>
<ul>
<li><strong>Sending a Mac to a specific older release mostly works, and it&#8217;s a trap.</strong> A pin to 27.2 on a 27.0.1 Mac, with 27.2.1 out, makes every scan and System Settings offer 27.2 and only 27.2 (that&#8217;s the screenshot at the top of the stuck section). But keys for 27.2.1 match nothing while it&#8217;s there, so you need keys for 27.2 too. It stays until you delete it, and the day Apple stops serving 27.2, the pin clears itself and the Mac sees the newest release without anyone deciding that. A declaration that arrives later overwrites it, and that declaration&#8217;s removal leaves its own pin behind. It&#8217;s the stuck case, on purpose. If you need a Mac on one specific version, that&#8217;s what an enforcement declaration is for.</li>
<li><strong>Reinstalling the current macOS in place is the one use I&#8217;d keep.</strong> <code>AllowSameMSUVersion</code> set to true together with <code>ManagedProductMarketingVersion</code> set to the installed version makes Software Update offer the full image of the version you&#8217;re already on. Take the label from <code>softwareupdate --list</code> (it&#8217;s the full image&#8217;s build, like <code>macOS 27.0.1-26A5434</code> on a 26A434 Mac). <code>softwareupdate --install &quot;&lt;label&gt;&quot; --restart --user &lt;admin&gt; --stdinpass</code> reinstalled 27.0.1 over itself in about 10 minutes with the home folder and settings intact. It&#8217;s a repair for a Mac with a damaged system, without Recovery or an erase. Delete both keys afterward, or the Mac keeps offering the reinstall.</li>
<li><strong>Leave the old <code>InstallLater</code> keys alone.</strong> <code>ManagedProductKeys</code> with the <code>ManagedDoItLater*</code> counts and <code>MDMUpdateInterval</code> still drive the machinery behind the retired MDM <code>ScheduleOSUpdate</code> command, and that machinery writes the pin too. It forces an install with a restart countdown, repeats on its interval, and blocks install-tonight while it&#8217;s set.</li>
</ul>
<p>My advice: don&#8217;t write <code>ManagedProductMarketingVersion</code> yourself, and delete it wherever you find it on a Mac with no active enforcement declaration. To hold Macs back, use deferrals. To send them to a version, use a declaration. To get them there overnight, use the key.</p>
<h2 id="bugs-and-whats-by-design">Bugs, and what&#8217;s by design</h2>
<p>A lot of this is just Software Update being Software Update: the key&#8217;s download being the lowest priority, a removal purging updates the declaration didn&#8217;t make, Cancel on the password prompt clearing the keys, a pin to an unserved version clearing itself. These are the ones I&#8217;d call bugs, roughly in order of how much trouble they cause.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Bug</th>
<th>What it causes</th>
<th>To reproduce</th>
<th>Workaround</th>
</tr>
</thead>
<tbody>
<tr>
<td>The removal&#8217;s clear of <code>ManagedProductMarketingVersion</code> passes nil to a setter that only takes a string (<code>Code=3</code>)</td>
<td>Every Mac that loses a declaration before installing its target stays pinned, for about three months, missing every security fix in between</td>
<td>Assign an enforcement declaration for a newer version, wait for the key to appear, remove the declaration, read the key</td>
<td>Root <code>defaults delete</code></td>
</tr>
<tr>
<td>After a removal&#8217;s cancel, the logged-in user&#8217;s session asks for the download again without checking that the declaration still exists</td>
<td>A removal during a logged-in download finishes the removed declaration&#8217;s update anyway</td>
<td>Assign a declaration to a Mac with a user logged in, remove it while DDM status says <code>downloading</code></td>
<td>Remove at <code>prepared</code>, or with the user logged out</td>
</tr>
<tr>
<td>Automatic updates and an enforcement declaration don&#8217;t combine (from the last post)</td>
<td>Declared Macs never install overnight on their own, and wait for a click or the deadline</td>
<td>Declare an update with every automatic option on, unlock with a password, watch it never arm</td>
<td>The key</td>
</tr>
<tr>
<td>A real enforcement declaration whose scan collides with another one&#8217;s doesn&#8217;t retry</td>
<td>The declaration stays active and valid with nothing scheduled until it&#8217;s changed</td>
<td>Send the self-canceling declaration without its guard in the same sync as a real one</td>
<td>The <code>SUBQUERY</code> guard; change the stranded declaration</td>
</tr>
<tr>
<td><code>FUNCTION()</code> in a predicate crashes <code>remotemanagementd</code></td>
<td>Every declaration on the Mac sits in <code>Error.MissingState</code> until the next push</td>
<td>Any activation predicate using <code>FUNCTION()</code></td>
<td>Don&#8217;t use it</td>
</tr>
<tr>
<td>On 26.x the unlock stash goes out at the leftover priority, fixed in 27</td>
<td>macOS 26 Macs with a ClientInitiated prepare mostly fail to capture the password</td>
<td>Declare a 27 major on a 26.x Mac, unlock with a password, look for <code>7749</code> in <code>install.log</code></td>
<td>Get the Mac to 27</td>
</tr>
<tr>
<td>A password typed at the lock screen doesn&#8217;t dismiss a pending schedule-tonight prompt</td>
<td>A prompt that&#8217;s no longer needed stays on screen</td>
<td>Let the prompt appear, lock, unlock with the password</td>
<td>Answer the prompt</td>
</tr>
</tbody>
</table></div>
<p>And one design gap that isn&#8217;t quite a bug: a superseded prepared update is never replaced or dropped by anything on the Mac, and once nothing pins the Mac to it, it never arms, so it sits there until something outside Software Update throws it away.</p>
<p>If you&#8217;re hitting any of these, a Feedback with a sysdiagnose from an affected Mac helps, and the steps above work with any MDM.</p>
<h2 id="most-nights-tonight-comes">Most nights, tonight comes</h2>
<p>The key still does what the last post said it would. On my own Macs, an update shows up, downloads past the ramp, arms the next time I type my password at the lock screen, and installs on a night I leave them alone. When it doesn&#8217;t, it&#8217;s almost always one of the three things from the top of this post: a pin nobody cleared, an update that outranks the key, or an arm that went away (or didn&#8217;t) when nobody expected it.</p>
<p>None of it is magic. It&#8217;s a lot of careful code that mostly works, and occasionally hands nil to a setter that only takes strings. Once you know where the pin lives, who outranks whom, and what really cancels tonight, a stuck Mac stops being a mystery and turns into a fix you can script.</p>
<p>Until Apple fixes the bugs: delete the pin, remove declarations at <code>prepared</code>, and let the declaration cancel itself. And if you find a case that isn&#8217;t in here, tell me. There&#8217;s probably another nil out there somewhere.</p>
<h2 id="reference">Reference</h2>
<h3 id="the-races-in-one-place">The races, in one place</h3>
<p>Every one of these is two parts of macOS reaching for the same thing at the same moment. They all come from the same machinery: one update slot, handed to one client at a time, where the same client at the same or higher priority can take it mid-operation, and several parts of macOS (DDM, the user&#8217;s notification manager, <code>softwareupdated</code>&#8216;s own scans, your scripts) work on that slot and the same preferences without coordinating.</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Race</th>
<th>What goes wrong</th>
<th>How to avoid it</th>
</tr>
</thead>
<tbody>
<tr>
<td>Removal during a logged-in user&#8217;s download</td>
<td>The download survives without its declaration</td>
<td>Remove at <code>prepared</code>, or with the user logged out</td>
</tr>
<tr>
<td>A change, then a removal soon after</td>
<td>The change restarts every download, so the removal finds them mid-flight</td>
<td>Let downloads finish between the two</td>
</tr>
<tr>
<td>The self-canceling declaration in the same sync as a real enforcement declaration</td>
<td>Both scans collide, it purges, and the real one is left with nothing scheduled</td>
<td>The <code>SUBQUERY</code> guard in the predicate</td>
</tr>
<tr>
<td>Two scans at once (the pair inside one <code>softwareupdate -l</code>, or a CLI run during a background check)</td>
<td>The loser comes back empty, and the Mac disarms</td>
<td>Don&#8217;t run scans on a schedule; read <code>RecommendedUpdates</code></td>
</tr>
<tr>
<td>Clearing the pin, then scanning right away</td>
<td>The first scan can still answer from the pinned view (<code>No such update</code>)</td>
<td>Wait about ten seconds and retry once</td>
</tr>
<tr>
<td>A purge on an armed Mac</td>
<td>The update is gone but the arm isn&#8217;t; it fires that night anyway and installs what it queued</td>
<td>Restart after the purge if the Mac must not install tonight</td>
</tr>
<tr>
<td>A watcher re-writing a pin to the installed version</td>
<td>The pin clears inside the failed scan, and an immediate retry runs unpinned</td>
<td>Don&#8217;t; use deferrals</td>
</tr>
</tbody>
</table></div>
<h3 id="how-to-check-a-mac">How to check a Mac</h3>
<p>The last post didn&#8217;t have any Perl, and every Mac still ships it, so this one makes up for that. That script was JavaScript through the Objective-C bridge; this one is Perl through the other bridge. <code>use Foundation</code> gives Perl the same Cocoa classes, so the script reads preferences with <code>NSUserDefaults</code>, decodes the state file with <code>NSPropertyListSerialization</code>, and never runs another command. It reads everything this post talks about (the keys, what&#8217;s on offer, the pin, the priority of what&#8217;s prepared, and the last time <code>install.log</code> saw each event that matters) and tells you what it means. It only reads, and it prints timestamps and labels, never whole log lines, since those include the Mac&#8217;s name. Run it with <code>sudo perl tonight-check.pl</code>.</p>
<pre><code class="language-perl">#!/usr/bin/perl
# tonight-check.pl: why didn't this Mac update tonight? Read-only. Run it as root.
# It talks to macOS through Foundation, Apple's Perl-to-Objective-C bridge, and never runs another command.
use strict;
use warnings;
use Foundation;

die &quot;Run this as root: sudo perl $0\n&quot; if $&gt; != 0;

# Three small helpers for Foundation objects: is it nil, its text, and the items of an array.
sub is_nil { my $o = shift; return !(defined $o &amp;&amp; $$o) }
sub text   { my $o = shift; return is_nil($o) ? undef : $o-&gt;description-&gt;UTF8String }
sub items  { my $a = shift; return is_nil($a) ? () : map { $a-&gt;objectAtIndex_($_) } 0 .. $a-&gt;count - 1 }

# Software Update's preferences, read the same way softwareupdated reads them.
my $prefs = NSUserDefaults-&gt;alloc-&gt;initWithSuiteName_('com.apple.SoftwareUpdate');

# 1. What's keyed, and what the last background check offered.
my @keys    = map { text($_) } items($prefs-&gt;arrayForKey_('AutoInstallProductKeys'));
my @offered = map { text($_-&gt;objectForKey_('Product Key')) } items($prefs-&gt;arrayForKey_('RecommendedUpdates'));
my %keyed   = map { $_ =&gt; 1 } @keys;
my @unkeyed = grep { !$keyed{$_} } @offered;

# 2. The pin.
my $pin = text($prefs-&gt;stringForKey_('ManagedProductMarketingVersion')) // '';

# 3. The priority of whatever is prepared: 200 is the key, 300 is anything else.
# It's saved inside SUMacController's state file as a small keyed archive.
sub priority_in {
    my $file  = shift;
    my $state = NSDictionary-&gt;dictionaryWithContentsOfFile_($file);
    return undef if is_nil($state);
    my $fields = $state-&gt;objectForKey_('SUCorePersistedStatePolicySecureCodedObjectsFields');
    return undef if is_nil($fields);
    my $blob = $fields-&gt;objectForKey_('PersistedAccessControlContext');
    return undef if is_nil($blob);
    my $archive = NSPropertyListSerialization-&gt;propertyListWithData_options_format_error_($blob, 0, undef, undef);
    return undef if is_nil($archive);
    for my $object (items($archive-&gt;objectForKey_('$objects'))) {
        next unless $object-&gt;isKindOfClass_(NSDictionary-&gt;class);
        my $priority = text($object-&gt;objectForKey_('SUMacControllerAccessControlContextPriority'));
        return $priority if defined $priority;
    }
    return undef;
}
my $priority = 'nothing prepared';
for my $file (glob('/var/folders/zz/*/C/softwareupdated/SUMacController/SoftwareUpdateMacController.state'),    # macOS 27
              glob('/var/folders/zz/*/C/SUMacController/SoftwareUpdateMacController.state')) {                   # macOS 26
    $priority = priority_in($file) // $priority;
}

# 4. The last time install.log saw each event that matters.
my %events = (
    'armed'         =&gt; qr/SUOSUScheduler: ARMED/,
    'disarmed'      =&gt; qr/SUOSUScheduler: DISARMED/,
    'fired'         =&gt; qr/Tonight activity fired/,
    'key refused'   =&gt; qr/Code=7507/,
    'stale prepare' =&gt; qr/not downloaded yet/,
    'user canceled' =&gt; qr/Clearing product keys/,
);
my %last;
open my $log, '&lt;', '/var/log/install.log' or die &quot;Can't read install.log: $!\n&quot;;
while (my $line = &lt;$log&gt;) {
    for my $event (keys %events) {
        $last{$event} = substr($line, 0, 19) if $line =~ $events{$event};
    }
}
close $log;

# Did one event happen more recently than another (or the other never)?
sub after {
    my ($newer, $older) = @_;
    return $last{$newer} &amp;&amp; (!$last{$older} || $last{$newer} gt $last{$older});
}

# Firing an arm also logs DISARMED, so a firing since the last arm explains both.
my $fired = $last{fired} &amp;&amp; $last{armed} &amp;&amp; $last{fired} ge $last{armed};

print &quot;Keyed:    &quot;, (@keys    ? join(', ', @keys)    : 'nothing'), &quot;\n&quot;;
print &quot;Offered:  &quot;, (@offered ? join(', ', @offered) : 'nothing'), &quot;\n&quot;;
print &quot;Pin:      &quot;, ($pin ne '' ? $pin : 'none'), &quot;\n&quot;;
print &quot;Prepared: $priority\n&quot;;
print &quot;Last seen in install.log:\n&quot;;
printf &quot;  %-14s %s\n&quot;, $_, $last{$_} for sort { $last{$a} cmp $last{$b} } keys %last;

# 5. What it means.
my @notes;
push @notes, &quot;Nothing is keyed, so the key isn't doing anything here.&quot; unless @keys;
push @notes, &quot;Offered but not keyed: @unkeyed. Add those keys.&quot; if @keys &amp;&amp; @unkeyed &amp;&amp; $pin eq '';
push @notes, &quot;Pinned to $pin. If there's no active declaration, delete it: sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate ManagedProductMarketingVersion&quot; if $pin ne '';
push @notes, &quot;Prepared at 300 while pinned. Once the pin is gone, expect the key to be refused until that update is purged.&quot; if $priority eq '300' &amp;&amp; $pin ne '';
push @notes, &quot;The prepared update is at 300, and the key's download has been refused (7507) since the last arm. If it isn't the build you want, it has to be purged.&quot; if $priority eq '300' &amp;&amp; after('key refused', 'armed');
push @notes, &quot;The prepared update is older than what's on offer, so it won't arm.&quot; if after('stale prepare', 'armed');
push @notes, &quot;The last arm fired at $last{fired}. If the Mac is still on the old version, something stopped the install that night, usually an app that wouldn't quit.&quot; if $fired;
push @notes, &quot;Disarmed since the last arm. It needs a background check, then a password unlock.&quot; if after('disarmed', 'armed') &amp;&amp; !$fired;
push @notes, &quot;A user canceled the password prompt, which cleared the keys.&quot; if after('user canceled', 'armed');
push @notes, &quot;Armed for tonight.&quot; if after('armed', 'disarmed') &amp;&amp; !$fired;
push @notes, &quot;Nothing obviously wrong.&quot; unless @notes;
print &quot;\n&quot;, map { &quot;- $_\n&quot; } @notes;
</code></pre>
<p>Here&#8217;s what it says about a 27.0.1 Mac having a bad week: it lost the removal race on 27.2, and someone has already cleared its pin.</p>
<pre><code>Keyed:    MSU_UPDATE_26B131_patch_27.2.1_minor
Offered:  MSU_UPDATE_26B131_patch_27.2.1_minor
Pin:      none
Prepared: 300
Last seen in install.log:
  stale prepare  2026-11-12 08:31:55
  key refused    2026-11-12 14:02:15

- The prepared update is at 300, and the key's download has been refused (7507) since the last arm. If it isn't the build you want, it has to be purged.
- The prepared update is older than what's on offer, so it won't arm.
</code></pre>
<p>It&#8217;s a starting point, not a diagnosis. The timestamps come from <code>install.log</code>, which rotates, and the script can&#8217;t see what DDM thinks, so pair it with the Mac&#8217;s DDM status from your MDM. It also won&#8217;t tell you the update is coming tonight. Only tomorrow morning can do that.</p>
<p><em>Thanks to Greg Neagle for the password prompt report and for autoupdatehelper. Everything here was tested on Apple silicon in November 2026, on macOS 27.0.1, 27.2 and 26.6.2, in VMs and on real hardware, unmanaged and enrolled in a lab MDM built from <a href="https://github.com/micromdm/nanomdm">NanoMDM</a>, <a href="https://github.com/jessepeterson/kmfddm">KMFDDM</a> and <a href="https://github.com/brandonweeks/nanoca">nanoca</a>.</em></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2026/11/13/the-morning-after-autoinstallproductkeys-waking-up-to-the-same-macos-a-field-guide/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bypass the Ramp, Update Tonight: faster macOS updates with AutoInstallProductKeys</title>
		<link>https://www.afp548.com/2026/11/09/bypass-the-ramp-update-tonight-faster-macos-updates-with-autoinstallproductkeys/</link>
					<comments>https://www.afp548.com/2026/11/09/bypass-the-ramp-update-tonight-faster-macos-updates-with-autoinstallproductkeys/#respond</comments>
		
		<dc:creator><![CDATA[Samuel Keeley]]></dc:creator>
		<pubDate>Mon, 09 Nov 2026 23:23:58 +0000</pubDate>
				<category><![CDATA[macOS]]></category>
		<category><![CDATA[AutoInstallProductKeys]]></category>
		<category><![CDATA[DDM]]></category>
		<category><![CDATA[gdmf]]></category>
		<category><![CDATA[install tonight]]></category>
		<category><![CDATA[softwareupdate]]></category>
		<guid isPermaLink="false">https://afp548.wallaby-tuna.ts.net/?p=387788</guid>

					<description><![CDATA[<p>One root-written preference gets macOS updates downloaded past Apple's ramp and installed overnight, with or without DDM, including major upgrades from 26 to 27.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>TL;DR</strong></p>
<ul>
<li><strong>A lot of Macs on automatic updates never actually update automatically.</strong> Apple holds every macOS update back from automatic updates for a while (the ramp), and it now ships releases fast enough that a new one often replaces the last before its ramp opens. This summer 26.6 (July 27), 26.6.1 (August 6, for an actively exploited bug) and 26.6.2 (August 17) each replaced the last while it was still held back, so Macs left to update themselves couldn&#8217;t download any of them until late August. 27.2 never got out of the ramp before 27.2.1 replaced it on November 9.</li>
<li><strong>DDM gets you most of the way.</strong> A software update declaration gets supervised Macs to downloaded and prepared within minutes, but it doesn&#8217;t combine with automatic updates, so in practice every declared update waits for the user to click or for the deadline to force it.</li>
<li><strong>One root-written preference fixes both.</strong> <code>AutoInstallProductKeys</code> in <code>/Library/Preferences/com.apple.SoftwareUpdate.plist</code>, the list the &quot;Update Tonight&quot; button writes, gets the update downloaded past the ramp and installed overnight, with no click and no forced restart in the middle of anyone&#8217;s day. It needs &quot;Download new updates&quot; on and one password unlock, works with or without DDM, and handles major upgrades from 26 to 27, which Apple&#8217;s automatic updates don&#8217;t.</li>
<li><strong>Keep DDM or Nudge, but push the first reminder back a couple of days.</strong> A lot of Macs will be done before anyone needs a reminder.</li>
</ul>
<p>It&#8217;s been a while. Somehow, since my last post, I&#8217;ve ended up with more Xserves, not fewer, and the 2013 Mac Pro I wrote about running ESXi on now spends its days on WireGuard fun.</p>
<p>I found a preference key that, as far as I can tell, nobody has written about. It fixes the thing that has bothered me most about keeping Macs current lately, Macs sitting on a downloaded update for days and all the reminders it takes to get it installed, and it turns out to fix it for my own Macs at home as much as for a fleet.</p>
<h2 id="updating-macs-has-become-a-ux-problem">Updating Macs has become a UX problem</h2>
<p>Back in the Intel days, patching Macs was mostly a scheduling problem, and we owned the schedule. You ran your own Software Update Server (or reposado), pointed clients at your catalog, approved updates when you were ready, and something like Munki ran <code>softwareupdate</code> at logout or overnight. Updates were small, they installed when you said so, and Apple had no say in when a given Mac got one.</p>
<p>Most of that is gone, largely for good reasons. Custom catalogs went away years ago. On Apple silicon, installing an OS update takes a volume owner&#8217;s credentials or a bootstrap token, so a root script can&#8217;t just run <code>softwareupdate</code> and walk away. Updates are big now: 27.2 came to about 18 GB in my tests, counting the on-device assets that get staged with the 6 GB patch. And between you and the update there&#8217;s now Apple&#8217;s staged rollout, which decides when each Mac gets it for automatic install.</p>
<p>What&#8217;s left is mostly a user experience problem, and it shows up everywhere:</p>
<ul>
<li><strong>On your own Mac</strong>, &quot;automatic updates&quot; can mean a couple of weeks of nothing while Apple&#8217;s ramp holds the update back, so you end up checking by hand anyway. Leave it, and you get a notification to dismiss, a &quot;Restart Now&quot; button that wants your password, and, once the update has been sitting there for a week, Touch ID asking for your password every day.</li>
<li><strong>At work</strong>, the options all lean on reminders and deadlines. DDM&#8217;s own enforcement notifications come hourly in the last day, every 30 minutes in the last hour and every 10 minutes in the last half hour. Then the deadline restarts the Mac at whatever time you picked, and per <a href="https://support.apple.com/en-us/guide/deployment/depd30715cbb/web">Apple&#8217;s own guide</a> it force quits every open app, &quot;regardless of whether any documents are open and unsaved.&quot; A longer deadline gets you a slow trickle of people clicking and the same crowd at the end. Tools like Nudge work through reminders and deadlines too, because that&#8217;s the lever the platform gives them.</li>
<li><strong>Apple makes the same tradeoffs:</strong> the ramp, and daily password prompts once an update has waited a week.</li>
</ul>
<p>Apple, admins and tool makers are all working with the levers the platform has, and users pay for it in time: the updates themselves, plus every reminder and countdown along the way.</p>
<p>Some napkin math. In the last 12 months, a Mac that stayed current installed 16 macOS updates, whether it stayed on 26 (26.2 through 26.7.3) or moved to 27 (26.2 through 26.6.2, then 27.0 through 27.2.1). Say each one done by hand costs 20 minutes between clicking Restart, waiting out the install and getting your apps back. That&#8217;s more than five hours a year per Mac. Across 1,000 Macs it&#8217;s over 5,000 hours, more than two and a half people&#8217;s working year, spent watching a progress bar.</p>
<p>And that&#8217;s before the time spent on reminders, or a deadline that lands in the middle of someone&#8217;s work, sometimes with the download still to go. An install that happens overnight gives all of that time back.</p>
<p>This key lets you skip the ramp to get updates out faster <em>and</em> make the experience better, because the Mac installs overnight, the way you&#8217;d want automatic updates to work in the first place.</p>
<h2 id="what-slows-updates-down">What slows updates down</h2>
<p><strong>The ramp.</strong> When Apple ships a macOS update, your Macs don&#8217;t all get it for automatic install on day one. They get it when Apple decides they do. Apple&#8217;s deployment guide <a href="https://support.apple.com/guide/deployment/review-the-apple-software-update-process-dep02c211f3e/web">mentions it briefly</a>, and the closest thing to an official explanation is an email from Craig Federighi to an iPhone user, <a href="https://www.macrumors.com/2022/03/30/apple-explains-why-ios-auto-updates-later/">reported by MacRumors</a>: devices with automatic updates on get updates &quot;1-4 weeks later (after we&#8217;ve received feedback on the update).&quot; That was about iOS, but Macs behave the same way.</p>
<p>Here&#8217;s roughly when Apple&#8217;s server let Macs on automatic updates have each release this year, and when the next release replaced it:</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-01-autoinstallproductkeys-charts__ramp_series_timeline.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-01-autoinstallproductkeys-charts__ramp_series_timeline.svg" alt="Every new release restarts the ramp" /></a></p>
<p>Every release starts out held back (Apple&#8217;s logs call that &quot;ramped&quot;). After about a week, Apple starts letting a share of Macs through (which ones depends on an ID each Mac sends with its request), and about a week after that the ramp is all the way open, though 26.5.1 took more than three weeks. The 26.5 series was okay: each release was fully open for a week or two before the next one replaced it, so a Mac on automatic updates got each one a couple of weeks late, but it got them.</p>
<p>The 26.6 series wasn&#8217;t. 26.6 shipped on July 27 with 170 CVE fixes, 26.6.1 followed on August 6 to fix a bug that was being actively exploited, and 26.6.2 came on August 17 with 34 more. Each one replaced the last while it was still held back, and each one started its own ramp. The first Macs on automatic updates weren&#8217;t allowed any of it until about August 25, 29 days after 26.6 shipped, and the last ones not until about August 31. After that they still had to download it, get a password unlock and sit locked for a night, so a Mac on automatic updates was looking at about four weeks between Apple fixing an actively exploited bug and that fix being installed. The full story is the next post in this series.</p>
<p>And 27.2 is the same pattern all over again. 27.2 shipped on October 26. I&#8217;ve been watching what Apple&#8217;s update server (<code>gdmf.apple.com</code>) offers Macs on automatic updates, and 27.2 stayed ramped for every device ID I tried, from every starting build I tested, until 27.2.1 replaced it on November 9. As far as I can tell, a Mac relying on automatic updates never got 27.2 at all, and 27.2.1 started the wait over.</p>
<p><strong>DDM&#8217;s missing last step.</strong> A DDM software update declaration is good at getting the bits onto the Mac: it skips the ramp for the download, and within minutes the update is downloaded and prepared. Then it sits there. A declared, prepared update doesn&#8217;t install overnight on its own. It waits for the user to click or for the deadline. The reality is that a huge chunk of users never click. They&#8217;re busy, the notification is easy to dismiss, and &quot;later&quot; seems fine every time, so they end up at the deadline.</p>
<p>And a declaration doesn&#8217;t combine with automatic updates the way you&#8217;d expect. Apple&#8217;s guide, <a href="https://support.apple.com/en-us/guide/deployment/depd30715cbb/web">Install and enforce software updates for Apple devices</a>, puts &quot;Install software updates automatically&quot; and &quot;Enforce software updates&quot; on the same page, so you&#8217;d reasonably think they stack: automatic installs when the Mac can, the deadline for the rest. On macOS they don&#8217;t. The declaration gets the update past the ramp for the download, but not past the server&#8217;s flag for the overnight install. A declared Mac with every automatic option on still logs this at the next password unlock, then waits for the user or the deadline:</p>
<pre><code>MSU_UPDATE_26B123_patch_27.2_minor is not eligible for auto update because it's disabled server-side for this product.
</code></pre>
<p>For 27.2, that flag never came on. It&#8217;d be great if the page called that out, since the two sections sit right next to each other.</p>
<h2 id="the-key">The key</h2>
<p>What got me curious was that users <em>could</em> get an overnight install. When someone clicked &quot;Update Tonight&quot; in System Settings or &quot;Install Tonight&quot; in the notification, their declared, ramped Mac armed and installed overnight just fine. So I clicked it in a VM and diffed <code>/Library/Preferences/com.apple.SoftwareUpdate.plist</code>. One of the new keys was this:</p>
<pre><code>AutoInstallProductKeys = (
    &quot;MSU_UPDATE_26B123_patch_27.2_minor&quot;
);
</code></pre>
<p>That string is the update&#8217;s product key: <code>MSU_UPDATE_&lt;build&gt;_&lt;patch|full&gt;_&lt;version&gt;_&lt;minor|major&gt;</code>. Here <code>26B123</code> is 27.2&#8217;s build, <code>patch</code> means the delta from the version you&#8217;re on (<code>full</code> is the whole image), and <code>minor</code> or <code>major</code> is what kind of update macOS considers it.</p>
<p>Disassembling what reads that list made the rest clear. Software Update checks it in two places, and both times it checks it <em>before</em> the server&#8217;s verdict:</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>Gate</th>
<th>Without the key</th>
<th>With the key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Background download (the ramp)</td>
<td>&quot;is ramped, not downloadable at this time&quot;</td>
<td>&quot;is enabled for auto-install-tonight&quot;, then &quot;Selected product to download&quot;</td>
</tr>
<tr>
<td>Overnight install (Apple&#8217;s <code>AutoUpdate</code> flag)</td>
<td>&quot;is not eligible for auto update because it&#8217;s disabled server-side&quot;</td>
<td>&quot;is configured to auto-install-tonight&quot;, then &quot;Do auto update!&quot; and <code>ARMED</code></td>
</tr>
</tbody>
</table></div>
<p>Software Update reads the list from <code>/Library/Preferences</code> with <code>usingManaged:NO</code>, so a configuration profile can&#8217;t set it, but root can write it directly.</p>
<p>It doesn&#8217;t matter whether the update is already on the Mac. With nothing downloaded, the next background check (every 6 hours or so) fetches and prepares it past the ramp, meaning it&#8217;s downloaded and staged to apply at a restart. With it already prepared, by DDM or the user, that part&#8217;s done. Either way, the next password unlock gives <code>softwareupdated</code> the password it needs to restart unattended, and it arms: the install is scheduled for tonight.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-01-autoinstallproductkeys-charts__mermaid_2.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-01-autoinstallproductkeys-charts__mermaid_2.svg" alt="The key clears both gates: the ramp for the download, and the auto update check for arming" /></a></p>
<p>The install itself fires during a Smart Power Nap (despite the name, that&#8217;s about the user being away, not the Mac sleeping), once the Mac has been locked with the display off for about two hours, usually after 1 a.m. (Post 3 covers how macOS decides.)</p>
<h2 id="watching-it-work">Watching it work</h2>
<p>It worked in every setup I tried:</p>
<ul>
<li><strong>From nothing.</strong> A fresh, unmanaged 27.0.1 VM with every automatic option on, 27.2 ramped and nothing downloaded: one <code>defaults write</code>, and the next background check logged <code>26B123 is enabled for auto-install-tonight</code> and started the download. Sixteen minutes later it was prepared, and at the next password unlock it logged <code>is configured to auto-install-tonight</code>, <code>Do auto update!</code> and <code>ARMED</code>.</li>
<li><strong>On real hardware, always-on Macs included.</strong> A desktop that never sleeps, with a 27.2 enforcement declaration and 27.2 prepared for a week, installed it the first night after I wrote the key and typed the password once, and came back up with the user logged back in at the console.</li>
<li><strong>With FileVault on.</strong> A FileVault-on VM restarted with nobody typing anything: loginwindow logged the user back in with the saved password and put the lock screen back up. Real laptops with FileVault on do the same.</li>
<li><strong>Apps come back.</strong> In another VM, a TextEdit window with unsaved changes came back after the restart, still marked Edited. Software Update starts this logout with &quot;restore apps&quot; on, whatever the user&#8217;s own setting says.</li>
<li><strong>Under MDM.</strong> A VM enrolled in MDM, with a 27.2 enforcement declaration and the key, prepared the update in about 20 minutes, armed at the first password unlock, and installed overnight.</li>
</ul>
<p>What the user sees is stock macOS, and not much of it. When it arms, a notification:</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__04_notification_installed_tonight.png"><img loading="lazy" decoding="async" class="wp-image-387777" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__04_notification_installed_tonight.png" alt="Notification: macOS 27.2 is available and will be installed later tonight" width="358" height="88" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__04_notification_installed_tonight.png 716w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__04_notification_installed_tonight-300x74.png 300w" sizes="auto, (max-width: 358px) 100vw, 358px" /></a></p>
<p>Software Update says it&#8217;s scheduled:</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__03_update_scheduled.png"><img loading="lazy" decoding="async" class="wp-image-387776" src="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__03_update_scheduled.png" alt="Software Update showing Update Scheduled" width="751" height="637" srcset="https://www.afp548.com/wp-content/uploads/2026/11/screenshots__03_update_scheduled.png 1503w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__03_update_scheduled-300x254.png 300w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__03_update_scheduled-1024x869.png 1024w, https://www.afp548.com/wp-content/uploads/2026/11/screenshots__03_update_scheduled-768x651.png 768w" sizes="auto, (max-width: 751px) 100vw, 751px" /></a></p>
<p>And then nothing until the morning, when the Mac is on the new version with their apps back where they left them. No click, no countdown, and once it&#8217;s installed, the daily Touch ID password prompts stop too.</p>
<p>And for anyone whose night doesn&#8217;t work out (a Mac that wasn&#8217;t left on, an app that wouldn&#8217;t quit), &quot;Restart Now&quot; in Software Update works the way it always has. The update is already prepared, so it&#8217;s just the restart and the install.</p>
<h2 id="major-upgrades-too">Major upgrades, too</h2>
<p>Apple&#8217;s automatic install settings are <a href="https://support.apple.com/en-us/guide/deployment/depd30715cbb/web">documented as &quot;Automatic software updates (not upgrades)&quot;</a>, so until now a Mac on 26.x going to 27 had two options: the user clicks, or a deadline forces it.</p>
<p>On macOS 26, the key changes that. From 26.x, 27 is offered as a major product, so the key ends in <code>_major</code>:</p>
<pre><code>MSU_UPDATE_26B131_patch_27.2.1_major
</code></pre>
<p>macOS 26 only refuses majors that need the full Install macOS app. A major that comes through Software Update goes through the same check as a minor. I&#8217;ve watched it all the way through: on a 26.6.2 VM built from Apple&#8217;s IPSW, the major key got 27.2 downloaded past the ramp (with 26.7.2 still ramped right next to it), it armed at a password unlock just after midnight, installed a little after 2 a.m., and booted on 27.2 with the user session back and locked.</p>
<p>A few things to know:</p>
<ul>
<li><strong>Minor or major, pick one.</strong> If a 26.x Mac has both a 26.7.x key and a 27.x key, the major wins, whichever was written first, and only one update is ever prepared. To keep a Mac on 26 for now, key only the minor (also tested, 26.6.2 to 26.7.2 overnight). Don&#8217;t add a major key to a Mac that&#8217;s already armed for the minor: the major gets prepared, then the old arm fires for the minor, and that night nothing installs.</li>
<li><strong>Disk space.</strong> A 26 to 27 upgrade wanted about 23 GB free.</li>
<li><strong>macOS 15 only gets half.</strong> The key exists from macOS 15, and gets a major upgrade selected for download past the ramp there, but going by the code, 15 refuses to arm any major upgrade for install-tonight, so the user or a deadline still installs it. On macOS 12, 13 and 14 the key doesn&#8217;t exist at all.</li>
</ul>
<h2 id="where-it-fits-with-what-you-already-do">Where it fits with what you already do</h2>
<p>You probably already have something in place to get Macs updated. The key doesn&#8217;t replace it. It fills the gap every one of these leaves, which is the install itself:</p>
<div class="table-wrap"><table>
<thead>
<tr>
<th>If you rely on</th>
<th>You get</th>
<th>What&#8217;s still missing</th>
<th>Add the key</th>
</tr>
</thead>
<tbody>
<tr>
<td>Automatic updates alone</td>
<td>Overnight installs, eventually</td>
<td>Weeks of ramp, restarted by every new release</td>
<td>Downloaded within hours of release, installed the next night it can</td>
</tr>
<tr>
<td>DDM declarations</td>
<td>Download and prepare within minutes, and a deadline</td>
<td>Any install before the user clicks or the deadline hits</td>
<td>Installed overnight, the deadline catches the rest</td>
</tr>
<tr>
<td>Nudge or similar</td>
<td>Reminders that escalate, and a deadline of their own</td>
<td>The download and prepare (Nudge doesn&#8217;t do either, so it&#8217;s still ramped unless the user starts it), and the install still takes a click</td>
<td>Usually installed before the first reminder</td>
</tr>
</tbody>
</table></div>
<p><strong>With DDM, the deadline is for stragglers.</strong> DDM gets the update downloaded and prepared, and the key gets it installed overnight. Give your users a week, and a good share of them won&#8217;t need to do anything; the rest hit a blocked night or two (see below) before it goes through. The overnight installs can start the first night after the update is prepared, so a lot of that is done long before DDM&#8217;s notifications get frequent in the last day. The ones left at the deadline are the real stragglers: the Mac closed in a bag all week, or the one with a terminal that wouldn&#8217;t quit any night. The deadline is there as the backstop, and it shouldn&#8217;t be a punishment.</p>
<p><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-01-autoinstallproductkeys-charts__mermaid_4.svg"><img decoding="async" src="https://www.afp548.com/wp-content/uploads/2026/11/afp548-series-01-autoinstallproductkeys-charts__mermaid_4.svg" alt="DDM gets the update prepared, the key gets it installed overnight, and the deadline catches the rest" /></a></p>
<p><strong>It works for the urgent ones too.</strong> Say Apple fixes an actively exploited bug and you need it installed within 48 hours. Write the key and set a 48-hour deadline. Macs download and prepare it within hours, most of the ones left on that night install it, and the deadline catches the rest. No need to give people weeks to make it painless. Blocking apps are the main thing left in the way, and the helper in a later post should handle most of those.</p>
<p><strong>With Nudge, you don&#8217;t need DDM to get the update downloaded.</strong> Nudge reminds the user and sends them to Software Update, but it doesn&#8217;t download or prepare anything. The key does that part, past the ramp, the same way a declaration would. The same goes if you run Nudge alongside DDM, the way a lot of places do now, with a far-out declaration as the backstop and the real date in Nudge. Either way, hold Nudge&#8217;s first reminder a couple of days and a lot of Macs will have installed overnight before it says anything. The ones it does remind already have the update prepared, so &quot;Restart Now&quot; is a quick restart instead of a multi-gigabyte download first, and Nudge is left with just the Macs that need a person (the one never left on at night, the one with an app that won&#8217;t quit).</p>
<p><strong>It doesn&#8217;t need a bootstrap token, either.</strong> MDM-initiated installs, a DDM deadline included, get the volume owner credentials Apple silicon needs from the bootstrap token, so if bootstrap tokens ever give you trouble, those installs can fail. Install-tonight never touches it: at the user&#8217;s next password unlock, loginwindow hands the password to <code>softwareupdated</code>, which saves it for the restart, and the person logging in to their own Mac is normally a volume owner. So a Mac whose deadline install keeps failing on its bootstrap token can still install overnight.</p>
<h2 id="how-to-use-it">How to use it</h2>
<p>For 27.2.1 (build 26B131), write both the <code>patch</code> and <code>full</code> forms, since a Mac takes the full image when there&#8217;s no patch from its build. The key doesn&#8217;t include the starting build, so one pair covers every Mac going to that release, and keys that don&#8217;t match anything are ignored:</p>
<pre><code>sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutoInstallProductKeys -array-add \
  MSU_UPDATE_26B131_patch_27.2.1_minor MSU_UPDATE_26B131_full_27.2.1_minor
</code></pre>
<p>On a 26.x Mac, the <code>_major</code> pair (<code>MSU_UPDATE_26B131_patch_27.2.1_major</code> and <code>..._full_27.2.1_major</code>) means &quot;upgrade to 27,&quot; so only add it to Macs you want upgraded. And <code>-array-add</code> appends, so if you run it on a schedule you&#8217;ll pile up duplicates and old keys; the script below replaces the list instead.</p>
<p>The easiest place to get the key is the Mac itself: after an update check, <code>RecommendedUpdates</code> in the same plist lists the exact product key it&#8217;s being offered, ramped or not. If you take the build from <a href="https://sofa.macadmins.io">SOFA</a> instead, use the one under <code>InstallationApps</code> &gt; <code>LatestUMA</code>. The headline <code>Latest</code> build can be a hardware-specific one that most Macs never see (for 27.2.1 it&#8217;s 26B8132, while most Macs get 26B131), and a key with the wrong build matches nothing.</p>
<p>Then trigger a background check, so you don&#8217;t wait up to six hours for the next one:</p>
<pre><code>sudo notifyutil -p com.apple.SoftwareUpdate.TriggerBackgroundCheck
</code></pre>
<p>That&#8217;s safe to run whenever you like: mid-download, with the update already prepared, even while it&#8217;s armed. What&#8217;s <em>not</em> safe is <code>softwareupdate -l</code>; more on that below.</p>
<p>After that, the Mac needs &quot;Download new updates&quot; on (with it off, the download fails every time; &quot;Install macOS updates&quot; doesn&#8217;t have to be on), one password unlock once the update is prepared, and a night when it&#8217;s left on and locked. Touch ID unlocks don&#8217;t count, because they never hand loginwindow the password. Software Update takes care of that part on its own: while an update is prepared, it makes Touch ID users type their password every couple of days, and every day once the update is a week old.</p>
<ul>
<li><strong>When you write it mostly doesn&#8217;t matter.</strong> <code>softwareupdated</code> does the work: the download, the prepare, saving the password at an unlock, arming and installing. Before or after the download, before or after an unlock, the worst case is a lost night.</li>
<li><strong>Background checks can run more often.</strong> They run about every six hours. <code>BackgroundActivityIntervalOverride</code> in the same plist, in seconds, changes that: <code>sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate BackgroundActivityIntervalOverride -int 3600</code> makes them hourly. Like the key, it&#8217;s read from the plain plist, so a profile won&#8217;t set it, and it takes effect at the next restart. Every check is a full round trip to Apple&#8217;s servers, so I wouldn&#8217;t go below an hour.</li>
<li><strong>Command Line Tools can go along for the ride.</strong> The CLT update isn&#8217;t ramped, and macOS downloads it to <code>/Library/Updates/</code> but never installs it by itself. Add its product key (it&#8217;s in <code>RecommendedUpdates</code> too, <code>142-50405</code> for the 27.2 CLT) next to the macOS key before the unlock that arms macOS, and the overnight install puts in the CLT first and then macOS, in the same restart.</li>
</ul>
<h3 id="a-script-that-keeps-up-with-releases">A script that keeps up with releases</h3>
<p>A key names one specific release, so something has to write the new one when Apple ships. The Mac already knows what it&#8217;s being offered: every update check caches Apple&#8217;s answer on disk, and <code>RecommendedUpdates</code> names the exact product key. So this script reads those and writes the key through the same <code>SUSharedPrefs</code> class <code>softwareupdated</code> reads it with. No network, no feed, nothing to keep in sync.</p>
<p>The catch is that the Mac has to have checked first. On release day it doesn&#8217;t know about the new release until its next background check sees it, so that&#8217;s when the script can write the key. It then triggers another check right away, so the download starts within minutes instead of waiting for the check after that. To shorten the first wait, make the checks run more often, as above.</p>
<p>This is macOS management in 2026, so of course it was going to be Perl. The Perl that ships with macOS can do nearly all of this through its Objective-C bridge, but triggering the background check means calling <code>notify_post</code>, which is plain C, and Perl&#8217;s bridge can&#8217;t call that. I wasn&#8217;t going to shell out to <code>notifyutil</code> for one line, so it&#8217;s JavaScript for Automation instead, which can bind a C function directly. It shells out for nothing:</p>
<pre><code class="language-javascript">#!/usr/bin/osascript -l JavaScript
/*
Queue whatever macOS update this Mac is being offered for install-tonight, so it downloads past Apple's ramp and installs overnight.

Runs as root and works entirely from what the Mac already knows: no network, no feed, no shelling out. ALLOW_MAJOR=1 queues the next major version instead of the minor when there is one (macOS 26 or later only). DRY_RUN=1 prints instead of writing.
*/
ObjC.import('Foundation')
// notify_post(3) is plain C, so bind it directly instead of shelling out to notifyutil.
ObjC.bindFunction('notify_post', ['int', ['char *']])

const newer = (a, b) =&gt; {
  const x = a.split('.').map(Number), y = b.split('.').map(Number)
  for (let i = 0; i &lt; 3; i++) if ((x[i] || 0) !== (y[i] || 0)) return (x[i] || 0) &gt; (y[i] || 0)
  return false
}

function run() {
  const env = ObjC.deepUnwrap($.NSProcessInfo.processInfo.environment)
  const sysver = ObjC.deepUnwrap($.NSDictionary.dictionaryWithContentsOfFile('/System/Library/CoreServices/SystemVersion.plist'))
  const version = sysver.ProductVersion, build = sysver.ProductBuildVersion, major = parseInt(version)
  if (major &lt; 15) return `macOS ${version} has no AutoInstallProductKeys, nothing to do`

  $.NSBundle.bundleWithPath('/System/Library/PrivateFrameworks/SoftwareUpdate.framework').load
  const prefs = $.NSClassFromString('SUSharedPrefs').sharedPrefManager
  const recommended = ObjC.deepUnwrap(prefs.objectForAnyUserPreferenceUsingManaged('RecommendedUpdates', false)) || []

  // Apple's answer to the last update check, cached on disk: one asset per update, a patch from this build or the full image.
  const catalog = ObjC.deepUnwrap($.NSDictionary.dictionaryWithContentsOfFile('/System/Library/AssetsV2/com_apple_MobileAsset_MacSoftwareUpdate/com_apple_MobileAsset_MacSoftwareUpdate.xml')) || {}
  const assets = (catalog.Assets || []).filter(a =&gt; a.OSVersion &amp;&amp; newer(a.OSVersion, version) &amp;&amp; (!a.PrerequisiteBuild || a.PrerequisiteBuild === build))

  // Minor or major, never both: a 26.x Mac given both keys only ever prepares the major.
  const keysFor = kind =&gt; {
    const same = kind === 'minor'
    const found = assets.filter(a =&gt; (parseInt(a.OSVersion) === major) === same)
      .map(a =&gt; [a.OSVersion, `MSU_UPDATE_${a.Build}_${a.PrerequisiteBuild ? 'patch' : 'full'}_${a.OSVersion}_${kind}`])
    // Software Update's own list of available updates names the exact key too, which covers a Mac whose cached catalog is missing.
    for (const u of recommended) {
      const m = (u['Product Key'] || '').match(/^MSU_UPDATE_[^_]+_(?:patch|full)_([\d.]+)_(minor|major)$/)
      if (m &amp;&amp; m[2] === kind &amp;&amp; newer(m[1], version) &amp;&amp; (parseInt(m[1]) === major) === same) found.push([m[1], m[0]])
    }
    const target = found.map(f =&gt; f[0]).reduce((best, v) =&gt; (!best || newer(v, best) ? v : best), null)
    return [...new Set(found.filter(f =&gt; f[0] === target).map(f =&gt; f[1]))]
  }
  const wanted = (env.ALLOW_MAJOR === '1' &amp;&amp; major &gt;= 26 &amp;&amp; keysFor('major').length) ? keysFor('major') : keysFor('minor')
  // Keys left over from an update that's already installed match nothing, so there's no need to clear them.
  if (!wanted.length) return `nothing newer than ${version} offered yet`

  // The Command Line Tools update rides along and installs in the same restart.
  for (const u of recommended) if ((u['Display Name'] || '').startsWith('Command Line Tools') &amp;&amp; u['Product Key']) wanted.push(u['Product Key'])

  const current = ObjC.deepUnwrap(prefs.productKeysToAutoInstall) || []
  if (current.length === wanted.length &amp;&amp; wanted.every(k =&gt; current.includes(k))) return `already queued: ${wanted.join(' ')}`
  if (env.DRY_RUN === '1') return `would queue: ${wanted.join(' ')}`

  // Write through SUSharedPrefs, the class softwareupdated reads it with. This replaces the whole list, which also drops keys for older releases.
  prefs.setObjectForAnyUserPreference($(wanted), 'AutoInstallProductKeys')
  if ((ObjC.deepUnwrap(prefs.productKeysToAutoInstall) || []).length !== wanted.length) throw new Error(&quot;write didn't stick&quot;)
  $.notify_post('com.apple.SoftwareUpdate.TriggerBackgroundCheck')
  return `queued: ${wanted.join(' ')}`
}
</code></pre>
<p>It queues the newest release the Mac is being offered in its own major version (on 14 and earlier it does nothing), adds the Command Line Tools update if there is one, and only writes when the list changes. <code>DRY_RUN=1</code> prints what it would write. With <code>ALLOW_MAJOR=1</code>, a 26.x Mac queues the 27 upgrade instead. Think twice before you set that: it&#8217;ll queue every new major on day one, x.0 and all.</p>
<p>It doesn&#8217;t need its own LaunchDaemon. If your device management can run scripts, have it run this as root on a schedule, daily or more often, the same as any other script, and scope it to one wave of Macs at a time. On a Mac with nothing managing it, a LaunchDaemon does the job. This one runs it every six hours and whenever the cached answer from Apple changes, which happens at every update check (that folder also changes during downloads, so expect some extra runs that do nothing):</p>
<pre><code class="language-xml">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;!DOCTYPE plist PUBLIC &quot;-//Apple//DTD PLIST 1.0//EN&quot; &quot;http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;
&lt;plist version=&quot;1.0&quot;&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;local.install-tonight-keys&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/usr/local/sbin/install-tonight-keys.js&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
    &lt;key&gt;StartInterval&lt;/key&gt;
    &lt;integer&gt;21600&lt;/integer&gt;
    &lt;key&gt;WatchPaths&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/System/Library/AssetsV2/com_apple_MobileAsset_MacSoftwareUpdate&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;StandardOutPath&lt;/key&gt;
    &lt;string&gt;/var/log/install-tonight-keys.log&lt;/string&gt;
    &lt;key&gt;StandardErrorPath&lt;/key&gt;
    &lt;string&gt;/var/log/install-tonight-keys.log&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</code></pre>
<pre><code>sudo install -d /usr/local/sbin
sudo install -o root -g wheel -m 755 install-tonight-keys.js /usr/local/sbin/
sudo install -o root -g wheel -m 644 local.install-tonight-keys.plist /Library/LaunchDaemons/
sudo launchctl bootstrap system /Library/LaunchDaemons/local.install-tonight-keys.plist
</code></pre>
<h3 id="checking-it-and-undoing-it">Checking it, and undoing it</h3>
<ul>
<li><strong>What&#8217;s queued:</strong> <code>defaults read /Library/Preferences/com.apple.SoftwareUpdate AutoInstallProductKeys</code>, and <code>sudo DRY_RUN=1 /usr/local/sbin/install-tonight-keys.js</code> shows what the script would write.</li>
<li><strong>Armed:</strong> Software Update says &quot;Update Scheduled,&quot; like the screenshot above.</li>
<li><strong>The morning after:</strong> <code>log show --last 1d --style compact --predicate 'process IN {&quot;softwareupdated&quot;,&quot;SoftwareUpdateNotificationManager&quot;}' | grep -E 'auto-install-tonight|ARMED|DISARMED|Tonight activity fired'</code> shows whether it armed, and whether it fired or got canceled.</li>
<li><strong>Undo:</strong> remove the LaunchDaemon (or the MDM script) and clear the list. A Mac that&#8217;s already armed for tonight may still install.</li>
</ul>
<pre><code>sudo launchctl bootout system/local.install-tonight-keys
sudo rm /Library/LaunchDaemons/local.install-tonight-keys.plist /usr/local/sbin/install-tonight-keys.js
sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate AutoInstallProductKeys
</code></pre>
<h2 id="good-to-know-before-you-roll-it-out">Good to know before you roll it out</h2>
<ul>
<li><strong>Some things quietly cancel it.</strong> Anything that runs <code>softwareupdate -l</code> as root (a lot of inventory and compliance scripts do) can make <code>softwareupdated</code> drop an armed install; in my VM it happened on 2 of 16 scans. Apple menu &gt; Restart does too: it&#8217;s a plain restart, and the update doesn&#8217;t install. Either way the log says <code>SUOSUScheduler: DISARMED</code>, the plist still looks keyed, and nothing installs until a later check or password unlock arms it again. To check for updates, read <code>RecommendedUpdates</code> from the plist instead. (&quot;Restart Now&quot; in Software Update is fine: it installs right away.)</li>
<li><strong>An app that won&#8217;t quit stops the night.</strong> The overnight restart is an unattended logout that doesn&#8217;t force quit anything, so one app that refuses to quit, or doesn&#8217;t answer within 45 seconds, stops it. The usual suspects are terminals with something running (it&#8217;s 2026, so that&#8217;s more likely Claude Code than <code>ssh</code>), JetBrains IDEs, and apps with unsaved documents that put up a save sheet, like Excel and Word. Apps that autosave, like TextEdit, are fine. (A whole post on blocking apps is coming.)</li>
<li><strong>Keys have to follow releases.</strong> A new release makes the old key match nothing, so write the new one as soon as it posts (the script does that for you).</li>
<li><strong>Users can clear it.</strong> Canceling the password prompt after clicking &quot;Update Tonight&quot; empties the list, and going by the code, so do canceling the scheduled update and toggling &quot;Install macOS updates.&quot; A script that writes the key back overrides those choices, so decide whether you want that.</li>
<li><strong>You&#8217;re the ramp now.</strong> Apple ramps for good reasons: load on their CDN, and the occasional update that gets pulled. Skip it and both are your problem. Before you speedrun every Mac to a new release, make sure your business-critical apps work on it, then roll out in waves by scoping the script to one group of Macs at a time, with your content cache on.</li>
<li><strong>It&#8217;s undocumented.</strong> Root writing this preference was never meant to be an interface. Apple can move it, lock it down or remove it in any release, so check that it still works on each new macOS before you rely on it.</li>
</ul>
<h2 id="on-your-own-macs">On your own Macs</h2>
<p>I&#8217;ve put this on my own Macs. I want them updated quickly, but I don&#8217;t want to go check every time Apple releases something, and I certainly don&#8217;t want to wait weeks for the ramp. They don&#8217;t have DDM (unless I&#8217;m playing with it on them), and they don&#8217;t need it: the script and the LaunchDaemon above are all it takes.</p>
<p>Now when Apple ships, my Macs download it within about six hours, arm the next time I type my password at the lock screen, and install on a night I&#8217;ve left them on. You&#8217;ll be a day-one adopter of everything, but if you&#8217;re reading this, you probably already are. Think about how much time you&#8217;ve spent over the years hearing that Apple released something, going to check for it, waiting for the download and clicking through it. Let it take care of itself.</p>
<h2 id="is-this-a-bug-or-a-feature">Is this a bug or a feature?</h2>
<p>A feature, I think, just being used in a way nobody planned for. <code>AutoInstallProductKeys</code> is where macOS records &quot;the user asked for this tonight,&quot; and it makes sense for an explicit user choice to skip the ramp and the server flag. The version history looks deliberate too: not there before 15, majors refused in 15, majors allowed in 26.</p>
<p>The part that does feel like a bug is how automatic updates and DDM declarations work together. A Mac with an active enforcement declaration, a prepared update and every automatic option turned on should be eligible for install-tonight on its own, without anybody editing a plist, and I hope that gets fixed in a future update. I&#8217;ve filed Feedback about it, and if you&#8217;re seeing the same thing, a duplicate wouldn&#8217;t hurt. I&#8217;d also love a supported way to skip the ramp on managed Macs.</p>
<p>Until then, this works.</p>
<h2 id="coming-next">Coming next</h2>
<p>This is the first in a series. Next up:</p>
<ul>
<li><strong>How Apple ramps macOS updates:</strong> what your Mac asks Apple&#8217;s server, the full story of 27.2, and why a deferral can get you updated <em>sooner</em>.</li>
<li><strong>Inside install-tonight:</strong> how I found the key, the password prompts, Smart Power Nap, and everything that cancels an armed install.</li>
<li><strong>DDM software updates in practice:</strong> deadlines, declarations, bootstrap tokens, and what each one actually does.</li>
<li><strong>Apps that block the overnight restart:</strong> a per-app guide, and a small helper app.</li>
</ul>
<p>I&#8217;ve been away from here for about a decade. With any luck, this key will collectively save Mac users at least that much time waiting for their Macs to update.</p>
<p><em>Thanks to the folks behind <a href="https://sofa.macadmins.io">SOFA</a>, to Wes Whetstone for <a href="https://pommevm.dev">Pomme</a>, and to everyone whose work on Apple&#8217;s update servers made this easier to dig into: <a href="https://theapplewiki.com/wiki/MobileAsset">The Apple Wiki</a>, <a href="https://github.com/cj123/pallas">cj123/pallas</a>, <a href="https://github.com/blacktop/ipsw">blacktop/ipsw</a> and <a href="https://eclecticlight.co/2026/03/09/how-macos-26-tahoe-updates-3-catalogues-and-preparing-to-download/">The Eclectic Light Company</a>. Everything here was tested on Apple silicon, in VMs and on real hardware, in November 2026: macOS 27.0.1, 27.2 and 26.6.2 for the install tests, 15.7.7 and 12 through 14 for the version checks.</em></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2026/11/09/bypass-the-ramp-update-tonight-faster-macos-updates-with-autoinstallproductkeys/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Only Thing You Have To Lose Is Your Gains</title>
		<link>https://www.afp548.com/2026/07/14/only-thing-you-have-to-lose-is-your-gains/</link>
					<comments>https://www.afp548.com/2026/07/14/only-thing-you-have-to-lose-is-your-gains/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Tue, 14 Jul 2026 08:18:00 +0000</pubDate>
				<category><![CDATA[Scripting and Automation]]></category>
		<category><![CDATA[clankers]]></category>
		<category><![CDATA[LLM]]></category>
		<category><![CDATA[Munki]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[osquery]]></category>
		<category><![CDATA[santa]]></category>
		<category><![CDATA[toil]]></category>
		<category><![CDATA[zentral]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387735</guid>

					<description><![CDATA[Blogging is as much social media as YouTube is, particularly in the fact it can be as much of a suck as it can be absorbing (:keanu_whoa:) &#8211; apropos of&#8230; not much, welcome to 2026! I come to bury a hatchet about spicy autocorrect, not (necessarily) praise it. This ain&#8217;t the bad place, engagement is [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">Blogging is as much social media as YouTube is, particularly in the fact it can be as much of a suck as it can be absorbing (:keanu_whoa:) &#8211; apropos of&#8230; not much, welcome to 2026! I come to bury a hatchet about spicy autocorrect, not (necessarily) praise it. This ain&#8217;t the bad place, engagement is not something to be farmed, so we won&#8217;t be going for clickbait-ery this time around. No, instead I hope to just be entertaining enough since I know any mention of <code>ai</code> makes my eyes roll back in my head, srsly I wish I could hibernate until all the clanker wars are over, but&#8230; we are going to get into a bit of the ethos and then some hacks I felt worth sharing about a hot tech topic I call &#8216;scripting&#8217;.</p>



<figure class="wp-block-image size-large"><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/07/Europeana.eu-91657-GFM_object_GFM001877-4100fdb6730589dc3fd7b62cb9741fd0.webp"><img loading="lazy" decoding="async" width="1024" height="1019" src="https://www.afp548.com/wp-content/uploads/2026/07/Europeana.eu-91657-GFM_object_GFM001877-4100fdb6730589dc3fd7b62cb9741fd0-1024x1019.webp" alt="" class="wp-image-387736" srcset="https://www.afp548.com/wp-content/uploads/2026/07/Europeana.eu-91657-GFM_object_GFM001877-4100fdb6730589dc3fd7b62cb9741fd0-1024x1019.webp 1024w, https://www.afp548.com/wp-content/uploads/2026/07/Europeana.eu-91657-GFM_object_GFM001877-4100fdb6730589dc3fd7b62cb9741fd0-300x300.webp 300w, https://www.afp548.com/wp-content/uploads/2026/07/Europeana.eu-91657-GFM_object_GFM001877-4100fdb6730589dc3fd7b62cb9741fd0-768x764.webp 768w, https://www.afp548.com/wp-content/uploads/2026/07/Europeana.eu-91657-GFM_object_GFM001877-4100fdb6730589dc3fd7b62cb9741fd0.webp 1200w" sizes="auto, (max-width: 832px) 100vw, 832px" /></a><figcaption class="wp-element-caption"><a href="https://www.europeana.eu/en/item/91657/GFM_object_GFM001877" data-type="link" data-id="https://www.europeana.eu/en/item/91657/GFM_object_GFM001877">Robot &#8211; Gotland Defense Museum, Sweden &#8211; CC BY-SA.</a></figcaption></figure>



<p class="wp-block-paragraph">While the innovation I&#8217;d like to see brought into the world is entirely community and meatspace-related/driven (organize, baby), the things about DevOps and the Sysadmin Code of Ethics that grabbed me at the outset was that if you&#8217;re gonna spend half your waking hours grinding out efficiencies for the capital allocating class, let&#8217;s at least act like we&#8217;re artisans of a craft. &#8216;Automate myself out of a job&#8217; was an early rallying cry because manual toil and spaghetti-against-the-wall practices was (is) everywhere, which the discipline of SRE formed to eliminate. And we all enter fields or use new tools and need time to orient and become productive, so the idea of reliable repeatability validation, and as mentioned before, governance &#8211; this ethos drove the decision-making of how to coordinate a job to conclusion. And GitOps is another rough gang I fell in with after literarily YEARS of checking out everything to <code>/tmp</code> and being SUPER strict about nuke-ing a repo anytime it looked at me funny. (I still don&#8217;t let the clanker, meaning coding harness/LLM agent, perform commits but I do have it help me get out of tight corners I find myself in with git.)&nbsp; Enough flouty language preamble, let&#8217;s get into specifically the things that I&#8217;m feeling might be somewhat under-advertised about how to employ clankers:</p>



<p class="wp-block-paragraph">You have a Munki repo and autopkg in CI and terraform orchestrates MDM/state changes for you. (If you&#8217;re lucky you also have config mgmt, alas, maybe soon.) Elliot did a whole series to teach us about <a href="https://www.elliotjordan.com/posts/pre-commit-01-intro/">pre-commit</a> and it lints/formats/stops you (optionally, if you install it per-repo) and your team from pushing the bad thing. But there&#8217;s a bunch of other things that are workflow-specific that you CAN interrogate that code base (or protip! multiple interrelated ones you have checked out locally if you&#8217;re not a coolkid with a monorepo, now-you-have-one-BIG-problem) for but are either in the categories I tend to call &#8216;mistakes we knew we were making&#8217; or &#8216;better-than-we-did-yesterday practices&#8217;. For example, maybe you want an unattended install for almost everything, but it ain&#8217;t applicable for on-demand/nopkg actions, obvs. Then there&#8217;s the coordination alongside the schedule you roll out changes on &#8211; a new product needs fetching and promotion and before all that, new allowances for things like TCC/PPPC in profiles. Flagging stuff &#8216;stuck&#8217; due to lack of promotion or incomplete coordination helps me know when to make sure a push is thoroughly applied in the cases that just staying on top of ticket notes ain&#8217;t quite cutting it.</p>



<p class="wp-block-paragraph">And so in the above case I came up with a reporting &#8216;dashboard&#8217; generation script, and by dashboard, like everything else in modern computing I mean markdown files. (Of IDE&#8217;s, I hate Zed the least recently, and it does great preview viewing as does the Gitlab web interface with the double-benefit of being hyper-link-able to a line when pointing to sister teams about the state of stuffs.) For our Zentral Santa config I have a clanker-built script generate one of all rules/identifiers per config, so that if we miss adding something to the block or allowlist across configs it gets flagged, and also if we&#8217;re investigating that it&#8217;s applying properly we can match output from santactl fileinfo quickly without sifting through miles of HCL. For just about everything else I use another pattern I call toil.py and no I&#8217;m not giving you a skill to make your own &#8211; while it&#8217;s very tied to my teams workflow is an excuse I could use, your tokens are as good as mine to look at the gist I&#8217;ll link later and get the drift/be able to carve out one that&#8217;s appropriate for you. <em>In reality any time spent on typing and staring at light bulbs is time away from learning how to make pizza or bagels or bacon rosemary fougasse or fix bikes, like it&#8217;s so humid here and my chain needs greasing and I don&#8217;t even know what product to buy.</em></p>



<p class="wp-block-paragraph">Sorry, where was I? TOIL.md, right, so as you may have heard me mention, my MDM and Santa and osquery and Munki server is the (debatably) second-best-in-breed (like how python is the second-best thing actually getting work done in the world): Zentral, which (while we&#8217;re happily on SaaS,) has been on <strong>Infra as Code</strong>, and recently <strong>Policy</strong> (think RBAC but way more flexible) <strong>as Code</strong> and even just more recently shipped an agent that starts as a wrapper around Munki with self-healing but ALSO packs mSCP integration. I say all that to call out that obviously it&#8217;s following the ethos of tools I would choose, and its <strong>Config as Code</strong> is exemplified by their Starter Kit repo (mentioned in the post from last year) to go from zero to managed across all those agent interfaces I mentioned. And <a href="https://gist.github.com/arubdesu/7c2a894e7fac8db04df53c2e0b2a9a10" data-type="link" data-id="https://gist.github.com/arubdesu/7c2a894e7fac8db04df53c2e0b2a9a10">here</a> it is, a sanitized version of my toil.py script (with example output), providing analysis about these categories of things to be cognizant of:</p>



<ul class="wp-block-list">
<li>first and foremost a hitlist, bubbling up the top-of-mind artifacts that are still floating in initial testing tracks (or not deployed to any devices at all) but not fully out to prod yet</li>



<li>then each of those &#8216;gaps&#8217; clustered per-agent, for ease of scanning so that if we&#8217;re reacting to the drift of a specific agent we can scan an applicable section to confirm (or batch updates while working on other improvements under the heading of an agent)</li>



<li>and finally as validation (or in lieu) of detailed wiki pages, sections capturing known-static, realtime criteria (most often relating to Zentral&#8217;s tagging system) that captures intentional shards of a config (like where have a tag mapped via Okta push groups to swap one MDM profile with an alternate, as one of many applicable use cases)</li>
</ul>



<p class="wp-block-paragraph">When it comes to CI for autopkg I need to pair the recipe with a schedule that is in turn run by our separate autopkg_tools-ish repo for promotion and maintenance and actual recipe runs. This analysis, unlike the one above, fans out to local binaries and a second locally checked-out repo to create a &#8216;dashboard&#8217; with these three sections to start:&nbsp;</p>



<ol class="wp-block-list">
<li>&#8220;Diverged munki processing&#8217;, to check upstream for the places where my override actually forks a munki recipe (by using a <code>.download</code> as a parent and hacking in my own steps for things like DatetimeOutputter to apply <code>force_install_by_date</code>&#8216;s) &#8211; if the <code>.munki</code> &#8216;child&#8217; upstream changes, I want to know about it so I can stay in sync. (These clankers can actually save tokens/reliance on shoddily secured MCP servers, in this case by leveraging the <code>gh</code> binary.)</li>



<li>Upstream fixes to send &#8211; a lot of these are vendor scripts but otherwise shellcheck has flagged things that I either muted inline or accepted in our override, so I need to remember to send that change back to the maintainer(s)</li>



<li>Schedule coverage &#8211; it&#8217;s not difficult to have the clanker pull levers on the <code>glab</code> CLI to validate schedules that are actually in a different repo as long as I give it read access to both, but an audit pass is nice to check both ways &#8211; A. that I didn&#8217;t make a schedule rong by common dum things like fatfingering the recipe name, and B. that as I add NEW recipes I know to make sure there&#8217;s a paired schedule</li>
</ol>



<p class="wp-block-paragraph">(Note the <code>venv</code> we expect teammates to use has some assumptions about local installs instead of being pure pre-commit-driven and interoperable, maybe we should blog about that state of the art. Among the grabbag of scripts are things that confirm latest versions of pre-commit modules to pin in its config&#8230; it gets fun to continuously be kept up-to-date with the state of the art out there<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" />)</p>



<p class="wp-block-paragraph">I&#8217;ve gone on for long enough, the point of all the above is where we intentionally keep a human in the loop but own up to the complexity of keeping all of that business logic inside the teams collective head. Having it in <code>.md</code> helps reflect the live state so we&#8217;re all on the same page, and if one person is owning a push and has a reason to stall it at some stage, while branch/Pull (or Merge, in Gitlab parlance) Requests names are supposed to be prefixed with a ticket that can provide context, maybe the next step is having clankers interrogate/confirm that as well. (I obviously enjoy writing un-aided tho, so having it send updates is not my jam.)&nbsp;</p>



<figure class="wp-block-image size-full"><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2026/07/IMG_7491Medium.png"><img loading="lazy" decoding="async" width="639" height="640" src="https://www.afp548.com/wp-content/uploads/2026/07/IMG_7491Medium.png" alt="" class="wp-image-387738" srcset="https://www.afp548.com/wp-content/uploads/2026/07/IMG_7491Medium.png 639w, https://www.afp548.com/wp-content/uploads/2026/07/IMG_7491Medium-300x300.png 300w" sizes="auto, (max-width: 639px) 100vw, 639px" /></a><figcaption class="wp-element-caption">Nagano Apples</figcaption></figure>



<p class="wp-block-paragraph"> (Non-sequitur, I enjoy cider from apples from farms here in Japan &#8211; did you know there&#8217;s big roomba-alike lawn mowers for apple orchards? And that you pick the flowers seasonally to encourage proper fruit growth? Still curious as to if this was &#8216;written&#8217; under the influence of an LLM?)</p>



<p class="wp-block-paragraph">I&#8217;ll go into the most convoluted example in a follow-up post with our Munki repo&#8217;s toil.py soon, but for now let me leave you with this: I want to see farther by riding on the shoulder of clankers, I see/feel us being concerned and exercised about the robot grinding us into dust or being the furry half of the centaur to use a <a href="https://www.kickstarter.com/projects/doctorow/the-reverse-centaurs-guide-to-life-after-ai">Doctorow</a>-ism. This is just my day job, though, and the tokens, like the spice à la Dune, must flow. Let&#8217;s get on with it so we can go back to helping our communities.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2026/07/14/only-thing-you-have-to-lose-is-your-gains/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Zentral for GitOps, the ~Mundane~ Excellent</title>
		<link>https://www.afp548.com/2025/06/25/zentral-for-gitops-the-mundane-excellent/</link>
					<comments>https://www.afp548.com/2025/06/25/zentral-for-gitops-the-mundane-excellent/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Wed, 25 Jun 2025 08:01:49 +0000</pubDate>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[Scripting and Automation]]></category>
		<category><![CDATA[MDM]]></category>
		<category><![CDATA[Munki]]></category>
		<category><![CDATA[Patch Management]]></category>
		<category><![CDATA[terraform]]></category>
		<category><![CDATA[zentral]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387730</guid>

					<description><![CDATA[Catching Up When we last saw our subject matter experts in&#160;2022(!), we were discussing how to craft queries so that compliance objectives could be reached with Zentral&#8217;s &#8216;checks&#8217;, which has since expanded to scripted results from any interpreter you can target when wrapping a Munki run. For folks behind the times (a lot has changed [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Catching Up</h2>



<p class="wp-block-paragraph">When we last saw our subject matter experts in&nbsp;<a href="https://www.afp548.com/2022/09/29/zentral-for-observability-governance-compliance/">2022</a>(!), we were discussing how to craft queries so that compliance objectives could be reached with Zentral&#8217;s &#8216;checks&#8217;, which has since expanded to scripted results from any interpreter you can target when wrapping a Munki run.</p>



<figure class="wp-block-image size-full"><a class="full-size" href="https://www.afp548.com/wp-content/uploads/2025/06/Gemini_Generated_Image_b7zqy8b7zqy8b7zq.jpeg"><img loading="lazy" decoding="async" width="1024" height="895" src="https://www.afp548.com/wp-content/uploads/2025/06/Gemini_Generated_Image_b7zqy8b7zqy8b7zq.jpeg" alt="Google whatever ai generated thing of ethnically diverse group trying to take group photo but kid is taking selfie instead " class="wp-image-387731" srcset="https://www.afp548.com/wp-content/uploads/2025/06/Gemini_Generated_Image_b7zqy8b7zqy8b7zq.jpeg 1024w, https://www.afp548.com/wp-content/uploads/2025/06/Gemini_Generated_Image_b7zqy8b7zqy8b7zq-300x262.jpeg 300w, https://www.afp548.com/wp-content/uploads/2025/06/Gemini_Generated_Image_b7zqy8b7zqy8b7zq-768x671.jpeg 768w" sizes="auto, (max-width: 832px) 100vw, 832px" /></a><figcaption class="wp-element-caption">(ai, ofc, it&#8217;s 2025 after all &#8211; count the fingers)</figcaption></figure>



<p class="wp-block-paragraph">For folks behind the times (a lot has changed since then!), not only did Zentral (the company) start hosting SaaS Zentral (the service) for customers, they also shipped the first vendor-supported interface for voting on Santa rules (as introduced at <a href="https://docs.macsysadmin.se/2024/">MacSysadmin.se</a> and on <a href="https://www.youtube.com/watch?v=LT-dvGFy0HM">YouTube</a>). All of the long-common moving parts of managing the config of osquery/Santa/Munki and MDM are of course configurable via a <a href="https://registry.terraform.io/providers/zentralopensource/zentral/latest/docs/">first-party supported Terraform provider</a>. There&#8217;s even a vendor-maintained best practices &#8216;<a href="https://github.com/zentralopensource/zentral-cloud-tf-starter-kit">starter kit</a>&#8216; repo of Terraform configs so that the kindof &#8216;rough around the edges&#8217; doc story for Zentral can have the gaps smoothed over &#8211; what Mac Admins tend to want to accomplish across various verticals and environments is relatively similar/hopefully can seem intuitive once you can view a proven-working example.</p>



<h2 class="wp-block-heading">About that Terraform &amp; GitOps Goodness</h2>



<p class="wp-block-paragraph">We&#8217;re going to discuss the concept of blueprints and artifacts in MDM as a parallel to how the Terraform provider also manages Munki (sub)manifests, separate of the actual repo where pkginfo files are meticulously maintained with their corresponding catalog references &#8211; the misnomer-like but generically named InstallEnterpriseApplication-delivered packages that Zentral&#8217;s MDM pushes can (and should) also be stored in your Munki repo. For those that are aware of the puppet configuration as code model of a &#8216;control&#8217; repo, we call our repo containing .tf files in the &#8216;starter-kit&#8217; model mentioned above the &#8216;zentral_config&#8217; repo. It could use some explanation how a rollout through the lifecycle of software in Munki and MDM configs/the &#8216;DEP bootstrap&#8217; package (with outset, SwiftDialog, our management python, etc. baked in) gets practically managed in Zentral via GitOps, so we&#8217;ll expand on that to provide an introduction to practical workflows and hopefully make the moving parts more approachable.</p>



<h2 class="wp-block-heading">Pre-requisite Learnings</h2>



<p class="wp-block-paragraph">You&#8217;ll want to understand Munki and MDM concepts like pkginfos/manifests/catalogs and mobileconfig payloads/DEP/bootstrap packages. Zentral (and other MDM&#8217;s) has &#8216;blueprint&#8217; as the specific term for a collection of packages and settings, and the components contained are referred to as &#8216;artifacts&#8217; (leaving aside how Declarative Device Management has its own specific moving parts and commands it can be responsible for). A more esoteric and harder to generalize about issue is things like percentage-based rollouts managed by a cron job or automated process like some environments use CI/CD scheduling+runners for, so we&#8217;ll be leaving that out as a topic and instead touch on two basic workflows: introducing a new Munki software &#8216;title&#8217;, with tags on a submanifest allowing targeting devices <em>independent of</em> testing tracks, and the same for MDM artifacts, with a side note about the dicey prospect of retiring old/unused components (vs. the relatively more-straightforward path of retiring software titles/versions in Munki).</p>



<h2 class="wp-block-heading">Zentral-Specific Munki</h2>



<p class="wp-block-paragraph">The &#8216;Monolith&#8217; service (in comparison to just using the &#8216;Munki&#8217; service, to migrate any &#8216;bucket of files+auth&#8217; service you may have but still be able to do things like script checks and get Zentral&#8217;s inventory visibility with its pre/postflight wrapping) is where you&#8217;d configure Manifests (which should be generic/broad across use cases or your whole tenant/deployment). Catalogs Zentral compiles (it only needs to read in the &#8216;all&#8217; catalog) get tags you&#8217;d designate your various testing tracks of devices with, which e.g. Okta push groups/SCIM can keep in sync). You&#8217;re recommended to break down specifics/relevant use cases into submanifests, which can interact with tags so you only offer a subset of software to specific computers, or manage titles differently, since this is where the &#8216;rubber meets the road&#8217; for designating software as e.g. managed/optional_install/updates. We even gate licensed software this way, and since every catalog/manifest is dynamically built per-client, there&#8217;s no need for &#8216;signware&#8217; blocking visibility or confirming that the &#8216;bucket of files&#8217; server allows untracked/unauthorized changes or visibilty where a client can peer into the full contents of the repository. On top of that Zentral generates shard values PER ITEM, AND device, which is inspectable in the inventory details of a computer so you know which shard the computer was put in for a push/version &#8211; nobody &#8216;unfairly&#8217; chosen to be bleeding-edge because the shard value set device-side put them in the first bucket every rollout.</p>



<p class="wp-block-paragraph">Most of the behavioral specifics in making Munki software management work live in a separate designated repository that can either be Zentral-hosted as a &#8216;virtual server&#8217; or you can even ask for patches to be provided and you just distribute them if you&#8217;re hoping to near-entirely rely on them for your Monolith service (or you can mix-and-match). If you&#8217;re comfortable with autopkg and cloud storage like an S3 bucket (e.g. paired with a Cloudfront signing key) you&#8217;d have complete control over when versions are loaded in and how they&#8217;re made available. Other resources and presentations are around for how that part of a Munki service is maintained and can be git (+gitlfs/git-fat, etc.) managed.</p>



<p class="wp-block-paragraph">When you&#8217;re ready to manage your software via a submanifest (like &#8216;standard_operating_environment&#8217; to designate official apps vs however else you might want to assign things to your overarching &#8216;workstations&#8217; manifest) you&#8217;d use the&nbsp;<a href="https://registry.terraform.io/providers/zentralopensource/zentral/latest/docs/resources/monolith_sub_manifest_pkg_info">zentral_monolith_sub_manifest_pkg_info</a>&nbsp;resource type to map the submanifest, name key in the applicable pkginfo file, installable conditions as applicable, and the managed/optional_install/update &#8216;key&#8217;s value, among other options. This is also where you&#8217;d use array(s) of excluded_tag_id&#8217;s or tag_shards to&#8230; exclude/include specifically-tagged computers or gate rollouts accordingly, separate from the all-or-nothing inclusion in a submanifest or catalog access. Tagging at the submanifest level prevents warning messages about software being offered to a computer but not being available in the catalog.</p>



<p class="wp-block-paragraph">You can add or remove software versions (paired with tag_shards/excluded_tag_ids) per-push if a riskier version change wants to be rolled out more thoughtfully/accurately, munki does its job of always offering latest as applicable by catalog, and removing the submanifest_pkg_info resource makes it so you can purge that software from your Munki repo at will. A very flexible system that just takes a few loosely-coupled parts to orchestrate!</p>



<p class="wp-block-paragraph">Hopefully that wasn&#8217;t too hand-wavy, feel free to ask for clarification or other examples in the MacAdmins Slack <a href="https://macadmins.slack.com/archives/C0BNC1SLC">#zentral</a> channel, but for now we&#8217;ll move on to MDM.</p>



<h2 class="wp-block-heading">Packages and Configs over UDP, AKA MDM</h2>



<p class="wp-block-paragraph">Zentral&#8217;s Terraform starter-kit shows how you&#8217;d track plaintext XML mobileconfig payloads/files in git with no bother, meaning you can output straight from ProfileConfigurator/iMazing/or even other MDMs (once you strip the signing/update fields as applicable). You can even&nbsp;<a href="https://github.com/zentralopensource/zentral-cloud-tf-starter-kit/blob/cf08f351d9f6d56cf65e1be14278d89162892370/mdm_artifacts.tf#L16">inline-variable-ize</a>&nbsp;dynamic values or (ahem) secrets that Terraform would insert for you so they don&#8217;t get committed to git&#8230; not like that&#8217;s ever happened to us!</p>



<p class="wp-block-paragraph">Continuing with the starter-kit model, new mobileconfig artifacts would get added to a path/folder in your Terraform repo, and referenced as a version-tagged zentral_mdm_profile resource, paired with a &#8216;container&#8217; zentral_mdm_artifact that would always map to the (arbitrarily set by you) highest-whole-integer profile version. You&#8217;d then &#8216;attach&#8217; the zentral_mdm_artifact to a blueprint associated with enrolled computer(s) via the zentral_mdm_blueprint_artifact resource, (which echoes how the submanifest is the more-appropriate place to do initial/applicable sharding,) unless/until there&#8217;s an updated version you&#8217;d like automagically inherited, keeping what you need to touch modular and separate. (There&#8217;s even nowhere-else innovations like re-delivering a payload to mimic the ollllllldschool &#8216;often&#8217; MCX frequency, or after every OS update, or once-only, which would be common for a bootstrap package &#8211; flexible!)</p>



<p class="wp-block-paragraph">Now a weirder aspect of this config-as-code setup, perhaps most noticeable with the bootstrap package (but shared with mobileconfig&#8217;s), is the subtle attribute that Zentral doesn&#8217;t want to purge an artifact from the system even if you stop pushing it completely as long as one device has received it (and sometimes even after all devices have seemingly acknowledged a newer version/no longer have the old). For cleanliness sake you can file everything but the most recent into an &#8216;archive&#8217; subfolder to make it more clear what the full set of applicable/latest versions are. When it&#8217;s completely aged/out properly processed the GUI will show that an artifact can be deleted (with the trash icon inline) and you can then confirm with a terraform plan that removing the applicable resources won&#8217;t cause errors or allow your Terraform state/queue of MDM changes to be out of sync. This is slightly more disjointed with the bootstrap InstallEnterpriseApp, since it&#8217;s recommended to check the pkg itself into a dedicated folder in the Munki repo/cloud storage bucket (when applicable) since Zentral would auto-get access to it when configured as a repository&#8230; you just need to bump versions and map to the S3:// file path in concert, and should only purge when Zentral truly believes the artifact is free to be released.</p>



<h2 class="wp-block-heading">お疲れさま! Besides That, How Was The Play, Mrs. Lincoln?</h2>



<p class="wp-block-paragraph">Maybe that was overly convoluted, and yet still too vague? I hope this was at least intriguing to help describe how Zentral once again sets what I&#8217;d say is the standard paradigm for how a management tool can aspire to offer true governance while empowering Mac Admins to get shit done. Its configs allow teams to responsibly manage thousands of computers, and orchestrate changes accurately and intentionally. If you&#8217;ve experienced a certain vendors &#8216;distribute to all or NEW ONLY&#8217; 2 buttons sweating meme, or whackadoodle :yolo: $latest implementations that don&#8217;t seem like they&#8217;re in use by actual customers at any kind of scale, this battle-tested way to do GitOps should hopefully be a real relief. Cheers <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/270a.png" alt="✊" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2025/06/25/zentral-for-gitops-the-mundane-excellent/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Couch to 50k (CPE&#8217;s)</title>
		<link>https://www.afp548.com/2022/11/07/couch-to-50k-cpes/</link>
					<comments>https://www.afp548.com/2022/11/07/couch-to-50k-cpes/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Tue, 08 Nov 2022 00:55:42 +0000</pubDate>
				<guid isPermaLink="false">https://www.afp548.com/?p=387693</guid>

					<description><![CDATA[I’m going to ping pong between a few topics here, so to give everyone guideposts, here are the three main topics I’d like to stay with you, dear reader: 1. With 50k people in the MacAdmins Slack, it’s fine if you don’t want to be a Client Platform Engineer, but ~be a lot cooler if [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>I’m going to ping pong between a few topics here, so to give everyone guideposts, here are the three main topics I’d like to stay with you, dear reader:<br />
1. With 50k people in the MacAdmins Slack, it’s fine if you don’t want to be a Client Platform Engineer, but <a href="https://knowyourmeme.com/memes/be-a-lot-cooler-if-you-did">~be a lot cooler if you did~</a> it’s a better time than ever to become one<br />
2. If current CPE&#8217;s aren&#8217;t doing explicit outreach to under-represented-in-tech groups and investing in the growth of the motivated people out there, our standing in our organizations (and the future of our speciality) is the lesser for it<br />
3. To grow/find those people, I have used the same interview questions which can be reverse-engineered into a bunch of advice for those still feeling like they have skills to acquire before being able to call themselves a CPE<br />
<a class="full-size" href="https://www.afp548.com/wp-content/uploads/2022/09/IMG_3398.jpeg"><img loading="lazy" decoding="async" width="900" height="675" class="wp-image-387698" src="https://www.afp548.com/wp-content/uploads/2022/09/IMG_3398.jpeg" alt="Irrashai" srcset="https://www.afp548.com/wp-content/uploads/2022/09/IMG_3398.jpeg 900w, https://www.afp548.com/wp-content/uploads/2022/09/IMG_3398-300x225.jpeg 300w, https://www.afp548.com/wp-content/uploads/2022/09/IMG_3398-768x576.jpeg 768w" sizes="auto, (max-width: 832px) 100vw, 832px" /></a></p>
<blockquote><p> What&#8217;s in a name?<br />
As a definition of what *Client Platform Engineering* is, we&#8217;d be the team that &#8216;manages the life cycle&#8217; of workstation platforms. In the day-to-day it would be less helping end users in real time, have less interactions with locked-down &#8216;appliance&#8217;-style mobile devices, but it&#8217;s definitely about making sure computers get patches, secure configurations, and groups can be identified that an appropriate environment is maintained on applicable devices.</p></blockquote>
<h2>Is CPE For You?</h2>
<p>Starting at the beginning, why am I intending to encourage the talent pool of CPE’s to increase, and saying it’s both a great time to be one and ok if you don’t want to do this work (forever)? Years ago the MacAdmin community would lose talent to Linux sysadminery/devops-y folk. Then being fluent in Continuous Integration/Continuous Development supporting the building of iOS apps became prolific. Around the same time securing Corp meant pulling the people who know how to patch and inspect configs on the fleet (we even have the highest count of CPUs) into Security-dedicated roles. Now there’s enough of a gap in tooling from the MDM perspective that vendors are recognizing you don’t get better without people from the trenches with problem space expertise. Opportunities abound! (And we can get compensated accordingly &#8211; it&#8217;s valuable work.)</p>
<p>Speaking for myself, I’ve enjoyed making this my career. But one of my favorite quotes from a manager I’ve heard in passing was ‘this isn’t going to be your last job, so I’m hoping we can help you improve in the way you want to evolve’. My personality means I’ve followed Mac blogs since it was hard to blog, I’m a lifer for this work. But as a devops mindset and its topics crept in to how MacAdmins can get their job done, we (should be able to have) increased who can do this job. Tech workers are kept afloat in seemingly all economic conditions and are finally getting salaries to show proper respect for the breadth of skill we display across various parts of the IT ‘stack’. Apple’s continuous churn, breaking and giving us QA tasks for the disruption they cause ~being courageous~ ‘innovating’ means we also have to continuously learn and stay on top of change, more than almost any other tech discipline (besides I guess JavaScript frameworks).</p>
<h2>Be You, Too</h2>
<p>I, for one, don&#8217;t need people who religiously follow the blogs or Apple’s mercurial shifts, but I do want folks who know how important gitops and code review and visualization of metrics are and yeah, also happen to be able to deliver operating system/workstation platform lifecycle management. If it’s a given this will not be your last job, I have no problem eventually losing teammmates to other departments and fields that use osquery or devtools scripting or containerized GitLab CI/CD or web-facing cloud service delivery, as long as we get the mutual benefit of our time together in <em>enough</em> of the core CPE disciplines.</p>
<p>At (several, failed) Dropbox interviews I detected I wasn’t respected because I hadn’t gone to university, same due to my lack of ‘real’ Computer Science bonafides when I interviewed at Google (although they were still super nice about it). Some employers train interviewers on bias and explicitly call out ensuring qualified candidates get the consideration they deserve. At most interviews I can still fake a ‘culture fit’ for pampered people havens because I’m male-identifying and cis and have worked in places with unconscionable practices, with really bad personalities that provided cover for my own toxicity. I want us all to realize we should grow people that aren’t like the archetypes we can be perceived as having benefitted from in our careers. When we do that, our service delivery will get feedback from the widest customer base possible because our members will be that much more approachable. Any drop off of interest from the already slim subset of people who care about our IT product hits our respect as peers in an engineering organization, and the dynamicity of our team can only be assisted by showing better representation of the customer population as a whole.</p>
<p>The <a href="https://www.macadmins.org/about-the-mac-admins-foundation">MacAdmins Foundation</a> recognizing the need for a mentorship program (see <a href="https://macadmins.slack.com/archives/C03RUF2NHU6">#maf-mentorship</a>) is a great space to watch, and I hope we can all find resources at our current employers to get experience both being mentored and mentoring so that we can get REALLY GOOD at investment in people as a community. (And I guess therapy/diversity training to unlearn some of the toxic aspects of how we had previously thought it was acceptable to operate would be a Good Thing<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />.)</p>
<h2>It&#8217;s Dangerous To Go Alone, Bring This</h2>
<p>Now we come to what I hope is AS REMEMBERED as the preceding topics in this post, which is the things someone with my career ‘bent’ would like to see people choose as aspects they can work on if they feel their skill set doesn’t yet match what a CPE team member should be expected to have. And admittedly it’s an unreasonably broad range of skills, but at this point I have well-trodden, go-to topics I’d like to see a passing familiarity with, and links to preferred resources to consult can hopefully get folks started.</p>
<p>Not just any scripting language, python is what I need people to be relatively fluent in, and Google’s <a href="https://developers.google.com/edu/python">online python class</a> was what really challenged me but also provided a great set of resources to come back to about ‘what was that <a href="https://developers.google.com/edu/python/introduction">super basic thing</a> again’. Being able to tool around in the interpreter is way more cool than fish shell prompt bling IMO. All of us who live or die by shell scripting know you hit a line length or complexity where it’s the wrong tool for the job, and I certainly learned by copy-pasting and modifying others code, but you need to reason with and solve problems from scratch ‘on your own’ with a language that intends to give you one good-enough common-case way to navigate a complex control flow. As a community, we benefit from a truly immensely valuable turn of events from over 15 years ago: <a href="https://managingosx.wordpress.com/">Greg Neagle</a> wanted to learn python, worked with Google engineers to add features to Munki, and writes well-commented, as straightforward as possible code with compact functions and not so much sprawl in either number of library files nor line length. Listing all the functions in <a href="https://github.com/wdas/reposado">Reposado</a> and tracing the logic control flow (for a PSU MacAdmins <a href="https://www.youtube.com/watch?v=PrSXU1v10KI">presentation</a>) was one of the best things I did for my understanding of solving non-trivial problems (in reality just tangentially related to the MacAdmin space) in python.</p>
<p>You may find other training resources that stick with you (I also liked the <a href="https://www.coursera.org/learn/interactive-python-1">Coursera python class</a> and like the Google resource above, regularly frequent the <a href="https://pymotw.com/">pymotw</a> reference series), and hopefully you come across approachable problems to take apart. And THEN you should definitely put your flag in the ground and share what you’ve come up with, open source has been a huge part of what CPE needs at any kind of scale. I think running a high-ish visibility project has helped Greg find peers in the community that solve problems in different ways, code review is a hard discipline to be immersed in and we all start somewhere &#8211; reporting issues and writing documentation is super helpful and valuable! Similar to how I benefitted from having to present on the topic of Reposado and my blogging about various things, being able to reason about a stance you’re taking in text is a hugely valuable skill. Greg wrote literal magazine articles on MacAdmin topics, and as the length of subscriptions in MacAdmins Slack’s blog-feed list and infrequency of articles to AFP548 may indicate… there’s always readers in this space looking for cogent content and ways to reason about the challenges this work presents.</p>
<h2>Show &#8216;Em What You Got</h2>
<p>Contribution to open source online has to get slid through the perilous slot of version control, so yet another side benefit of sharing code has been it proves you can slay the git dragon. (VS Code will never get me, but the war was long ago lost for mercurial, good riddance svn etc.) API wrangling and glue code will never stop being a well-worn topic, so if you’re in search of where to show prowess, python modules that handle web and ‘process’ (read = wrapping command line tools to automate things) interactions are what you’ll be seeing for most of your career. (Built-in standard library should be preferred, but if a problem-space-specific pip module is trustable-enough, investigate that and come up with your own qualification criteria!) If you can do some or most of that &#8216;glue&#8217; in a language like ObjectiveC or Go or Swift that&#8217;s all to the better, but these days pseudocode python when designing solutions feels like a common-enough language for design and discussion.</p>
<p>From a similar web and platform perspective, I want to interview people who know how IP subnetting and DNS records work <em>enough</em> and the basic moving parts to troubleshoot connectivity &#8211; I have no clue why this is overlooked so often. Getting at log files is another live-or-die skill for some, for me just being able to process large volumes of text across various formats (json, xml, etc.) to do basic analysis was a fun task that helped in other problem spaces over the years.</p>
<p>If I can be opinionated and brief (ever), don’t learn Jenkins, learn GitLabCI/CD or GitHub Actions and understand convergence time periods and document warranty’d behavior and engage with the pitfalls in both the dependency stack and network links that connect your automation from start to finish. (Also internalize why you should strive to never curl -k, ffs.) Likewise, document your entire DEP deploy process, all the things from an out-of-the-box Mac to the warranty’d Standard Operating Environment. Automation is a contract, put your name at the top of the wiki/notion page and own that you are responsible for what you said your engineering delivers. (It’s ok if the world has shifted before the ink is dry: the time stamp on the page is as much versioning as you need to be held to &#8211; just at least do it once for yourself/future you.)</p>
<h2>Get Through The Door</h2>
<p>More opinions! One (pdf) page for a resume SHOULD BE enough &#8211; anyone will help you whittle things down and format it well enough if you ask them, and a LinkedIn or Google Sites page with your entire history can fill in the rest of the details if you want to be verbose. Phrase achievements during your time with your previous employers in quantifiable numbers things like budget and/or time and/or complexity, impact-wise. Include stuff you have working knowledge of at least maintaining, don&#8217;t list alphabet soup. Do check the recruiter boxes in a job post! I want you to get past the recruiter pulse check, you&#8217;ll save them time if you include tangible experience with the tools we&#8217;re asking for familiarity with. Go ahead and tell me you have PHP or ColdFusion or Novell eDirectory or VectorWorks ~or trapeze~ or whatever other things may be considered inapplicable/passé experience as long as you delivered real value with it! Recruiters may not care, but I&#8217;ll be intrigued that you met the business challenges where they needed to be solved; demonstrate-able, broad excellence in anything is a great indication you can be good at Just CPE Thangs<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<p>In recent years &#8216;service delivery&#8217; (meaning hosting Crypt or an MDM or monitoring or inventory or CloudFunction/Lambda/glue-y stuffs or whatever other platforms end up not being solely SaaS nowadays) has meant ‘the cloud’, and for some that has also meant Terraform (or whatever platform-specific way of delivering your needed infra to your cloud is). My recent dalliances with compliance also brings us back to the fundamental need and unique problem space configuration management tools like Puppet, Chef, SaltStack and Ansible address. I cannot overstate the importance of approaching high-stakes infra or config delivery with that mindstate: you must get as much of your setup into repeatable code as possible, and at least understand the off-ramp one must take when the workflow around basic scripts ain’t gonna cut it anymore. You’ll definitely be leveling up past where I’m at when you can reason about where ‘data’ and/or config-specific boundaries ‘naturally’ lie and can be dealt with separately in Infra As Code and server-full (or, even cooler, serverless+metrics) config mgmt deployments.</p>
<h1><img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f647.png" alt="🙇" class="wp-smiley" style="height: 1em; max-height: 1em;" /></h1>
<p>Ok, pardon that may have been a bit of a firehose. I write like I talk, and I’m a recovering New Yorker. Hopefully the whole audience sees things in this they can get value from, and I’m glad to discuss things further in the comments or Slack or elsewhere online! (No I do not has a WoolyMammothdon.) Best of luck!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2022/11/07/couch-to-50k-cpes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Zentral for ~Observability~ ~Governance~ Compliance</title>
		<link>https://www.afp548.com/2022/09/29/zentral-for-observability-governance-compliance/</link>
					<comments>https://www.afp548.com/2022/09/29/zentral-for-observability-governance-compliance/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Thu, 29 Sep 2022 13:54:56 +0000</pubDate>
				<category><![CDATA[Management]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[auditing]]></category>
		<category><![CDATA[CIS]]></category>
		<category><![CDATA[client platform engineer]]></category>
		<category><![CDATA[compliance]]></category>
		<category><![CDATA[devops]]></category>
		<category><![CDATA[gitops]]></category>
		<category><![CDATA[governance]]></category>
		<category><![CDATA[grafana]]></category>
		<category><![CDATA[jmespath]]></category>
		<category><![CDATA[Munki]]></category>
		<category><![CDATA[observability]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[osquery]]></category>
		<category><![CDATA[prometheus]]></category>
		<category><![CDATA[zentral]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387667</guid>

					<description><![CDATA[You’ve watched my MDOYVR presentation, but instead of being able to draw an owl, you’re concerned about standing up an osquery query distribution stack in production (unfortunately not what we’ll cover in this post, sorry!) and actually doing the job of visualizing the data. ‘Observability’ and ‘governance’ are my favorite buzzwords of late, because the [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>You’ve watched my <a href="https://www.youtube.com/watch?v=HVycnWM_4lA">MDOYVR presentation</a>, but instead of being able to draw an owl, you’re concerned about standing up an osquery query distribution stack in production (unfortunately not what we’ll cover in this post, sorry!) and actually doing the job of visualizing the data.</p>
<p>‘Observability’ and ‘governance’ are my favorite buzzwords of late, because the Reporting Structure Above incentivizes us Client Platform Engineers to display the slog of busywork we ship when preparing for being audited as it immediately turns into proof of a compliant state &#8211;  in being rigorous, we mix in things that prove we&#8217;re doing our <em>actual</em> job, and the org validates that every effort is proven to be worthwhile or dashboards wouldn&#8217;t need to be looked at. I won’t spend too many characters on ‘feelings’ about this whole CIS thing, I think I got enough of that out of my system, so in this post we&#8217;ll elaborate on the client and server and the data moving parts of actually shipping those checks.</p>
<p><img decoding="async" src="https://i.imgflip.com/6u0i11.jpg" alt="Outkast reference" /></p>
<p>As we use Zentral to get the job done, it&#8217;s what I&#8217;ll be referencing a bunch in this post. Bundling Grafana/Prometheus/OpenSearch behind its osquery service gave us flexible options at an enterprise scale, but that&#8217;s admittedly a lot of stack if you&#8217;re looking at setting up the ~dozen or so core moving parts (our Terraform apply is ~250 AWS resources between all the alarms and backups and secure infra configs and tweaks and customizations we&#8217;ve built up).</p>
<p>Unfortunately if you were hoping for a clean shot where you wouldn’t need to be a subject matter expert on various parts of the systems you need to audit AND the osquery servers moving parts… ur in teh rong biz/are perhaps in need of reminding what that &#8216;engineer&#8217; part refers to when the whole world has done gone SRE/DevOps-y for a while now. Fortunately, we&#8217;re all lucky to be in the biz with flexible, rock-solid tools like Zentral and the open source communities helping smooth over the rough spots that undoubtedly occur with the various agents that can send data through it. Even our relatively lean team got a long way towards telling a good story in graphs (lies, damn lies, statistics, etc.)&#8230; at least until the delayed and new/future tech debt comes a callin’ <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f605.png" alt="😅" class="wp-smiley" style="height: 1em; max-height: 1em;" />.</p>
<p>Zooming back in on the examples referenced in my presentation, jmespath and osquery are the two formats you can write ‘compliance check’s in. The ‘pass/fail’ data for these can then be surfaced as ‘filters’ a.k.a. widgets on the Zentral inventory view. You can even include a collection of them at a RESTful URL to easily point folks at. But… Zentral has a GUI only a developer could love <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f605.png" alt="😅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> &#8211; just as vital to the dependability of the backend (by leveraging cloud-primitives like subscriptions and message queues), and frontend (via ‘stores’ like open/elasticsearch/splunk/datadog/snowflake…) that accompanying Prometheus and Grafana stack I referred to lets us tap into and slice and dice the data for even easier consumption &#8211; which folks usually need logging infra and vendor-specific specialization to get at.</p>
<p>Jmespath is a way of querying json data (in our implementation from events earmarked to also get streamed into prometheus buckets) which has usage syntax not unlike jq. Zentral implements common-case, low-hanging fruit/golden-path ways of querying e.g. the presence of mobile configuration profiles delivered to a device (as inventoried by the ‘monolith’ wrapper custom to Zentral in case you’re hosting munki somewhere else &#8211; CERTAIN overpriced MDM’s cannot efficiently return full inventory data about what profiles are installed on a device… no comment.)  But you should keep in mind jmespath is not a full scripting language, you may soon realize how shallow you dip into jq when parsing stuff. Many of the ‘sources’ you can plug in as modules to Zentral (Jamf/Munki/Puppet being the most notable) have a section in each inventory record with the last recorded value for ‘extra facts’ &#8211; that custom/arbitrary inventory data can have simpler jmespath queries run and stop smoke from coming out of your ears. (I’m leaving out some specifics and details about which facts you may benefit from, but… you know where to find us in the Zentral community if you need blanks filled in <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f600.png" alt="😀" class="wp-smiley" style="height: 1em; max-height: 1em;" />.)</p>
<p>Helpfully, you can use the DevTool built into Zentral to take real collected data for a device and confirm that the jmespath check gives you the result you expect, and conversely devices that are in the opposite state are parsed correctly. Besides ‘scoping’ a check to a source or an operating system platform, tags also allow you to take other groupings you can sync into Zentral and apply arbitrary constraints as needed. For example, cloud-hosted Ubuntu systems wouldn’t need full disk encryption and screensaver locks, nor do macOS-based conference room and signage ‘appliance’ Mac Mini’s, so identifying those via tags or sites ensures the checks only run on applicable devices. Here’s an example of confirming the presence of a mobile configuration profile with WSOne or Jamf:</p>
<p><code>contains(keys(@),</code>profiles<code>) &amp;amp;&amp;amp; contains(profiles[*].uuid,</code>E81C883A-6938-4F43-8E28-10428836FB2B<code>)</code></p>
<p>Breakinitdown:</p>
<ul>
<li>First, confirm which source sends the inventory information for the top-level key you&#8217;re going to follow down the tree for (e.g. on Mac, munki gathers profile information)</li>
<li>Then confirm it&#8217;s present (as there may be a slow convergence period e.g. right after DEP bootstrap) by using &#8216;contains&#8217; and the key name wrapped in tildes: contains(keys(@), <code>profiles</code>)</li>
<li>As mentioned, you can customize this for other top-level keys, under <code>extra_facts</code>. Note those would be source-specific, so e.g. you’d choose Jamf if you need EAs</li>
<li>Next, continue evaluating with a logical and, &amp;&amp;</li>
<li>Then enumerate the uuids across all nested profiles with a glob/asterisk in square brackets after the top-level key, and then dot-index into the value we want to check: profiles[*].uuid</li>
<li>Nest that inside a contains() and follow the profiles[*].uuid above with a comma and then the value we&#8217;re checking for wrapped in tildes</li>
</ul>
<p>To reiterate a point I made in the presentation, I find these types of ‘is profile present’ checks… naïve, because you’re trusting that the responsible framework(s) did in fact apply the change/restriction and it’s not pending a reboot or transition to a specific ‘happy state’. So to contrast the previous example, here’s how you’d check that the condition puppet tests for via a fact to run idempotently is in the applicable complaint state, we use funny logic that ends up making enough sense that expressing a boolean in text doesn’t drive us nuts:</p>
<p><code>puppet_node.extra_facts.contains(keys(@),</code>indeed_nfc_disabled<code>) &amp;amp;&amp;amp; puppet_node.extra_facts.indeed_nfc_disabled == 'OK'</code></p>
<p>(We’d always see the puppet_node in the root of the json inventory representation, so we’re going two nodes down the tree to make sure we have the extra_fact populated in the first place, otherwise Zentral would give us a third state, ‘UNKNOWN’ which obvs isn’t ideal.)</p>
<p>To explain how you’d write SQLite to check compliance with osquery, it’s best to start with another naïve example &#8211; this checks the hash of one file and is wrapped with keywords Zentral looks for when parsing its boolean result:</p>
<p><code>SELECT sha256,<br />
CASE<br />
WHEN sha256 = 'omgwtfbbqrandomchars00112233445566' THEN 'OK'<br />
ELSE 'FAILED'<br />
END ztl_status<br />
FROM hash<br />
WHERE path = '/path/to/file';</code></p>
<p>To explain the syntax in use here even if you’re not SQLite/osquery-savvy,<br />
* starting with SELECT and then sha256 as the ‘key’/column ing the result whose value we&#8217;re trying to evaluate results based on<br />
* then CASE so we enter the sqlite ‘logic flow’ where pass/fail criteria can be assigned and different paths can be followed as a result<br />
* then WHEN sha256 = &#8216;sha256werelookingforomgwtfbbq&#8217; THEN &#8216;OK&#8217; ← which designates the &#8216;pass&#8217; case if the osquery hash table says the result of checking that file is as we expect<br />
* ELSE &#8216;FAILED&#8217; (one possible keyword Zentral is looking for in the ‘failure’ state)<br />
* END ztl_status ← this actually renames the adhoc key/column in our results to ztl_status, and is how Zentral knows where it&#8217;s trying to read a value from. The END closes the case statement<br />
* FROM hash ← tells it what table we&#8217;re getting the sha256 of the file via<br />
* WHERE path = &#8216;/path/to/conf&#8217;; ← these are our sql-isms to stretch how you think a database works, since it&#8217;s not something statically stored that we&#8217;re retrieving, it&#8217;s &#8216;at-time-of-query&#8217; that it does the lookup on the device in question to determine what the sha256 of the path stated is</p>
<p>And being more rigorous with an advanced example of a query for the NTP config which SHOULD be parsed and applied as expected on most recent macOS versions… <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f605.png" alt="😅" class="wp-smiley" style="height: 1em; max-height: 1em;" /> (which… we never got the red team to confirm does anything worthwhile? But we felt there wouldn’t be collateral damage/much downside to making this the default, and the GUI is still accessible to confirm SOMETHING we consider accurate is being applied):</p>
<p><code>with compliance_check as (<br />
select sha256,<br />
case when sha256 = 'omgwtfbbqrandomchars00112233445566' then 'OK' else 'FAILED' end ztl_status<br />
from hash<br />
where path = '/path/to/conf'<br />
)<br />
select compliance_check.sha256,<br />
coalesce(compliance_check.ztl_status, 'FAILED') ztl_status<br />
from (select 1 as x) x<br />
left join compliance_check on x.x = 1;</code></p>
<p>For osquery via sqlite, &#8216;join&#8217;s allow us to pull results to correlate or otherwise mash up from multiple tables. Dot-notation is used with those table names to map the &#8216;field&#8217;/column label to either return in the subsequent results or match on when sewing tables together. You can additionally adhoc create new tables to work with or wrap the output from a select statement looking up values in a table into a newly named one.</p>
<p>Zentral provided code to cover the case when the thing we&#8217;re auditing may actually not be present and therefore not return a result, whereas we&#8217;d prefer to fail the check in that context instead of letting it be unknown, to improve on the outcome of the v1 query above. To explain what&#8217;s going on in the v2 example code provided:</p>
<ul>
<li>First we&#8217;re overriding the name of the table &#8216;nesting&#8217; the results of the query in parentheses using the &#8216;as&#8217; keyword to make it &#8216;compliance_check&#8217;</li>
<li>We&#8217;re then requesting two columns/rows &#8211;</li>
<li>sha256,</li>
<li>and the results of the case statement, labeled &#8216;ztl_status&#8217;.</li>
<li>From that new &#8216;metatable&#8217;, we say we&#8217;d like to end up with its sha256 column and a default of failed for ztl_status (via coalesce)</li>
<li>In the process/same line we&#8217;re also re-applying the ztl_status label (since the way we&#8217;re asking for it would be the column header otherwise)</li>
<li>To &#8216;trick&#8217; the query into returning/generating/allowing an empty/NULL result (when as in this case the &#8216;where path&#8217; isn&#8217;t found/the query would normally return no result) we make a SECOND, new table to join against with one key/value, x = 1, and re-lable that single column &#8216;x&#8217;.</li>
<li>Left joining excludes that new tables content but now we can return an empty sha256 and failed for that case on the right-side&#8217;s table. Think of it like a venn diagram where our join only cares about the values distinctly only in the ‘compliance_check’… metatable</li>
</ul>
<p>And now that we’ve broken that down, to bring it all home, here’s the true not-so-secret sauce of the setup: compliance checks status change events get written out to Prometheus metrics, which Grafana can dynamically pull in via variables to a self-maintaining dashboard! The one we use reflects the raw numbers alongside percentages as a time series trend a.k.a. a burndown chart (if we had a threshold, which you can also trivially represent in Grafana as an arbitrary horizontal line, to work towards getting the fleet under). Looks impressive on slides! Get yours today!</p>
<p>Zentral actually has more exciting visualizations, but I’ll round out this article underlying the governance benefits of using this tool for proof when being audited; on Windows and Linux via puppet we check in the code, on Mac we checked in the Munki pkg with the metadata and payload that made the change, then with Terraform to manage the compliance check or gitops to manage the osquery pack we verified that the job got done. And THAT is how you apply rigor to your processes so you can own the ‘engineer’ in your title as Client Platform Engineers, if I do say so myself. I hope you agree and get to work with tooling that enables rigor like this!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2022/09/29/zentral-for-observability-governance-compliance/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Code Wranglers Speak In Tongues (Generally)</title>
		<link>https://www.afp548.com/2020/04/30/code-wranglers-speak-in-tongues-generally/</link>
					<comments>https://www.afp548.com/2020/04/30/code-wranglers-speak-in-tongues-generally/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Thu, 30 Apr 2020 13:51:00 +0000</pubDate>
				<category><![CDATA[Scripting and Automation]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ffs]]></category>
		<category><![CDATA[gist]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[gitlab]]></category>
		<category><![CDATA[mossad]]></category>
		<category><![CDATA[pastebin]]></category>
		<category><![CDATA[path]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[sysadmin oath]]></category>
		<category><![CDATA[tls]]></category>
		<category><![CDATA[venv]]></category>
		<category><![CDATA[yolo]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387632</guid>

					<description><![CDATA[It is commonly said that python tends to be at least the second-best tool to reach for when approaching a task, whereas some of us get by just fine with shell. The lack of a compilation step for scripting languages tends to help us iterate and ship good-enough solutions quickly, and I&#8217;ll be touching on [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>It is commonly said that python tends to be at least the second-best tool to reach for when approaching a task, whereas some of us get by just fine with shell. The lack of a compilation step for scripting languages tends to help us iterate and ship good-enough solutions quickly, and I&#8217;ll be touching on specific style points for both later. For how sysadmins commonly interact with either language, for glue code or tasks to automate, some guidelines I tend to focus on are equally applicable across both.</p>
<p>To even be able to look at the style used (instead of extracting the code from whatever prod system it&#8217;s running on&#8230;) we need to get it in a more share-able format at least. Although we&#8217;ve already touched on git, you don&#8217;t actually need to know proper care and feeding of a repo to let others see your code at whatever state it&#8217;s in; sites like Pastebin have been around forever, GitLab has a snippets concept, and GitHub gists can even accept multiple files in a single page. GitHub then tracks versions for you mimicking a simplified repo. Some of these sites accept anonymous posts, and some links can be shared &#8216;privately&#8217; (for anyone with the link, not even limited to logged-in users with an account) without being discoverable/indexed by search engines &#8211; handy when wanting to share (<em>ahem</em> hopefully sanitized) log files or debug output, as a more general-purpose usage example.</p>
<h2>It&#8217;s all downhill from here</h2>
<p>Now before I go further, don&#8217;t get me wrong &#8211; my pet peeves are not important, and neither is my opinion. (Until it is, intuition is a real thing dedicated practitioners might develop over time. If at all, ever.) Don&#8217;t take it personally if you blissfully do the things I&#8217;m warning against, or ignore the things I&#8217;m advocating for in your code, even though I obviously consider these important enough to write (at length!) about. Maybe I&#8217;m just &#8216;owning the brand&#8217; of being a snob/elitist, but as with anything in life, you either complete tasks where you only care about the goal/&#8217;it appears to do the thing&#8217;, or you show care about the process and let it influence how you operate (on code). All of this is for as much as you both find relevant, personally, and like, remember/take the time/effort to do. Real scientists <strike>publish</strike> ship.</p>
<p>But, except for XML, use spaces, not tabs. Or be wrong, up to you. :sarcmark:</p>
<h2>Trust no one</h2>
<p>Taking it from the top, she bangs! <code>#!'s</code>! Pay attention to how you&#8217;re finding an interpreter in whatever execution environment it is that the code is supposed to/ is intended to be running in, especially if you&#8217;re pointing to a path that&#8217;s actually a symlink. (Like /bin/sh, which actually points to&#8230; /bin/bash&#8230;) With python 3, using an env shebang is definitely a risky click if not exactly YOLOMODE. (Unless you&#8217;re in a venv, natch.) It&#8217;s more reliable to be as explicit/exact as you can, at least feel free to explain what e.g. version of python and what 3rd party modules you&#8217;re expecting (if any) in comments or associated docs. Keep in mind when contributing to other projects that they have probably considered this fundamental piece carefully; sometimes you may actually not want to specify an interpreter, for example in &#8216;library&#8217;-like modules loaded by other code. Reasonable people can disagree, but it&#8217;s house/maintainer rules. Or you can go fork yourself. (That might sound aggressive, I mean it that you&#8217;re more than welcome to show the world how it&#8217;s done in your own repo &#8211; I&#8217;m happy as long as others can see how you&#8217;re solving a problem at all, if you&#8217;re kind enough to share.)</p>
<p>Continuing with not trusting PATHs, anytime you&#8217;re essentially shelling out or leveraging a binary, when I&#8217;m the reviewer, I&#8217;m going to expect you to use the full path. (Again, including symlinks, if you weren&#8217;t already aware, var, tmp, and etc are symlinks to inside root /private in macOS). This is definitely a style point, but instead of assuming the contents of a defined path is what you expect, (or worse, assume that e.g. launchd or the agent running this code knows what paths/lookup order has the version you need) doing this is (again) potentially better/more defensive by being explicit/exact. With Apple SIP-protecting some defined paths you may find it less important, and that&#8217;s ok, but they&#8217;re also requiring us to ship our own interpreters more and more. (Targeting a SIP-protected path in your shebang is probably good practice for as long as those paths can be relied on :sweat_smile:)</p>
<p>I usually check for the complete path with <code>which &lt;binaryname&gt;</code>, but also consider the output of <code>type &lt;binaryname&gt;</code> &#8211; if it&#8217;s not a shell builtin, it may not be portable to *nix, on the off chance that&#8217;s important for you to know/handle. And don&#8217;t take it for granted that Apple won&#8217;t move stuff around or delete it on a whim/in a point release. (Yes it was a major OS release, but we all recall how telnet got pulled.)</p>
<p>If you&#8217;re talking to an API or expecting specific schema for a data structure your code parses, consider putting your assumption of that criteria in comments/docstrings, a sanitized example is even more straightforward. That leaves a paper trail/gives context for why you operated on it in a specific way (and what was valid input to your program at some point in time), with the bonus feature that people can take that mockup and replicate your experience/confirm your assumptions (even without access to the same system). Same for links to API docs or other references that were used to understand the system being interacted with. It&#8217;s ideal if someone other than just the creator can follow the references and see the &#8216;shadow&#8217; inputs operated on by the design, this really shortens ramping-up time to reason about whether the decisions made were the best way to approach the problem.</p>
<h2>Easiest computer to throw out a window: yours (ideally into the ocean)</h2>
<p>You don&#8217;t run random code from the internet without at least attempting to confirm it does what you need, I hope/presume? The same goes with boilerplate/scaffolding/auto-generated stuff that bootstrapping tools may &#8216;crap up&#8217; your repo with. Some of it can certainly be helpful when you&#8217;re getting started, but it&#8217;s all code you&#8217;ll end up owning, and you want to strike a good balance of &#8216;I think I have to include at least this amount of bloat to ship&#8217; with &#8216;now that I understand enough of the moving parts, let&#8217;s strip this back to focus on what we actually need/use&#8217;. Convention is a good thing to follow when collaborating with a larger community that imposes boilerplate on us or wants us to grapple with what they consider best practices, but otherwise let&#8217;s leave it as close to brass tacks as possible so we don&#8217;t have trouble remembering where we actually started making the code do things. Unused functions that are mostly stubbed out or exercise nothing should be purged until activated. Ideally, everything we commit to git should have a reason to exist <em>that we can explain</em>.<br />
To mix all the metaphors, code both rots and is flammable, don&#8217;t have too much of it in one place. Teach a person to code, they&#8217;re on fire for a lifetime, amirite?</p>
<p>As part of these style nitpicks, this may not be as valuable/important to you/your team, but consider removing extra/extraneous comments, verbose manual logging, or debug echo/print() statements (unless gated by arguments/a flag and/or logging level) &#8211; ideally debug would stick around in something like integration tests that help you validate assumptions/confirm serviceability, but elsewhere in your code it could leak secrets or otherwise add unnecessary overhead/bloat to sift through when put into service/deployed to &#8216;prod&#8217;.</p>
<h2>Can&#8217;t believe I have to say this</h2>
<p>I think besides being overtly&#8230; &#8216;particular&#8217;/borderline-cargo-culty in points above, I&#8217;ve been a benevolent <strike>rubocop</strike> dictator. (All the metaphors!) Time for bad cop.<br />
I don&#8217;t know who needs to hear this (jk, you unconscionable no-good-niks, you know who you are)&#8230;</p>
<p>Log.</p>
<p>It&#8217;s usually not hard and will save your butt later, it&#8217;s certainly cheaper and more practical than a time machine or &#8216;god mode&#8217;. Put whatever output you generate somewhere discoverable, e.g. in /private/var/log for system-wide or ~/Library/Logs, and check out the python and bash follow-up post for examples. If you then have those logs shipped/aggregated, know what value it will actually provide to put stuff at different &#8216;levels&#8217; &#8211; &#8216;info&#8217;, &#8216;warning&#8217;, &#8216;error&#8217;, &#8216;debug&#8217;, etc., are those labels too numerous and too open to interpretation for your team? Maybe just assume only qualified individuals even look at/read this stuff anyway, so shove anything helpful in there and let your log ingest system discard whatever you don&#8217;t need, maybe? Consider writing json blobs if appropriate (or some other parseable format, just throw us a bone with UTC timestamps and delimiters or something, especially if you want to quickly turn the corner from shipped data to metrics). Got state you want to track locally? Consider shoving stuff into a database format, primarily if you are generating data that would benefit from ledger-style operations. Just leave a record somewhere, optimized for retrieval!<br />
For more &#8216;vanilla&#8217; logs, rotate and purge using system-native facilities (logrotate for Linux, apple system logging conf&#8217;s on Mac, etc. Don&#8217;t be like vanilla Docker.) Or don&#8217;t purge! If you don&#8217;t think it&#8217;ll be more than a couple hundred MBs in your average computer lifespan, maybe who cares, maybe disk is cheap and plentiful enough and this historical data local is helpful to have? Hey, if you break it you get to keep the pieces. (Or Apple will just helpfully dump it for you on OS point upgrades, surprise!)</p>
<p>Continuing, ffs, go out of your way to trust (and confirm your code validates) TLS certs when transiting the series of tubes. It&#8217;s worth it not just because it encrypts bits on the move, it also assists in validating the host you&#8217;re talking to. Another side effect is, when it&#8217;s wrong and due to our inspection it gets fixed, we&#8217;re being part of the solution. Calling protecting people&#8217;s privacy a side effect is almost forgetting <a href="https://www.usenix.org/system-administrators-code-ethics">the oath</a> we all took as sysadmins.</p>
<p>Are you pulling random dookie over the network to then pass to processes running as root? Checksum it. It&#8217;s literally the least you could do. Don&#8217;t let you and me get joined at the MacMule. Otherwise you may be able to join that startup working on Privesc-as-a-Service.</p>
<p>And finally, to wrap up Things You Should Already Know: don&#8217;t put api keys, passwords, or secrets-in-general in plaintext or trivially-reversible formats. Options are available, but for crissakes obfuscation shouldn&#8217;t be one of them &#8211; truffle hogs look for that stuff, you&#8217;re not being clever, herr hax0r. Private repo&#8217;s are not an excuse, what happens in obscurity ends up dehydrated on a casino rooftop in Vegas. Environment variables? Decoupling a credentials file? Those are (arguably) Less Turrible, but Still Not Great<img src="https://s.w.org/images/core/emoji/17.0.2/72x72/2122.png" alt="™" class="wp-smiley" style="height: 1em; max-height: 1em;" />, but again I&#8217;m not in security and can&#8217;t tell what your threat model is (although hopefully it&#8217;s not <a href="https://vimeo.com/95066828">Mossad</a>). Is SAML hard? Yes. Should we all find ways we should integrate with it when appropriate? It&#8217;s often the only game in town, take yer lumps. Using libraries written/evaluated by crypto pro&#8217;s? Yes pls. I&#8217;d add that PKI (e.g. client certs signed by a trusted CA) is another potential avenue to handle authentication/identification which you can therefore leverage as an ingredient when at least authorizing access, but don&#8217;t listen to me! I&#8217;m a rando on the interwebs. (They says, ~1800 words later.)</p>
<p>Tune in for our next installment where we get into the actual programming language slingin&#8217; specifics!<br />
Got other general coding &#8216;best practices&#8217; thoughts? Use your tweet horn to holler at me!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2020/04/30/code-wranglers-speak-in-tongues-generally/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What we talk about when we talk about code wranglin&#8217;</title>
		<link>https://www.afp548.com/2020/04/20/what-we-talk-about-when-we-talk-about-code-wranglin/</link>
					<comments>https://www.afp548.com/2020/04/20/what-we-talk-about-when-we-talk-about-code-wranglin/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Mon, 20 Apr 2020 13:23:00 +0000</pubDate>
				<category><![CDATA[Scripting and Automation]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387605</guid>

					<description><![CDATA[Part Two, Git Recommendations Revisited. (Part One is Here) Since we&#8217;re talking code, we should come to grips with the ungainly topic of version control itself before going much further, which in 2020 still means git. On this site (~6 years ago! with not the most generous title) we went over what could be considered [&#8230;]]]></description>
										<content:encoded><![CDATA[<h2><em>Part Two, Git Recommendations Revisited. (Part One is <a href="https://www.afp548.com/2020/04/13/code-wranglin-part-one/">Here</a>)</em></h2>
<p>Since we&#8217;re talking code, we should come to grips with the ungainly topic of version control itself before going much further, which in 2020 still means git. On this site (~6 years ago! with not the most generous <a href="https://www.afp548.com/2014/08/05/look-less-silly-on-github/">title</a>) we went over what could be considered a common-enough basic workflow and tips for git beginners, this time around I&#8217;m going to point out a more team-focused workflow and newer developments or caveats about that post:</p>
<p>Originally I encouraged forking into your user&#8217;s namespace/account instead of potentially piling up branches, or having to be explicitly added to the destination repo so you can create them there. This helped folks who often forgot to click the box to delete their short-lived branches on merge, which the web tools can even clean up in the (remote) forked space for you. I recommended this guidance as good hygiene, but there&#8217;s one caveat: automated testing/CI/CD runners may only be available on the main repo/project, so if it&#8217;s configured that way then sending a pull/merge request could trigger tests to be run on the remote/&#8217;userspace&#8217; repo, and it could complain/not work. If the runner can&#8217;t be configured for individual users it&#8217;s no big deal to branch &#8216;locally&#8217; to the repo, especially if common &#8216;guard rails&#8217; like approvals/protected branches are in place. If you haven&#8217;t run into that as an issue, the overarching guidance remains. (Or if it&#8217;s too obscure to understand what I&#8217;m warning against, like, y&#8217;know, git is weird, please follow up with us in the comments or on the Twitters.)</p>
<p>One of the first times I really started to hate git&#8217;s user experience was squashing commits or trying to not include updates/&#8217;catch up&#8217; commits in a fork/branch in my user account/space. You lose no &#8216;internet cool&#8217; points if you delete your fork entirely in the web GUI and start over wherever the main branch you&#8217;d previously forking off of is at now, but there&#8217;s also <a href="https://rick.cogley.info/post/update-your-forked-repository-directly-on-github/">this post</a> about catching up your fork in a way that people have had success with.</p>
<p>If your team tracks work in a bug tracking/ticketing system, it may provide good context and extra metadata (or just be convention) to prefix your branch names and/or commit messages with the related identifier. (Some Jira-specific integrations I&#8217;ve seen actually rely on it and can provide context/feed metrics.) No, the code is not the documentation, unlike my obscure elusive magical unicorn comments, even the most verbose/perfectly-written comments are probably not enough context&#8230; This is just to say when an out-of-band communication method is preferred for a project, please consider using it. Wiki&#8217;s similarly exist for a reason.</p>
<h2>Quick Tangent</h2>
<p>Definitely don&#8217;t be like me and call &#8216;everything my beginners mind gets tripped up on&#8217; a &#8216;frequently asked question&#8217;, although these getting started questions could use recording somewhere in my opinion. Imagine someone new to your team, new to the language, the framework, new to coding/version control, and help them in a discoverable way like you would have appreciated!</p>
<p>While we&#8217;re talking docs, something that previous teams I worked with in sysadminery aspired to, (at least take the time to think about actually doing eventually) is straight up test plans &#8211; formal documentation on how to exercise the code, how to pull together the moving parts or get access to applicable test data/accounts/systems. If it&#8217;s a trickier deployment, what&#8217;s the (set of) success metric(s), rollback steps to follow, etc. This may actually be coupled with the idea that your design document (something else we&#8217;ll cover in a subsequent post) led to these decisions. Side benefit, it can become a preview of potential maintenance tasks to support a measurable <a href="https://landing.google.com/sre/sre-book/chapters/service-level-objectives/">service-level objective</a>. If we want to get buzz-wordy. (I promise, no story points or other stuff I haven&#8217;t actually been required to show &#8216;agility&#8217; with! Got a reason why scrummy work is helpful/horrible? Holler at us on the Twitters or in the comments!)</p>
<p>Back to the-actual-name-is-Linus&#8217;s-Monster, there&#8217;s all sorts of opinions on styles and conventions you could use for the commits themselves, and the first reference I recall coming across was <a href="https://chris.beams.io/posts/git-commit/">this one</a>. The gist is, code diffs already explicitly say what changed, so you&#8217;re encouraged to think about it from a workflow perspective: the specifics are less important than <em>why</em> it changed over time: imagine scanning the commit history to notice when a &#8216;shift&#8217; occurred, when intent or functionality shifted. Issue tracker/ticket notes and the full body/description of a commit are where you can provide additional context. Git was designed to use email as its primary communication method, all of this back-and-forth should be considered written communication and approached accordingly. Or maybe you don&#8217;t want to think about it too much, all of this is to say record more of what you were trying to achieve (to use a Neagle-ism), less of how you mechanically did it. (Typo commits can get rolled up and squashed anyway.)</p>
<p>Another less commonly discussed topic is how often to commit, what or how often to squash, and I guess we can relate it to why we&#8217;re putting this under &#8216;revision control&#8217; in the first place. Just like <em>why</em> you backup your files &#8211; it&#8217;s for the restore, right? Only your team knows how much value seeing the code&#8217;s evolution over time actually has, keep in mind tags and &#8216;topic&#8217; branches that you use while working on a specific release/feature/issue may provide a good-enough record of signposts in time that will still be around in retrievable history, even if every iteration isn&#8217;t in the primary branch those events are formulated in. This is all to say I personally tend to not see value in making granular commits e.g. per file changed, nor does every commit from the topic branch require preserving when merging; I often squash in the GUI and not worry what iterations were involved. It&#8217;s almost as if the mainline history should consist only of merge &#8216;events&#8217; and the state of commits in branches don&#8217;t matter until after it gets eyes on/potentially altered in a review. (&#8216;Draft&#8217;/WIP/Work In Progress designations are similarly used to conserve on commits that need to get merged with a topic branch into the &#8216;main&#8217; branch.)</p>
<p><a href="https://twitter.com/FiloSottile/status/1248110291751231488">Maybe you don&#8217;t need to gpg/pgp-sign commits</a> (via <a href="https://twitter.com/wikiwalk">@groob</a>). Maybe you work in &#8216;security&#8217; and want to show you&#8217;re tall enough to ride/can attest to managing some extra sort of complication for benefits you perceive as important. I&#8217;m basically doing it for the <strike>&#8216;gram</strike> internet cool points fo sho, via a <a href="https://krypt.co/">system/app</a> that may already be abandonware (like <a href="https://gpgtools.org/">GPGTools</a> tends to look like at times with slower new-OS-release adoption).</p>
<p>In web GUIs/systems like Gitlab and GitHub, committing tweaks to the branch you sent a pull/merge request from will automagically update the changelist/merge/pull request accordingly. Just in case that&#8217;s news to some. Also specific to those webapps, reviewers can make code change suggestions to be accepted/applied by the author right there in the web interface while commenting on lines/reviewing, which is often ideal &#8211; it&#8217;s certainly more collaborative, since the reviewer can spell out exactly how they expect requested changes to be implemented.</p>
<p>In our next post we&#8217;ll get into semi language-agnostic style generalities, stay tuned!<br />
Got other <strike>hot goss</strike>git tips/code review thoughts? Use your tweet horn to holler at me!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2020/04/20/what-we-talk-about-when-we-talk-about-code-wranglin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Code Wranglin&#8217;, A Series</title>
		<link>https://www.afp548.com/2020/04/13/code-wranglin-part-one/</link>
					<comments>https://www.afp548.com/2020/04/13/code-wranglin-part-one/#respond</comments>
		
		<dc:creator><![CDATA[Allister Banks]]></dc:creator>
		<pubDate>Mon, 13 Apr 2020 13:31:00 +0000</pubDate>
				<category><![CDATA[Scripting and Automation]]></category>
		<category><![CDATA[Chelsea Troy]]></category>
		<category><![CDATA[client platform engineer]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[code review]]></category>
		<category><![CDATA[contributing]]></category>
		<category><![CDATA[Daniel Kahneman]]></category>
		<category><![CDATA[demGoogs]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[macadmin]]></category>
		<category><![CDATA[Princess Bride]]></category>
		<category><![CDATA[SysAdmin]]></category>
		<category><![CDATA[Thinking Fast and Slow]]></category>
		<category><![CDATA[yolo]]></category>
		<guid isPermaLink="false">https://www.afp548.com/?p=387589</guid>

					<description><![CDATA[Welcome to a series about wranglin&#8217; cats code. Some of us are inclined to care about titles, and while I&#8217;m fine being a MacAdmin, Client Platform &#8216;Engineer&#8216; is a more recent term recruiters want to plug into LinkedIn. That engineer part is meant to differentiate us from the apes sysadmins, which should already have been [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Welcome to a series about wranglin&#8217; <strike>cats</strike> code. Some of us are inclined to care about titles, and while I&#8217;m fine being a MacAdmin, Client Platform &#8216;<strong>Engineer</strong>&#8216; is a more recent term recruiters want to plug into LinkedIn. That engineer part is meant to differentiate us from <strike>the apes</strike> sysadmins, which should already have been on a path to automation domination and therefore probably sling code like we might aspire to&#8230; Anyways, being even tangentially related to Software Engineering as a discipline has the connotation that we&#8217;ll show our code to someone eventually and want people to collaborate on it, or give it a sniff before it blows things up in &#8216;prod&#8217;. When we do that with others often enough, seeing various code suggestions and workflows, it starts to feel like it would be good for everyone to collaborate and standardize on a minimally-viable-process so us code-butchers can ship better scripts &amp; stuff.</p>
<p>It&#8217;s not helpful to be opinionated AND inconsistent, so I wanted to&#8230; codify some guidelines, and an approach that the folks in my team (and hopefully the community at large) can use as a starting point to collaborate on/argue about in the service of getting us all on the same page regarding style/design &#8216;quality&#8217;/etc. Even open source projects/loosely affiliated groupings of individuals shipping code may benefit from writing this down, but I didn&#8217;t have a good example of how to approach the task for us sysadmin-y types in particular. (If you have references you&#8217;ve found/like for any of the topics in this series, please share on Twitter or in the comments!) It turns out this is a big enough thing for several posts, so I&#8217;m breaking it up and will cover the scripting languages MacAdmins commonly use later on. &#8216;Code reviews&#8217; as a concept may be new to some, so that&#8217;s where I&#8217;ll start in this post.</p>
<h2>Why We&#8217;re Here</h2>
<p>The point of code review is not to &#8216;rubber stamp&#8217; as a mindless formality, nor is it to just confirm it kindof looks like a familiar file extension the author wants to spread blame for prior to shipping into prod. In more rigorous environments, it is also not a given that the reviewer will fully grasp the problem the code is attempting to solve, or be able to exercise all parts/functions in the code, or safely run it against &#8216;production&#8217; data/live systems to 100% validate it,[1]</p>
<p>the point of code review is to have someone else spot-check the code, to&#8230; y&#8217;know, read it, every line, and to make sure it passes some degree of muster for maintainability/whole-team support/adoption that could achieve something almost like endorsement when it ships. The reviewer should display empathy and hopefully have TIL (today I learned) moments, they should reason about the design used and offer alternatives, constructively argue when individual nitpicks clash and help the team collaborate on and grow the style guide with things that are important enough to at least bury hatchets about,[2]</p>
<p>and the changes proposed in the review can be followed through/integrated into the code before/after shipping if/when we have the time/see the value. Because rhetoric is all well and good, but as they say, real artists ship.</p>
<ol>
<li>BTW, &#8216;correctness&#8217; by the original author is not taken for granted, there&#8217;s ways to help prove it to the reviewer we&#8217;ll get into later, but it&#8217;s the author&#8217;s name in <code>git blame</code> who is considered primarily responsible.</li>
<li>Sometimes a style guide contains headstones for your litany of hangups that got sacrificed for team unity/sanity/productivity.</li>
</ol>
<p>The statement right before these sort-of footnotes is important to expand, because developers/traditional &#8216;engineers&#8217; have different incentives and expectations set on them than sysadmins who ship code. Many startups can get years down the road before the YOLO/eff-it-ship-it attitude starts losing its luster and editing code on the live production instance actually causes enough of an outage that business processes are interrupted. Or maybe you get interested in verification processes when you&#8217;re getting audited/acquired, or the lack of rigor just becomes unseemly. For organizations that don&#8217;t value computers, or have low-enough standards, or a high-enough tolerance for pain, maybe that time never comes. For MacAdmins, we know that on the technology treadmill there&#8217;s constantly demands to ship product and anticipate issues. Most (if not all) of our tasks are not purely intellectual exercises, and our managers are incentivized to help us ship better than &#8216;working prototypes&#8217; more often than not. At least, after a company&#8217;s culture evolves to a point that it reaches a certain scale (or plateau) and decides to emphasize stability over velocity.</p>
<p>Ideally, ultimately, we hope things ship with increasing <strong>reliability</strong>. And in the process of getting muscle memory going through a process, we hope reviewers understand both what was written and why, agree that the implementation should ship, potentially help introduce efficiencies, and, where the REAL value comes from, (which is the reason management encourages us to do this in the first place,) reduce/prevent bugs/unwanted side effects.</p>
<p>Opposition to taking the time to check the code into version control in the first place, let alone do a review, usually starts with &#8216;well if there&#8217;s an emergency&#8230;&#8217; Define what an emergency is to your team, otherwise they get the Princess Bride quote, or the &#8216;lack of planning on your part doesn&#8217;t constitute an emergency on mine&#8217; <a href="https://everythingsysadmin.com/books.html">tough love</a>. Getting everyone to stop being independent operators is not easy, so management needs to be on board and lower the (usually false) sense of urgency. We&#8217;ll talk about asynchronous tips below, but anecdotally, having a distributed team increasing turnaround expectations actually helps with this. (When folks <strong>aren&#8217;t</strong> chained to Slack or have Zoom sessions open all day also helps, because often code design benefits from your brain operating in <a href="https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow">system two</a> and the stimulation of a busy chat with instant gratification tends to prevent you from being idle at regular intervals.)</p>
<h2>It&#8217;s dangerous in the code base, take this</h2>
<p>I&#8217;ve already droned on waving my arms for a bit, but needless to say Google shipped their <a href="https://google.github.io/eng-practices/review/">code review</a> and <a href="http://google.github.io/styleguide/">style</a> documentation years back as well-edited references. An important point they discuss for reviews is calling out the good things you see as a reviewer, since this can often look like a critique that the humans submitting the code can feel bruised by, especially in public/on the official record. Breaking the computers, less people are worried about (eventually we all have to <a href="https://en.wikipedia.org/wiki/Escape_from_L.A.">Escape from LA</a>). They get understandably annoyed if you break the malleable humans.</p>
<p>I also benefitted from this <a href="https://chelseatroy.com/2019/12/13/async-collaboration-1-submitting-pull-requests/">series</a> about being on a distributed, asynchronous/non-time-zone-overlapping team landing code together. It does a great job illustrating that this is all about context transfer/communication by taking action and thinking about the other side of the coin and our shared goals. AFP548 lets me publish text in english on the internet, but only you as the reader can judge if I made my point/got across what I set out to say. (Communication is judged on the receiving end, <a href="https://www.youtube.com/watch?v=QhXJe8ANws8">exhibit A</a>.) Positive code review experiences are the result of good back-and-forth communication.</p>
<p>Out in the real world for us sysadmins where reviews may be less codified, if you&#8217;re lucky enough that the project you&#8217;re sending code to already has contributing guidelines publicly stated (e.g. in a CONTRIBUTING.md), then that&#8217;s your defined jumping-off point. We often can&#8217;t choose who reviews our code nor express tone clearly in text from either side of the interaction, so each has to provide context and be as welcoming as possible. As the author, be equal parts ego-less and greedy &#8211; showing you really care that others help you is a great look. If a review process is still in flux, hopefully you find these concepts helpful to mull over, and we can all have fun painting bike sheds later when we get into code style details.</p>
<p>Up next, it&#8217;s unavoidable to talk about the version control tooling itself. TTFN!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.afp548.com/2020/04/13/code-wranglin-part-one/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
