If you have files on a shared Mac that you don’t want other people to see, then it is probably a good idea to hide them. The first idea that might come to your mind would be to hide the files deep inside multiple nested folder. While this is a clever approach, it is not foolproof, as anyone can easily find by looking for the supposedly ‘hidden files’ or stumble upon them accidentally. Unlike Windows, macOS does not offer an easy way to hide certain files. Thankfully we have found a relatively easy way of hiding and then showing those hidden files using Terminal. Follow the steps below to hide files on Mac using Terminal command.
Hiding files or folder on a Mac
- On your Mac Open Terminal. You can either search for it in Spotlight or access it through Launchpad > Others > Terminal.
- Once in Terminal type chflags hidden and hit the space key from the keyboard.
- Now open a Finder window, find the file or folder your want to hide, then drag and drop it on Terminal. Once you do, the file/folder’s path will appear in Terminal that should look something like this ‘/Users/Username/Desktop/Folder\Name’. Drag and Drop method saves you the trouble of manually finding the path and typing it. Press the Return/Enter key.
- Important: Don’t forget to copy the path of the hidden file or folder as you will need it when unhiding the file.
- At this point your selected file or folder will be hidden. This folder and any files stored in it will not appear in Finder.
Unhide the file or folder on Mac
- If you want to unhide the file or folder you can enter the reverse command in Terminal in a similar way you used the Hidden command.
- Simply type chflags nohidden followed by the file or folder path you copied earlier. Then press enter.
- Now that particular file or folder should appear with all the contents stored in it. Once you are done you can re-hide using the Hidden command.
Warning: If you want to hide super sensitive files, then this method is probably not for you. Files or Folders hidden through Terminal can easily be revealed using a simple Terminal command and even appear in Spotlight search.
Forgot the file path? Here’s How To Show All Hidden Files On Mac With A Terminal Command