并非Apple Mac(Apple Mac)上的每个文件和文件夹都必须清晰可见。如果您的目标是保护敏感信息或保持整洁的工作空间,那么很自然地希望保持某些物品的隐蔽性。
问题?隐藏(Hiding)和取消隐藏文件和文件夹并不属于 macOS 中的直观部分,除非您花时间熟悉该过程。

本教程提供了有关隐藏和揭露物品的全面指南,无论您使用的是MacBook、i Mac还是Mac mini。
(Hide Mac Files)使用终端(Terminal)隐藏 Mac 文件和文件夹(Folders)
如果您从 Windows 过渡到 macOS(transitioning from Windows),您可能会惊讶地发现 macOS 不提供用于隐藏文件和文件夹的 GUI(图形用户界面)选项(GUI (graphical user interface) option to hide files and folders)。相反,执行此任务的首选工具是Mac 的终端(Mac’s Terminal)(相当于 macOS 上的 CMD)。
别担心——它并不复杂,您很快就会掌握它的窍门。如果没有,您将在下面找到其他技术。
要使用终端(Terminal)隐藏文件或文件夹:
- 打开启动板(Launchpad)并选择其他 >终端(Terminal)。

- 输入 chflags hide 并按Space。

- 将(Drag)文件或文件夹拖到终端(Terminal)窗口中 - 此操作将插入文件/文件夹路径。

注意:或者,您可以手动复制并粘贴路径。只需按住 Control 键并单击(Control-click)Finder或桌面中的项目,按住Option,然后选择“复制 [文件或文件夹名称] 作为路径名”(Pathname)。接下来(Next),选择终端(Terminal)窗口并按Command + V V。
- 按回车键(Press Return)执行命令。如果该项目没有从视图中消失,只需重新启动 Finder(restart Finder) — 打开Apple菜单,按住Shift键,然后选择“强制退出 Finder”(Force Quit Finder)。
要显示 Mac 上的隐藏项目(reveal hidden items on your Mac),请执行以下命令:
默认写入 com.apple.finder AppleShowAllFiles -boolean true; 杀戮查找器(Finder)
上面的Terminal(Terminal)命令实际应用起来并不方便。相反,有一种仅使用键盘快捷键的简单方法 - 我们接下来会介绍它。
使用键盘快捷键(Keyboard Shortcut)显示隐藏(Show Hidden)文件
与隐藏文件不同,在 macOS 中显示隐藏项目要容易得多。您无需使用命令行,只需打开Finder或选择桌面上的空白区域,然后按Command + Shift + Period。

隐藏(Hidden)项目比常规文件和文件夹显得半透明,帮助您轻松区分它们。但是,您可以像平常一样访问、重命名和删除它们。要完全隐藏所有隐藏项目,只需再次使用相同的快捷方式即可。

注意:macOS 默认情况下还会隐藏大量系统文件,因此最好避免与不熟悉的项目交互。
如果您想永久取消隐藏Mac上的隐藏文件或文件夹,则必须再次使用终端(Terminal)。只是:
- 使用Command + Shift + Period键盘快捷键可显示所有隐藏的项目。
- 打开Terminal,输入 chflags nohidden,然后按Space。
- (Drag)将要取消隐藏的文件或文件夹拖放到终端窗口(Terminal)中,然后按Enter。

文件File/Folder Name以点开头(Dot)
您是否知道命名约定在(Did)Mac上的文件和文件夹可见性中发挥着重要作用?只需(Just)在文件或文件夹名称的开头添加一个句点,macOS 就会自动隐藏它。
以下是您必须遵循的分步过程:
- 使用Command + Shift + Period快捷键取消隐藏所有隐藏项目。
- 选择要隐藏的文件或文件夹,然后按Return。或者,按住 Control 键单击(Control-click)并选择“重命名”(Rename)。

- (Insert)在名称开头插入句点(点),例如.sample_file.txt。

- 按 Return 键(Press Return)并在弹出的确认窗口中选择“确定”。这会自动隐藏 macOS 中的文件/文件夹。

- Press Command + Shift + Period可隐藏所有隐藏文件。
如果您想稍后永久取消隐藏该项目,请使用上面部分中的
终端说明。(Terminal)
将项目移动到(Move Items Into)隐藏库文件夹(Hidden Library Folder)中
您的Mac用户帐户有一个名为Library的文件夹,用于存储应用程序缓存和(applications caches and other data)与常规 macOS 活动相关的其他数据。默认情况下它是隐藏的,因此非常适合放置您想要快速隐藏的多个项目。
要将项目移动到隐藏的库文件(Library)夹中:
- 打开Finder,然后选择菜单栏上的
Go > Go

- Type ~/Library/并按Return 键(Return)访问Library文件夹。

- (Move)将您想要隐藏的项目移动到“库”(Library)文件夹中。

稍后您可以随时将已移动到“库”(Library)文件夹中的任何项目拖出。如果您想要移动多个项目,请考虑在“库”(Library)文件夹中创建一个子文件夹(按住 Control 键单击(Control-click)空白区域并选择“新建文件夹(New Folder)”)以改进组织。
提示:访问用户帐户“库”(Library)文件夹的另一种方法是打开Finder,转至Macintosh HD > Users > [您的用户名],然后按Command + Shift + Period。
使用 Onyx(Use Onyx)在Mac上隐藏文件(Hide Files)和文件夹(Folders)
Onyx是一款自(Onyx)Mac OS X时代就已存在的系统维护实用程序。它是免费的、轻量级的,并且在撰写本文时
与最新的操作系统macOS Ventura完全兼容。(macOS Ventura)
除了 Onyx 能够优化您的Mac之外,该工具还提供基于 GUI 的方法来隐藏和取消隐藏文件和文件夹,包括应用程序和整个硬盘驱动器/SSD 卷。只是:
- 从开发者的官方网站——Titanium Software下载并安装Onyx。

- 启动Onyx并提供在(Onyx)Mac上运行的管理权限。

- 切换到“文件”(Files)选项卡,然后选择“隐藏文件夹”(Hide Folder)或“隐藏文件”(Hide File)按钮。

- 选择继续(Select Continue)以确认您要退出并重新打开Finder。

- 浏览(Navigate)Finder弹出窗口,突出显示要隐藏的文件或文件夹,然后选择“(Finder)选择”(Choose)。

隐藏的(Hidden)文件夹和文件可以通过您之前学到的Command + Shift + Period快捷键立即显示。要永久取消隐藏项目,请重新访问Onyx中的“文件”(Files)选项卡,选择“显示文件夹”(Show Folder)或“显示文件”(Show File)按钮,然后选择文件或文件夹。
此外,使用“音量”和“应用程序”(Application)部分下的控件可以隐藏和取消隐藏 macOS 中的磁盘和程序。有关更多信息,请查看我们针对 Mac 的完整 Onyx 演练(complete Onyx walkthrough for the Mac)。
你有选择
正如您刚刚了解到的,您有多种方法可以在 macOS 中隐藏文件和文件夹。您可以使用终端(Terminal),在文件名开头添加句点,或将项目放入“库”(Library)文件夹中。如果您喜欢更直接的方法,请使用Onyx。
在结束之前,值得一提的是,仅在Mac计算机上隐藏文件和文件夹并不是保护重要数据的最佳方法 - 任何精通技术的Mac用户都可以轻松取消隐藏并查看它们。解决方案是使用FileVault等安全功能来最大程度地减少其他人访问您的 Mac 的机会(minimize the chances of other people accessing your Mac)。
How to Hide (And Unhide) Files and Folders on Your Mac
Not every file and fоlder on your Applе Mac must be in plain sight. If you’re aiming to protect sensitive information or maintain a clυtter-free workspace, it’s natural to want to keep certain items discreet.
The problem? Hiding and unhiding files and folders doesn’t fall into the intuitiveness department in macOS unless you take the time to familiarize yourself with the process.

This tutorial provides a comprehensive guide on concealing and uncovering items, whether you’re using a MacBook, iMac, or Mac mini.
Hide Mac Files and Folders With Terminal
If you’re transitioning from Windows, you might find it surprising that macOS doesn’t offer a GUI (graphical user interface) option to hide files and folders. Instead, the go-to tool for this task is the Mac’s Terminal (the CMD equivalent on macOS).
Don’t worry—it’s not complicated, and you’ll get the hang of it quickly. If not, you’ll find other techniques further below.
To hide a file or folder using Terminal:
- Open the Launchpad and select Other > Terminal.

- Type chflags hidden and press Space.

- Drag the file or folder into the Terminal window—this action inserts the file/folder path.

Note: Alternatively, you can copy and paste the path manually. Just Control-click the item in Finder or the desktop, hold down Option, and select Copy [File or Folder Name] as Pathname. Next, choose the Terminal window and press Command + V.
- Press Return to execute the command. If the item does not disappear from view, just restart Finder—open the Apple menu, hold down Shift, and choose Force Quit Finder.
To reveal hidden items on your Mac, execute the following command:
defaults write com.apple.finder AppleShowAllFiles -boolean true; killall Finder
The Terminal command above is not convenient to put into practice. Instead, there’s a straightforward method that only uses a keyboard shortcut—we’ll get to that next.
Use the Keyboard Shortcut to Show Hidden Files
Unlike hiding files, revealing hidden items in macOS is a lot easier. Instead of using the command line, all you’ve got to do is open Finder or select a vacant area on the desktop and press Command + Shift + Period.

Hidden items appear translucent than regular files and folders, helping you distinguish them easily. However, you can go about accessing, renaming, and deleting them as you’d normally do. To completely hide all hidden items, just use the same shortcut again.

Note: macOS also hides loads of system files by default, so it’s a good idea to avoid interacting with unfamiliar items.
If you want to unhide a hidden file or folder on your Mac permanently, you must use the Terminal again. Just:
- Use the Command + Shift + Period keyboard shortcut to reveal all hidden items.
- Open Terminal, type chflags nohidden, and press Space.
- Drag and drop the file or folder you want to unhide into the Terminal window and press Enter.

Begin the File/Folder Name With a Dot
Did you know naming conventions play a role in file and folder visibility on the Mac? Just add a period to the beginning of a file or folder name, and macOS will automatically hide it.
Here’s the step-by-step process you must follow:
- Unhide all hidden items with the Command + Shift + Period shortcut.
- Select the file or folder you want to hide and press Return. Or, Control-click and select Rename.

- Insert a period (dot) to the beginning of the name—e.g., .sample_file.txt.

- Press Return and select OK on the confirmation pop-up. This automatically hides the file/folder in macOS.

- Press Command + Shift + Period to hide all hidden files from view.
If you want to permanently unhide the item later, use the Terminal instructions from the section above.
Move Items Into the Hidden Library Folder
Your Mac user account has a folder called Library that stores the applications caches and other data related to general macOS activity. It’s hidden by default, making it a great place to chuck multiple items you want to keep hidden quickly.
To move items into the hidden Library folder:
- Open Finder and select Go > Go to Folder on the menu bar.

- Type ~/Library/ and press Return to access the Library folder.

- Move items you wish to hide into the Library folder.

You can always drag out any items you’ve moved into the Library folder whenever you want later. If there are multiple items you’d like to move, consider creating a sub-folder within the Library folder (Control-click a vacant area and select New Folder) to improve organization.
Tip: An alternative method to access your user account Library folder is to open Finder, go to Macintosh HD > Users > [Your Username], and press Command + Shift + Period.
Use Onyx to Hide Files and Folders on Mac
Onyx is a system maintenance utility that’s been around since the days of Mac OS X. It’s free, lightweight, and fully compatible with the latest operating system—macOS Ventura—at the time of writing.
Aside from Onyx’s ability to optimize your Mac, the tool provides a GUI-based approach to hiding and unhiding files and folders, including applications and entire hard drive/SSD volumes. Just:
- Download and install Onyx from the developer’s official website—Titanium Software.

- Launch Onyx and provide administrative privileges to function on your Mac.

- Switch to the Files tab and select the Hide Folder or Hide File button.

- Select Continue to confirm you want to quit and re-open Finder.

- Navigate the Finder pop-up, highlight the file or folder you want to hide, and select Choose.

Hidden folders and files can be instantly revealed via the Command + Shift + Period shortcut you learned earlier. To permanently unhide an item, revisit the Files tab in Onyx, select the Show Folder or Show File button, and pick the file or folder.
Additionally, use the controls under the Volume and Application sections to hide and unhide disks and programs in macOS. For more information, check our complete Onyx walkthrough for the Mac.
You’ve Got Options
As you just learned, you’ve got multiple ways to hide files and folders in macOS. You can use the Terminal, add a period to the beginning of file names, or chuck items inside the Library folder. If you prefer a more straightforward approach, use Onyx.
Before we wrap up, it’s worth mentioning that hiding files and folders on a Mac computer alone is not the best way to safeguard important data—any tech-savvy Mac user can easily unhide and view them. The solution is to use security features like FileVault to minimize the chances of other people accessing your Mac.