justin․searls․co

How to fix Contacts not syncing in macOS

There are all sorts of little ways Apple's services can stop working correctly if you ever change the primary email address on your Apple Account. Here's one I ran into. A few months ago, one of my Macs stopped getting new iCloud contacts. My other devices kept syncing just fine. It turns out the Mac still had my old email address in its iCloud Contacts settings, even though System Settings showed the new one.

Here's how I fixed it on macOS 27.2.1 without signing out of iCloud.

How to verify you have the same problem

  1. Check that a missing contact shows up on another device and in Contacts on iCloud.com. Make sure iCloud Contacts is enabled on the Mac. Apple's troubleshooting steps are a good place to start

  2. Open Console and look for AddressBookSourceSync. My logs showed Failed to get a X-mobile me token, HTTP 401, and NSURLErrorDomain Code=-1012. One failed request to *-contacts.icloud.com had my old email address in the URL. Josh Long saw the same thing

  3. If you want to check the account records directly, run the query below in Terminal. On my machine, the AppleAccount row had my current address and both CardDAV rows had the old one

    /usr/bin/sqlite3 -readonly "$HOME/Library/Accounts/Accounts4.sqlite" <<'SQL'
    SELECT t.ZIDENTIFIER, a.ZUSERNAME
    FROM ZACCOUNT a
    JOIN ZACCOUNTTYPE t ON a.ZACCOUNTTYPE = t.Z_PK
    WHERE a.ZACCOUNTDESCRIPTION = 'iCloud'
      AND a.ZACTIVE = 1
      AND t.ZIDENTIFIER IN ('com.apple.account.AppleAccount', 'com.apple.account.CardDAV');
    SQL
    

How I fixed it

Signing out of iCloud and back in worked for Josh and some people on Reddit and MacRumors. I wanted to stay signed in, so I had Codex make a much smaller change. This involves editing macOS's private Internet Accounts database, so only try it if the query shows the same mismatch.

  1. Quit Contacts. If you're using an agent to do this for you, give it temporary Full Disk Access
  2. Use SQLite's backup API to make a private backup of ~/Library/Accounts/Accounts4.sqlite. Check that the backup opens and passes PRAGMA quick_check. Test the edit on a copy first
  3. Update ZACCOUNT.ZUSERNAME for the two active iCloud com.apple.account.CardDAV records linked to your Apple Account. Check ZACCOUNTPROPERTY for those same records. On my Mac, the old address was also in the archived userName, AccountURL, HomeInfo, and PrincipalInfo/principalInfo properties. Decode those binary plists, replace the old address in the relevant strings (including the URL-encoded form), and re-encode them. Apply the changes together in one SQLite transaction
  4. Run launchctl kickstart "gui/$(id -u)/com.apple.AddressBook.SourceSync" and reopen Contacts. Once the sync ran, my missing contact showed up and the logs showed iCloud accepting the requests. Check for a contact you knew was missing, and you'll have verified the fix

I miss the days when I believed the lie that Macs were unlike Windows PCs because they didn't inevitably get bogged down with cruft like this shit, but it is indeed a lie. I wish Apple were more committed to preventing and remediating the kind of data corruption that occurs over time with each of their devices (and backups of those devices, and iCloud databases…). But, at least we have now have coding agents to do what Apple don't.

If the Nasdaq plunging over 10% following months of sweaty finance dudes salivating over Anthropic's IPO isn't the financial equivalent of post-nut clarity, I don't know what is.

Copied!

Sure, it's a bummer that Anthropic and Nvidia are dropping like a rock, but at least we can feel good about Bitcoin being down like 60% off its peak.

Copied!

Jon Hoyt, one of the most relentlessly optimistic and thoughtful people I've met in the software world, has a well-considered reflection about the moment we're living in:

Even inside companies that are enthusiastic about AI, the transition is messy. Two friends at other tech companies told me this week that management expectations are speeding up so much that teams barely have breathing room to learn a different way of working. People try an AI tool once, get a mediocre first draft, and drop it because they have a deadline staring at them. So you end up with a widening gap between the handful of people who have space to experiment and everyone else who is just trying to keep their head above water.

This matches what I've heard everywhere. I see a number of factors conspiring against many tech workers:

  • Leadership sees some engineers absolutely thriving in this environment while others lag far behind, without a clear story that explains the gap. In an industry that never had a way to evaluate good programmers from bad programmers, the line between "gets it" and "doesn't get it" has suddenly become so stark that many rounds of layoffs have been initiated not for financial reasons, but simply to drop developers who've come to be seen as dead weight
  • Corporate training budgets are never the solution to actually teaching people things, but even moreso when the thing people need to learn is so fundamental and far-reaching as requiring a total transformation of identity, mindset, and behavior
  • Mentoring isn't as effective at socializing these skills as it has been in the past, because the single-player nature of agentic work leaves little room for collaboration

My advice? Everyone can agree that the job has changed dramatically and irreversibly, but hardly anybody is acting like it. Executives: flatten your org chart, it was built to operate a different business. Managers: throw out your job descriptions, they're describing roles that don't exist anymore. Developers: let go of writing and reviewing code, it's been rendered economically worthless relative to the cost of your salary.

At the outset of my career and under far less urgent circumstances, I made the conscious decision to forego having a family, many friends, or much of a personal life for the sake of financial security. When I talk to people from my peer group who took the opposite approach and are now asking me what to do, they usually shut down once it becomes clear what sacrifices they would need to make in order to follow my advice. A non-zero number have gotten angry with me, and I don't blame them. This degree of change is worth getting mad about.

You can, of course, choose to do nothing. Maybe your company, department, or career will survive. But if you want to be more confident that you'll escape the AI squeeze, it may require a degree of humility, discomfort, and perseverance that is exceedingly difficult for people who believed they had already "made it."

If you are struggling with this, feel free to e-mail me and I'll help if I can.

Have recently experienced a several consecutive good nights of sleep for the first time in probably 5-10 years, and HOLY SHIT is this how brains normally function?! Sorry for being a goddamn idiot* for the last decade, everyone.

*I'm still a dirtbag, just a lot smarter now.

Copied!

TIL if you uncheck "Auto-close issues with merged linked pull requests," it affects more than pull requests—it will disable all GitHub closing keywords, even Fixes #123 in a commit message pushed straight to the primary branch.

Copied!

Spent twenty minutes chasing down why work was being prematurely orphaned before realizing agents were accidentally triggering GitHub's Fix and Resolves keywords in their commit messages. Example: Fix #723 prototype closed #723 so I never saw that prototype in my queue.

Copied!

Forms and text fields look so bad under in SwiftUI on the Mac that I'm seriously considering switching all 9 of my apps to Catalyst before launch. I don't want anyone to see this shit and think it's my work.

Copied!

Just managed to burn a full week of Fable usage in the 4 hours before it reset. Got so much done that it'll take me a week to fix everything I just accomplished.

Copied!

Review consensus is that the new Apple TV was wildly overpriced for only mild improvements and that the HomeView literally didn't work. Apple TV is now sold out everywhere and HomeView ship dates are slipping into January.

gg ternus

Copied!

Sorry everybody, the most valuable company on earth is so fragile that it would collapse without this one guy, no matter how many laws he broke. You know how it is.

Copied!

At least two people whose travel was disrupted by the FAA fiasco have written in to let me know that they are passing the time listening to Breaking Change, because they have exhausted all available alternatives.

This is why I went into this business.

Copied!