Monterey can have an upgrade issue. In some situations, the upgrade will fail and get stuck with a progress bar that never completes even after waiting for 10 hours
When you are upgrading to macOS Monterey, Big Sur, or Catalina your upgrade could fail if it matches a specific condition.
There can be a large number of old files that have accumulated from previous installs if you have more than 20,000 files in this folder your upgrade could fail.
-Can I check how many mdworker files my system has before an upgrade?
-If I have a large amount of mdworker files, how do I clean them out before I start my update?
-I have already started the update and my computer is stuck.
If your Mac has not failed the upgrade yet
You can run both commands to remove the problematic directories.
rm -rf /private/var/folders/*/*/C/com.apple.mdworker.bundle
rm -rf /private/var/folders/*/*/C/com.apple.metadata.mdworker
Or run both find commands
sudo find /private/var/folders/*/*/C/com.apple.mdworker.bundle -mindepth 1 -delete
sudo find /private/var/folders/*/*/C/com.apple.metadata.mdworker -mindepth 1 -delete
If you get an error just take that part off and run find without sudo
NOTE: The rm and the find command might take a LONG time.
Your Mac has already failed the upgrade.
Run both commands from macOS recovery terminal.
rm -rf /Volumes/Macintosh\ HD\ -\ Data/Previous\ System/private/var/folders/*/*/C/com.apple.mdworker.bundle
rm -rf /Volumes/Macintosh\ HD\ -\ Data/Previous\ System/private/var/folders/*/*/C/com.apple.metadata.mdworker
find /Volumes/Macintosh\ HD\ -\ Data/Previous\ System/private/var/folders/*/*/C/com.apple.mdworker.bundle -mindepth 1 -delete
sudo find /Volumes/Macintosh\ HD\ -\ Data/Previous\ System/private/var/folders/*/*/C/com.apple.metadata.mdworker -mindepth 1 -delete
NOTE: the rm & find command might take a LONG time.
You will know the commands worked when the command prompt appears again. This means the command finished successfully.
The files have been deleted! Now what?
- You have successfully checked the file count and cleared the excess file count.
- If you removed the files before the upgrade you should be ready to go for a safe upgrade. Make sure that you always backup your files before any upgrade.
- If your Mac had a failed upgrade, all you need to do is reboot and the upgrade should finish!!!
If your Mac failed the upgrade & you booted up in Safe Mode
If you booted a failed upgrade with safe mode it should have started the Setup Assistant. If you created a new user, you would find that the previous user on the system is gone. But wait, the user home folder is still there. All you will need to do is boot to recovery, remove the extra files mentioned so the upgrade can finish. When the upgrade finishes, you can add the user back. When I had this happen, I lost my admin user account status, and I had to use additional commands to create a new admin user on the computer. You might have to backup the data of the system and reinstall macOS
This is not an isolated issue and affects multiple versions of the macOS installers.
If you have problems installing Monterey on your computer. Or know of different ways of solving this problem, please let me know.