How to clean up and optimize your Mac

Keeping your Mac clean and running as fast and smoothly as possible often feels like an uphill battle. Most of us have a spring clean every few weeks or months and then before we know it, our poor old Mac is struggling under the weight of lots of files we don't need and a desktop cluttered with documents we haven't found the time to file away properly.

It doesn't have to be like that. Cleaning and optimising your Mac can be quick and straightforward, if you put these tips into action.

Quick tips to clean up and optimize a Mac

Before you start

Backup.

It's always worth backing up your Mac before you run any scripts or delete anything. Get Backup Pro allows you to make a complete bootable clone of your Mac or choose which folders to synchronize.

Create a backup like a pro

Check performance.

Launch iStat Menus from Setapp to check how your Mac is performing. You can then run it again after you've completed the steps below to see how much of a difference they've made and how much better your Mac is running.

Check Mac performance

Keep your desktop tidy

A tidy desktop doesn't just look better than a messy one, it makes files and documents easier to find and makes your Mac perform better too. That's because each file icon on your desktop is a window and has to be re-drawn every time the desktop changes or you move from one screen to another. The easiest way to keep your desktop tidy is to use Declutter, available in Setapp. Declutter allows you to store files in color-coded folders organized neatly on your desktop. Best of all, it automates keeping your desktop clear and tidy by moving files to the folders based on rules you set.

Clean up desktop files

Get rid of duplicate files

What's worse than having files you don't need taking up space on your Mac? Having duplicates of those same files taking up even more space. You can use Gemini, available in Setapp, to identify duplicate files and remove them easily.

Gemini the duplicate finder

Delete Mail downloads

Whenever you double-click a Mail attachment on your Mac to open it, it's downloaded. Those downloads, over time, can take up a lot of space on your Mac. You have a number of options for dealing with them.

The first is to manually remove them by launching Spotlight:

  • type 'Mail Downloads' to navigate you the folder where downloads are stored
  • drag the files to the Trash. You can always download them again if you need them.

The second option is, if you're running macOS Sierra or later, to open About This Mac from the Apple menu.

  • Click the Storage tab then click Manage.
  • Click on Mail and choose an option to deal with attachments.

The third, and simplest method is to:

  • Launch a cleaner app like CleanMyMac and open the Mail utility. 
  • Click Scan. When CleanMyMac is finished scanning your Mac, you can either click Clean to get rid of all the attachments it's found, or click Review and go through the attachments one by one and decide which ones you want to delete.

Pro tip: If you use Unibox as your email client, you can view attachments by sender and manage them quickly and easily.

Archive large old files

We all have files on our Mac we don't access regularly and which can either be archived elsewhere or deleted. It's helpful, however organize them in such a way as you can see which are the biggest culprits. In CleanMyMac, click on Large & Old Files and click Scan. When it's finished, click on 'Group by' to view files by size, type or when they were last opened.

When you've identified files you want to archive, hover over it with the mouse pointer and click on the magnifying glass that appears. You'll be taken to the file's location in the Finder. You can now copy it to an external drive and delete it from your Mac.

Delete disk images, old installers and zip archives

Once you've installed an app or opened an archive, you no longer need the disk image or zip file. To get rid of them, open a Finder window and start typing either 'dmg' – for a disk image – or 'zip' – for a zip archive into the search bar. When the dropdown options appear, choose File Type to search for disk images or zip archives. When the results appear, review them and drag those you don't need anymore to the Trash.

Clear out your Downloads folder

Your Downloads folder should be a temporary repository for files you download, not somewhere to store them permanently. Open the folder and review its contents. File any items you want to keep in their rightful place and put everything else in the Trash.

Cleanup downloads folder

Remove the system junk

Empty the Trash. Just as your Downloads folder isn't a permanent home for files, the Trash isn't a folder to store items you might want later. Putting stuff in the Trash doesn't free up space, it has to be emptied to do that. So, get into the habit of emptying the Trash regularly.

Clean up caches

Empty caches and remove language files

It's not just web browsers that store data in cache files, macOS does it too. It's likely that you have several gigabytes of data in caches and language files. You could delete these manually, by going to the Library folder in your user folder and searching for them. But CleanMyMac makes it much easier. Launch CleanMyMac, click on System Junk and then Scan. When it's finished, either click Clean to remove everything, or Review Details to choose what to delete and what to keep.

Delete files that "Can't Be Deleted"

There are lots of reasons why macOS might refuse to delete a file. The most common is that the file is in use by an application or process. If that's the case, you'll usually get that error message when you try and empty the Trash.

Here's how to fix it:

  1. Quit any apps that are running and might be using the file
  2. If that doesn't help, it may be a process running in the background that's preventing the file being deleted. Restart your Mac and try emptying the Trash again
  3. If the file still refuses to be deleted, it may be a login item that's using it. Restart your Mac again, this time holding down the Shift key so your Mac starts in Safe Mode. This temporarily disables login items. Try and empty the Trash again, then restart your Mac normally

If none of the above manage to get rid of the file, you should try to delete it using Terminal:

  1. Launch Terminal from the Utilities folder in Applications
  2. Type: rm
  3. Press the spacebar
  4. Drag the file from the Trash onto the Terminal window
  5. Press Enter
  6. Type in your user password and press Enter again

If that doesn't work, try the same command, but add sudo at the start of the command. You'll need to be logged into an administrator account to use it, as it allows you to perform commands as a superuser, such as the root user.

There is one last thing you can try if all else fails:

  1. Restart your Mac while holding Command+R to start up from the recovery partition
  2. Choose Disk Utility from the macOS Utilities window
  3. In Disk Utility, click on the disk that contains the file you want to delete
  4. Select First Aid and repair the disk
  5. Restart your Mac normally
  6. Empty the Trash

The pesky file that refused to be deleted should now be gone.

Run maintenance scripts

Recent versions of macOS are very robust, meaning you should never have to, for example, repair permissions. But there are several maintenance scripts that can improve the performance of your Mac. In CleanMyMac, click on the Maintenance button and click on each script to read a description of what it does. Tick the box next to the scripts you want to run then click Run.

CleanMyMac maintenance scripts

If you follow the process described above with any sort of regularity, say once a month, you can be sure your Mac is operating at near top capacity. Sure, there are always more things you can do, but when the checklist gets too long, we begin to slack more often. So keep this in your arsenal and iterate as you try and test over time.

Sign up to Setapp and try them for free.

Try for free