Prevent macOS from creating a .ds_store file

If you work on macOS, you might have noticed whenever you add image files or some media file to your project, a hidden file .DS_Store is created automatically.

This is how macOS stores metadata for media files. But you don't want this in your project.

There are two ways you can prevent this.

Preventing macOS from creating the .DS_Store file

You can run the following command in your terminal to prevent the creation of the file.

01: $ defaults write DSDontWriteNetworkStores true

NB: Be sure to restart your computer after running the command.

Ignoring the file in your project

Another approach you can take to prevent this file from being committed to your project is by excluding it from your versioning system.

To exclude this file in Git add the file name to your .gitignore file and commit it.

Here is another article for you 😊 "How to exit the sqlite3 command line (REPL)"