Apple - Bootcamp: The startup disk does not have enough space to be partitioned
Okay, the solution is that I did not disable Time Machine and remove all backup drives first. Doing that solved the issue. So the full solution is:
Disable "Backup Up Automatically" in Time Machine System Preferences, and remove all backup drives, such that it looks like this:
Then run sudo tmutil thinlocalsnapshots / 999999999999
And try again. Optionally restart the computer and try again.
In Mojave, what I had to do was turn off Time Machine and then run this command to force clean out the local snapshots:
tmutil thinlocalsnapshots / 1000000000 1
where 1000000000 is the size of your drive and the "1" means urgent. This has to be done a few times since it only cleans up a few local snapshots each time.
After that, you should be able to see sufficient space available with this command:
diskutil apfs resizecontainer disk0s2 limits
Open activity monitor and force quit backupd
, then click continue in the bootcamp assistant.