[3 Ways] How to Find and Delete Duplicate Files on Mac

Sarahi Johns.jpeg
Sarahi Johns
Last updated: Nov 24, 2022

Summary: In this article, we'll talk about why there are duplicate files on your Mac and how to find and delete them in 3 ways.

If you've been using your Mac for a while, chances are you've accumulated a lot of duplicate photos, songs, documents, and other files without even knowing it. These duplicate files can take up a lot of space on your Mac. If you're running out of storage space, removing these duplicates can free up some disk space for you.

Read on this blog to know how to find and remove themf rom your Mac.

[3 Ways] How to Find and Delete Duplicate Files on Mac

Why Are There Duplicate Files on Your Mac?

Duplicate files can be created in many situations, such as:

  • Download the same file more than once.
  • Accidentally copied files.
  • Import the same photo from different devices.
  • Attachments to emails and messages.

Now that you know there are duplicate files on your Mac, you may be wondering how to find and delete them. Read on and you'll find two ways.

How to Find and Delete Duplicate Files on Mac with BuhoCleaner: The Easiest Way

The easiest way to find duplicate files on your Mac is to use a duplicate file finder. BuhoCleaner is the tool you need. Its Duplicates feature allows you to quickly find and delete all duplicate files in a selected folder or drive.

  1. Download, install, and launch BuhoCleaner.
  2. Click Duplicates in the sidebar, then click the + button to choose a folder or drive to scan.
    Duplicate File Finder - BuhoCleaner
  3. After scanning, you can see the duplicate files are divided into categories such as images, documents, archives, and other files.
  4. Preview the duplicate files and delete the ones you don't need.
How to Find and Delete Duplicate Files on Mac with BuhoCleaner

How to Find and Delete Duplicate Files on Mac with Finder Smart Folders

If you don't want to install BuhoCleaner on your Mac, then use Finder to manually find and remove unwanted duplicate files.

Here's what you need to do:

  1. Click the File menu in Finder and choose New Smart Folder.
Click New Smart Folder
  1. Click the + button in the upper right corner.
New Smart Folder
  1. From the first drop-down menu, select Kind. Then from the second drop-down menu, select the desired file type.
Find Duplicate Files
  1. Sort the files in the result list by size or name to check for duplicates. If there are, preview and delete the one you don't want.

How to Find and Delete Duplicate Files on Mac with Terminal

Another way to search for duplicate files on a Mac is to use Terminal, a powerful tool built into macOS. If you know Mac very well or are familiar with complex commands, follow these steps to find duplicates on your Mac.

  1. Open Terminal via Spotlight.

  2. Run the cd command to navigate to the folder you want to scan, for example cd ~/Desktop.

  3. Paste the command below into Terminal and press Return.

    find . -size +100 ! -type d -exec cksum {} \; | tee /tmp/f.tmp | cut -f 1,2 -d ' ' | sort | uniq -d | grep -hif - /tmp/f.tmp > duplicate_files.txt

Find and Delete Duplicate Files with Terminal
The +100 in the command means to find files larger than 100 bytes. You can replace it with other numbers you like, such as +10M (files larger than 10MB) and +1G (files larger than 1GB).

This command will create a .txt file on your desktop. What you need to do is open the .txt file and manually find and delete the duplicate files.

Find Duplicate Files with Terminal

As you can see, manually locating and removing all the duplicates in the .txt file is quite time-consuming. Luckily, every file has an md5 hash that doesn't change even if you move or rename the file. So you can use the md5 hash of the files to easily tell if they are duplicates or not.

Here's how:

  1. Open Terminal.

  2. Run the cd command to go to the folder you want to scan, for example: cd ~/Desktop.

  3. Continue to run the following command:

    find . -type f -exec md5 {} \; | awk -F '=' '{print $2 "\t" $1}' | sort | tee duplicate_files.txt

  4. Wait for the script to finish running, and you will find the md5 hash and path of every file.

  5. Go to Finder and manually locate the files and delete duplicate ones.

Find Duplicate Files with md5 hash

The Bottom Line

Now you have learned 3 ways to find and delete unwanted duplicate files on your Mac. As you can see, BuhoCleaner can save you a lot of time and effort. Why not go ahead and try it for yourself?