Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Show Hidden Files on Mac Terminal: Step-by-Step

· 5 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

macOS hides many files and folders by default to keep you from accidentally modifying system files or app support data. But sometimes you need to see them—like when editing a config file, troubleshooting an app, or cleaning up leftover files. This guide shows you how to reveal hidden files in the Finder and in Terminal itself, using simple commands. No extra software is needed; just a Terminal window.

What You'll Need

  • A Mac running macOS (any recent version, from Catalina to Sonoma and newer)
  • Access to the Terminal app (found in /Applications/Utilities/Terminal.app, or via Spotlight with Cmd+Space and typing “Terminal”)
  • Basic comfort with typing commands—you can copy and paste the ones below

Step-by-Step

  1. Open Terminal. Click the Launchpad icon in the Dock, type “Terminal” in the search field, or press Cmd+Space and type “Terminal”. Press Enter to open it.
  2. Show hidden files in the Finder. Type the following command and press Enter:
    defaults write com.apple.finder AppleShowAllFiles -bool true
    This tells the Finder to display all files, including those that start with a dot (like .gitignore or .DS_Store).
  3. Restart the Finder. The change won’t take effect until the Finder restarts. Type this and press Enter:
    killall Finder
    Your Finder windows will close and reopen. Hidden files and folders now appear with a translucent icon.
  4. Verify the change. Open a Finder window and navigate to your home folder or any folder. You should see files with a dot prefix, such as .bash_profile or .config. If you don’t, check the Troubleshooting section below.
  5. Hide them again when done. To revert, run:
    defaults write com.apple.finder AppleShowAllFiles -bool false
    Then restart the Finder again with killall Finder.
  6. View hidden files in Terminal itself. The default ls command hides dotfiles. To see them, use:
    ls -a
    Or for more detail (permissions, size, date):
    ls -la
    This works in any directory you’re currently in.
  7. Navigate to hidden directories quickly. In Terminal, you can change into a hidden folder by typing its name with the dot, e.g., cd .ssh (if it exists). Tab completion also works: type cd . and press Tab to see suggestions.
  8. Use Finder’s shortcut (optional). In any Finder window, press Cmd+Shift+. (period) to toggle hidden files on and off temporarily. This works in macOS Sierra and later, and it doesn’t require Terminal at all—but it’s a handy complement to the permanent method.

Common Mistakes

  • Forgetting to restart the Finder. The defaults write command only changes a setting; the Finder won’t pick it up until you run killall Finder or log out and back in.
  • Typing the command wrong. The syntax is defaults write com.apple.finder AppleShowAllFiles -bool true. A common error is using -bool TRUE (uppercase) or -boolean instead of -bool. macOS is case-sensitive for the value, so use lowercase true or false.
  • Deleting or moving hidden files by accident. When hidden files are visible, you might be tempted to delete files like .DS_Store or .localized. These are often needed by the system or apps. Only remove them if you know what they are.
  • Expecting the change to apply to Terminal’s ls. The Finder setting doesn’t affect Terminal. You must use ls -a to see dotfiles in the command line.

Tips

  • Use the keyboard shortcut first. If you only need to see hidden files temporarily, press Cmd+Shift+. in Finder. It’s faster and doesn’t change any system settings.
  • Create a Terminal alias. If you frequently need to see hidden files, add an alias to your shell profile (like .zshrc) to make ls -a the default. For example, add alias ls='ls -a' to ~/.zshrc and reload with source ~/.zshrc.
  • Use the full path. In Terminal, you can access hidden files even if they’re not visible in Finder. Just type the absolute path, e.g., open ~/.ssh/config.
  • Be careful with system files. Files in /System and /Library are hidden for a reason. Modifying them can break your Mac or cause security issues. Only reveal hidden files when you have a specific purpose.

Troubleshooting

  • Hidden files still not visible after running the command. First, ensure you ran killall Finder. If that didn’t work, check the exact command you typed—look for spaces and the hyphen before “bool”. You can also try logging out and back in, or restarting your Mac.
  • The Finder doesn’t restart. If killall Finder appears to hang, press Ctrl+C to cancel, then type open /System/Library/CoreServices/Finder.app to relaunch it manually.
  • Terminal says “command not found”. That means you mistyped defaults or killall. Check for typos and try again. These commands are built into macOS, so they should always exist.
  • Hidden files are visible but you can’t open them. Some hidden files are root-owned. Use sudo with caution, e.g., sudo nano /etc/hosts, but only if you know what you’re doing.
  • After hiding them again, some files remain visible. The Finder caches its view. Run killall Finder again, or press Cmd+Option+Esc to force-quit Finder and relaunch it.

Frequently Asked Questions

Does this work on all Macs?

Yes, the defaults write command works on every Mac running macOS, regardless of the model or chip (Intel or Apple Silicon).

Will showing hidden files slow down my Mac?

No. It only changes what the Finder displays. There’s no performance impact.

Can I see hidden files in the Open/Save dialog?

Yes, the same Cmd+Shift+. shortcut works in most Open/Save dialogs, and the Finder setting applies there too.

What if I accidentally delete a hidden file?

If it’s a system file, you might need to reinstall macOS or restore from Time Machine. If it’s an app support file, the app may recreate it on next launch. Always be cautious.

Is there a way to show hidden files only in a specific folder?

No, the Finder setting is global. However, you can use Terminal’s ls -a in any specific directory to see hidden files there without affecting the Finder.

Why do some files start with a dot?

In Unix-based systems (including macOS), a leading dot marks a file as hidden. It’s a convention from the early Unix days to keep configuration files out of the way.