Clean macOS install – the easy way

Updated Jan 2025.

I’ve always been a fan of doing a clean OS install and it’s something I do for every major version (or every couple major versions) of macOS as you are left with a pristine system, one that feels as good as the first day you bought your machine 😍

What does this guide cover?

  • Backing up your personal files (basically your Home directory).
  • A fresh clean install after formatting (wiping) your disk.
  • Restoring your files and emails.

Before you start

Before you start you will need to make sure your existing computer is running the same OS version as your target, so do an upgrade first and run the system for a while first so you know everything is working as expected.

If you’re using this to set up a new machine, if the old machine is an Intel Mac then first carry out a standard migration from your old machine to your new one and run it for a few days to ensure everything is working.

What do you need to copy/back up before you begin?

As we’ll be re-installing all our programs and dev environment from scratch the only thing most of us will need apart from installers for our programs is a copy of our files (and passwords if they are not stored in iCloud). Most of us also have iPhones so store contacts, calendars and notes in iCloud, so I’m assuming you’ll be doing the same.

For peace of mind, ensure you have done a Time Machine backup in case something goes catastrophically wrong (it never has in my case tho).

If you have a standard set up then everything we need should be located in our home directory. So for instance on my mine this is Macintosh HD > Users > Aston, making Aston my home directory. Simply drag this folder on to an external hard drive. It’s handy to have viewing hidden files switched on first, this can be done via the following in terminal:

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

If you experience any errors on copying your files

When copying your Home directory if you get an error that says “The operation can’t be completed because “Library” needs to be downloaded” or “The operation can’t be completed because an unexpected error occurred (error code 0)” this almost certainly means some of your library files are being stored in the cloud (crazy, right!?)

To get around this go to System Prefs > Your Name > iCloud > Drive and switch it off. It will ask whether you want to retain an (archived) copy, click yes so you’ve got a copy.

If this still doesn’t work, no problem, just copy everyone in your Home directory apart from .Library, and then simply copy what you need. For me that is usually:

/.Library/Mail
/.Library/Accounts
/.Library/Messages
/.Library/Application Support/MobileSync/Backup/

iCloud

I personally use iCloud for the Safari bookmarks, Notes, Calendar, Contacts, and some Apple apps like Pages because I have an iPhone and it’s really handy having them automatically synced. If you do the same you won’t need to worry about transferring their data to your new install as they will get synced afterwards. I personally do not use iCloud for passwords, if you don’t either, make sure you have a copy of them…

Make a note of your passwords

To be on the safe side I make a note of any passwords I need (and put them into a password protected PDF afterwards). Most of the time you can reset app/website passwords by email. Passwords for use with any Apple Mail accounts should get copied over with the /.Library/Accounts directory we copied earlier but you may want to make a note of them just to be on the safe side. Here’s how to get them:

KEYCHAIN PASSWORDS – simply open the Keychain Access app and then look in the ‘login’ and ‘local items’ sections on the left. To make a note of any passwords stored here simply right-click and select ‘copy password to clipboard’. Then make a note of it. I’d use something like a ‘mypasswords.txt’ file – which you can later convert to a PDF and password protect it.

SAFARI PASSWORDS – Open Safari then go to Preferences > Passwords. Or just open the Passwords app. You can then click on an item to view the password. Add the ones you need to your ‘my passwords.txt’ file.

Once you’ve compiled a list, in your text editor (with your password file open) go to Print > Save as PDF > Security Options, and then enter a password and save it.

Note: When I last did a clean install I found that the passwords in the Password app got copied over, so I am guessing this was part of the /.Library/Accounts directory as I do not have iCloud Keychain/Passwords switched on. But I’d still make a note of important passwords just to be on the safe site.

Once everything is backed up

We can now begin install of macOS onto our machine – if you are reinstalling onto your original/only computer double check you have ALL of your files backed up or copied onto an external drive because you will be wiping your computer’s drive clean! To be on the safe side, do a Time Machine backup on to another disk too – I’ve never needed it but it will be there for peace of mind.

Create a bootable installer for macOS

Use this guide to create a bootable installer: https://support.apple.com/en-us/HT201372

Time to install macOS!

You can follow the install instructions via the link above, but it usually goes something like this:

Insert the USB drive and restart your Mac, but hold down CMD and R (on older Macs you might need to hold down the ALT key instead)

If you have a newer version of macOS it will ask you to type in the password of an existing account. Then…

  • Go to Disk Utilities
  • From the ‘View’ menu select ‘Show All Devices’
  • Select the disk you want to install macOS on to
  • Select APFS and GUID Partition Map (don’t select encrypted, we’ll do that later)
  • Give it a name (most people use ‘Macintosh HD’)
  • If you want to securely delete what’s already on there choose the option in ‘security options’ (Not needed if your previous install was encrypted)
  • Click ‘erase’
  • Once done close the window
  • Back in the main options screen select Reinstall Mac OS X

Then follow the instructions to set it up. To make life easier I use the same user account name and password as my previous install. Then once it has installed…

Change your account name, turn on Firewall, install LittleSnitch and turn off wake from sleep for network activity

Firstly, DO NOT open the MAIL app until after we have restored all of our mail settings!

  • Apple now prefers to use lowercase for account names but if you’re like me, and prefer to capitalise the first letter of your name you will first need to create a new admin account (via System Prefs > Users & Groups) and then log out of your account and log in with the new admin account, navigate to your Users directory and then change the first letter of your name (so for me that was Aston from Aston) then go back to System Prefs > Users & Groups hold down Control click on Advanced then change the path from /Users/yourname to /Users/Yourname. Then restart the machine and go to your main account and delete the temporary admin account you created.
  • For some odd reason the Firewall isn’t on by default, so go to System Prefs > Security and Privacy to turn it on.
  • Install LittleSnitch if you like to control network activity for your programs.
  • Then if you don’t want your Mac to wake from sleep because of network activity, turn it off via System prefs > energy saver > uncheck wake for network access

Time to put back your files and mail

Now that you’ve backed up all your important files and done a clean install, it’s time to put back all your important stuff such as your emails ,files and other important files such as those in your .ssh folder.

First, make sure hidden files are switched on, in the terminal type:

defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder

Apple Mail

Restoring mail used to be a pain, thankfully Apple have made things easier, simply copy these (or the contents from them) from your backup to the same places on your new install (I usually move the contents that are already in those folders into an ‘old’ directory, just to be on the safe side):

/.Library/Mail
/.Library/Accounts
/.Library/Messages
/.Library/Application Support/MobileSync/Backup/

RESTART YOUR MACHINE

Once your machine has restarted it is ok to open Apple Mail – all your email accounts and emails should be present, it shouldn’t, but you might be prompted for the passwords.

Hidden files, folders and fonts

Move the /.ssh folder from your backup to the root of your new home folder.

Repeat for any other hidden files you need, such as the .bash_profile and .gemrc etc. (I recommend copying program specific files AFTER you have installed them, such as .gvimrc, .gitconfig, .vim/colors directory, etc.)

Copy or double click any fonts you want installed on your new system, from /.Library/Fonts on your backup to the same on you new install.

Restoring the rest of the home directory and installing your other programs

Now the easy part!

You can now move all your other files from the backup to the new install. Personally if a folder already exists (such as the Music, Movies, Documents, Downloads, Desktop folders etc) I move the contents of the folder into it rather than trying to overwrite it. Your custom/non-standard folders can just be copied over.

Once that’s done, you can then install all your programs as normal.

There you have it, a nice fresh start which should give your machine a new lease of life! 😎