macOS is favorite choice for developers and coders, but it still lacks some basic and cool features like Turbo Boost, Light/Dark Mode toggles and 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 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 terminal in Spotlight to open Terminal. We will be using simple terminal command to hide files and folders on Mac.
Step 2: Hide Files or Folders using Terminal
Now, type following command in the terminal and press Enter.
chflags hidden <full path of file/folder>
<full path of file/folder> with actual path of file or folder you want to hide. You can also drag and drop desired file/folder into terminal after typing
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 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 following command:
defaults write com.apple.finder AppleShowAllFiles -boolean true ; killall Finder
After you press enter, go to the path of 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 first section. Open the Terminal on your Mac and enter following command. Make sure to press the Enter key after that.
chflags nohidden <full path of file/folder>
<full path of file/folder> with actual path of 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 down below. You may also like to subscribe to our newsletter to get latest tutorials directly into your inbox.