Skip to content

Hide and unhide files or directories visibility with chflags on macOS

Published:

1 min read

The chflags command in macOS is a command for quickly hiding or unhiding files and directories. It is particularly useful for managing the visibility of files by altering their flags.

Unhiding files or Directories

You might need to access files located in the Library directory. On a new Mac setup, this directory is hidden by default, making it less accessible for everyday users.

To make a hidden file or directory visible, use the nohidden flag with the chflags command. For example, to unhide the Library directory:

chflags nohidden ~/Library

This command removes the hidden attribute and makes the Library directory visible in the Finder.

Hiding files or directories

If you want to hide a file or directory, use the hidden flag. This is useful for decluttering your view or protecting sensitive files from accidental access. For example, to hide the Library directory again:

chflags hidden ~/Library

By using the hidden flag, the Library directory will no longer be visible in the Finder.

Conclusion

The chflags command is powerful for managing file visibility on macOS.


Previous Post
View most used commands with zsh_stats
Next Post
Change comment color visibility in a VS Code theme

I'm a software developer and technical writer. On this blog, I share my learnings about both fields. Recently, I have begun exploring other topics, so don't be surprised if you find something new here.

Currently, working as a documentation lead at Expo.