[3 Ways] How to Find and Delete Duplicate Files on Mac
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.
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.
- Download, install, and launch BuhoCleaner.
- Click Duplicates in the sidebar, then click the + button to choose a folder or drive to scan.
- After scanning, you can see the duplicate files are divided into categories such as images, documents, archives, and other files.
- Preview the duplicate files and delete the ones you don't need.
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:
- Click the File menu in Finder and choose New Smart Folder.
- Click the + button in the upper right corner.
- From the first drop-down menu, select Kind. Then from the second drop-down menu, select the desired file type.
- 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.
Open Terminal via Spotlight.
Run the cd command to navigate to the folder you want to scan, for example
cd ~/Desktop
.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
+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.
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:
Open Terminal.
Run the cd command to go to the folder you want to scan, for example:
cd ~/Desktop
.Continue to run the following command:
find . -type f -exec md5 {} \; | awk -F '=' '{print $2 "\t" $1}' | sort | tee duplicate_files.txt
Wait for the script to finish running, and you will find the md5 hash and path of every file.
Go to Finder and manually locate the files and delete duplicate ones.
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?