Why Are There Hidden Files in my macOS Home Directory?


The home directory is a familiar place for macOS users. But there are some secrets lurking just below the surface. If you run ls -a on your home directory, you’ll discover a pile of hidden files and directories with dot prefixes. What do these hidden files do anyway?

A common .bash_profile file

Most commonly, hidden files and directories in the home directory contain settings or data that’s accessed by that user’s programs. They’re not intended to be edited by the user, only the application. That’s why they’re hidden from the user’s normal view.

In general files from your own home directory can be removed and changed without damaging the operating system. The applications that rely on those hidden files, however, might not be as flexible. When you remove a hidden file from the home directory, you’ll typically lose the settings for the application associated with it.

The program that relied on that hidden file will typically recreate it. However, you’ll be starting from the “out-of-the-box” settings, like a brand new user. If you’re having trouble with an application, that can actually be a huge help. It lets you remove customizations that might be causing trouble. But if you’re not, it just means you’ll need to set everything back the way you like it.

The typical home directory contains many hidden files

Everyone will have different hidden files in their home directory. There are some that everyone has. The files, often called “dot files,” serve a similar purpose, regardless of the parent application.

Shell Settings

System settings include the configuration for your desktop environment and your shell.

  • Configuration files for your shell and command line utilities: Depending on the specific shell and command-like utilities you use, the specific file name will change. These files contain any settings you’ve changed about your shell’s operating environment or tweaks you’ve made to the settings of command-line utilities like vim. Removing these files will return the associated application to its default state. Considering many power users build up an array of subtle tweaks and settings over the years, removing this file could be a huge headache.
  • User profiles: Like the configuration files above, these files (typically “.profile” or “.bash_profile”)  save user settings for the shell. This file contains your PATH. It also contains aliases you’ve set. Users can also put aliases in custom file locations. The PATH governs where the shell looks for executable commands. By modifying your PATH, you can change where your shell looks for commands. Aliases change the names of commands. One alias might set ll to call ls -l, for example. This provides text-based shortcuts to often-used commands. If you delete .profile, you can find the default version in the “/etc/skel” directory.
  • Package manager and user shell settings: If you’ve installed a package manager like Node Package Manager (npm), or a custom shell like ZSH, you’ll find their settings in a directory here.
  • SSH data: macOS stores your secure shell (SSH) keys in a hidden file in your home directory. This includes your key pair, as well as your “known_hosts” file.

Application configuration files

You’ll find these in the “.config” folder in Ubuntu. These are settings for your specific applications. They’ll include things like the preference lists and settings.

  • Configuration files for applications: This includes settings from the application preferences menu, workspace configurations and more. Exactly what you’ll find here depends on the parent application.
  • Web browser data: This may include things like bookmarks and browsing history. The majority of files make up the cache. This is where the web browser stores temporarily download files, like images. Removing this might slow down some media-heavy websites the first time you visit them.
  • Caches: If a user application caches data that’s only relevant to that user (like Spotify’s playlist cache), the home directory is a natural place to store it. These caches might contain gigabytes of data or just a few lines of code: it depends on what the parent application needs. If you remove these files, the application recreates them as necessary. Clearing out these caches can be a good way to free up disk space. Such cleaning is often a feature of Mac cleaning applications.
  • Saved states: Data like the application’s window configuration, last commands or recent searches can be saved in text files within hidden directories.
  • Logs: Some user applications might store logs here as well. Depending on how developers set up the application, you might find log files stored in your home directory. This isn’t a common choice, however. There are specific locations in macOS for log files, and its better that developers store them there.

In most cases, the hidden files in your macOS home directory are used to store user settings. This includes settings for command-line utilities as well as GUI-based applications. Removing them will remove user settings. Typically, it won’t cause a program to break.

You might also like some of the following posts:

Getting Started with Terminal: Must-Know macOS Terminal Commands

Use macOS Sierra’s Purgeable Space to Optimize Storage

Tweak and Customize macOS with Onyx


Alexander Fox

One Comment

Your email address will not be published.

  1. I use Forklift as a Finder replacement and with Forklift I can blend in our blend out the hidden files with just one click, it proved to be life-saving in some cases when I had to look for my Word and Excel TEMP files on my Mac:)