The mysterious ._ files in MacOS and how to delete them

Harsh Patel
2 min readJan 6, 2022
Image with a title of: “The mysterious ._ files in MacOS and how to delete them”

As a Mac user, if you have set up your finder to show hidden files, you will find ._ files on external storage like hard drives and network shares. In this post, I will give you a quick introduction to why these files exist and how you can remove them.

What are ._ files on MacOS?

When the macOS or any program is using the files from external storage, the MacOS creates ._ files. These files contain metadata for the files on the disk. Deleting these files is not a good idea as it helps MacOS to read files from these external disks easily.

macOS creates these files while reading or storing them in external storage. macOS creates metadata for these files and stores them in ._ format. Now, when you connect your disk again to your Mac computer, the OS will use these files to show proper metadata.

How to remove these files?

As I mentioned, these files help MacOS to read files from the disk. Because of this behavior, you should avoid removing these files. Removing these files will affect the performance of the Finder for external storage.

Most of the time, you can avoid these files. Although, if you do want to remove them, you can use the following command on macOS or Linux. (Please note that the following steps expect basic terminal knowledge):

cd <to the folder where you want to remove these files>find . -iname '._*' -exec rm -rf {} \;

This command will find all the files that start with ._ and remove them. Please note that you can not undo this command. So make sure your important file names are not starting with ._.

Remove these files from SMB share:

You can follow the above steps to remove any existing ._ files from your SMB share. If you want to prevent MacOS from creating these files on an SMB share, you can add this line to the SMB config file:

veto files = /._*/.DS_Store/

If this post was useful to you, please give it a like and share it with your friends. It motivates me to keep writing blogs like these. You can also follow me on Twitter to get the latest updates of the projects I am currently working on: https://twitter.com/harsh_p_patel

References

--

--

Harsh Patel

A programmer who loves to go live on YouTube and build projects to learn new things!