iCloud ‘Optimize Mac Storage’ breaks the Mojave installer

Yet another example of a really bizarre macOS bug that’s pretty inexcusable as a test escape, given it occurs with the default installation settings on a completely clean OS install.

In short, the Mojave update installer does not work (on High Sierra at least) if you have ‘Optimize Mac Storage’ enabled for iCloud Drive (System Preferences > iCloud pane > iCloud Drive Options… button > Documents tab > Optimize Mac Storage checkbox).

Specifically, the installer reports:

Installation requires downloading important content. That content can’t be downloaded at this time. Try again later.

…and indeed fails to download the actual Mojave update files (the installer app as ‘installed’ via the App Store is merely a 22 MB bootstrapping app, that downloads the actual image only after you run it & start the installation).

Even more obnoxiously, if you use the dosdude1 Mojave Patcher Tool to force-download the entire installer, as soon as it completes the 6.5 GB download and produces the ‘Install macOS Mojave’ app in /Applications, the system deletes the downloaded installation files out from under that app, rendering it just as broken as the official App Store version. Infuriating.

Aside: to be clear, turning off ‘Optimize Mac Storage’ enabled me to produce – and keep – a working installer as downloaded by dosdude1’s tool. I did not verify that it also fixes the regular installer as downloaded via the App Store.

I also ran into the “The recovery server could not be contacted” error message even before all the above, but thankfully that was fixable via the means normally prescribed online – running “sudo ntpdate -u time.apple.com”.

SQLite table constraints must be specified after all columns

Marking this one for future reference.

TL;DR:  You have to specify all the columns in your table, in a CREATE TABLE statement, before you specify table constraints like primary or foreign keys.

SQLite gives the most useless error messages most of the time.  Case in point:

    "ColumnB" TEXT)
    "Column0" TEXT NOT NULL,
    PRIMARY KEY ("Column0"),
    FOREIGN KEY ("Column1") REFERENCES "Foo" ("ROWID"))

That yields the incredibly helpful error message:

near “”Column1″”: syntax error

Cool story bro.

What it’s trying to say is that it wasn’t expecting any more column definitions after that PRIMARY KEY table constraint.  If you simply declare Column1 before the PRIMARY KEY, it works just fine.