macOS is the favorite choice for developers and coders, but it still lacks some basic and cool features like Turbo Boost, Light/Dark Mode toggle, and an easy way to hide files and folders. While you can easily hide files and folders in Windows, you will not find any simple toggle in macOS. But you can hide files and folders using Terminal on Mac. You can achieve this using simple terminal commands in macOS.
In this tutorial, we will be using
chflags command to hide or unhide files and folders on macOS. This command is available in all versions of macOS, so, you don’t have to upgrade your Mac to the latest version of macOS. Let’s start with the steps.
A) Hide Files and Folders using Terminal on macOS
Step 1: Open Terminal on Mac
First of all, launch Terminal on your Mac. You search for the terminal in Spotlight to open Terminal. We will be using simple terminal commands to hide files and folders on Mac.
Step 2: Hide Files or Folders using Terminal
Now, type the following command in the terminal and press Enter.
chflags hidden <full path of file/folder>
<full path of file/folder> with the actual path of the file or folder, you want to hide. You can also drag and drop the desired file/folder into the terminal after typing the
chflags hidden command.
After you press Enter, your file/folder will be hidden. You can go to the path of the selected file/folder to verify.
NOTE: In the worst case, you might need to re-launch the Finder to make the file disappear.
B) View and Unhide Hidden Files and Folders on macOS
Accessing or un-hiding the hidden file/folder on macOS can be done the same way using the terminal.
Step 1: Enable View Hidden Files in Finder
To view hidden files or folders on your Mac, open the Terminal app and enter the following command:
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
After you press enter, go to the path of the hidden file/folder. Here, you can see all of your hidden files and folders in Finder.
Step 2: Unhide Files or Folders on macOS
If you want to unhide the files or folders that you have hidden in the first section. Open the Terminal on your Mac and enter the following command. Make sure to press the Enter key after that.
chflags nohidden <full path of file/folder>
<full path of file/folder> with the actual path of the hidden file/folder.
Now, you will be able to see your hidden files or folders in Finder again.
Hide, View, and Unhide Files and Folders on Mac using Terminal
It’s pretty easy to hide or unhide files and folders in macOS using Terminal commands. But there is no graphical option or customization setting to make this easier. We hope Apple will include this feature in upcoming versions of macOS.
Hope you liked this tutorial. Feel free to share your thoughts and ideas in the comment section below. You may also like to subscribe to our newsletter to get the latest tutorials directly into your inbox.