花(Spend)足够的时间对Mac进行故障排除,您会发现有很多文件是您看不到的。Apple故意向用户隐藏特定文件(hides specific files),使他们无法访问、编辑或删除这些文件。这些文件通常是关键的 macOS 系统文件,因此它们被隐藏是有原因的。
如果您想在 macOS 中显示隐藏文件以查看Apple隐藏的内容,您可以使用Finder或终端应用程序(Terminal app)在 Finder 中显示它们。
使用 Finder 显示隐藏的应用程序
Finder 是在 macOS 中显示隐藏文件的最简单方法。您只需要打开文件夹并使用键盘快捷键来显示和隐藏隐藏文件。
1. 在工具栏中选择Finder,通常位于屏幕底部。
2.在菜单栏中选择前往。(Go)
3. 选择计算机(Computer)以访问硬盘驱动器上的根文件夹。
4. 按Command-Shift-Period键以显示隐藏文件,这些文件将在屏幕上显示为灰色。
4. 完成后,按Command-Shift-Period键重新隐藏文件。
使用终端显示隐藏文件
终端应用程序是在 macOS 上显示和隐藏隐藏文件的另一种方式。终端(Terminal)不像Finder应用程序那样用户友好。不过,如果您在终端(Terminal)应用程序中工作并熟悉其操作,这些命令仍然很有用。
1. 在工具栏中选择Launchpad,通常位于屏幕底部。
2.在 Launchpad 中选择名为Other的文件夹。(Other)
3. 选择终端(Terminal )应用程序将其打开。
4. 在终端中输入以下字符串:
defaults write com.apple.finder AppleShowAllFiles true; 杀死所有查找器(defaults write com.apple.finder AppleShowAllFiles true; killall Finder)。
5. 按回车(Return)键执行脚本。
该命令的前半部分将ShowAllFiles参数更改为 true,这将显示所有文件,包括以前隐藏的文件。后半部分是一个killall命令,用于重新启动Finder并显示隐藏文件。
使用终端隐藏所有文件
处理完隐藏文件后,最好重新隐藏文件,以免意外修改或删除它们。按照上面相同的前四个步骤打开Terminal或只需按Command + Spacebar打开Spotlight并输入Terminal。
1. 在工具栏中选择Launchpad,通常位于屏幕底部。
2.在 Launchpad 中选择名为Other的文件夹。(Other)
3. 选择终端(Terminal)应用程序将其打开。
4. 在终端中输入以下字符串:
defaults write com.apple.finder AppleShowAllFiles false;杀死所有查找器(defaults write com.apple.finder AppleShowAllFiles false; killall Finder)。
5. 按回车(Return)键执行命令。
此命令将ShowAllFiles参数设置为 false,这将隐藏隐藏文件。再一次,第二行是一个“killall”命令,它重新启动Finder并从视图中删除隐藏文件。
为什么你应该隐藏文件
使用隐藏文件时要小心,因为它们通常是隐藏的。这些文件中的大多数是macOS 或您已安装的应用程序使用的关键系统文件。(critical system files)如果这些隐藏文件被修改或删除,您的操作系统和应用程序可能无法按预期运行。您甚至可能必须重新安装 macOS 才能使一切恢复正常。
How to Show Hidden Files in MacOS
Spend enough time troubleѕhooting your Mac, and you’ll discoνer there are a lot of files that you can’t ѕee. Apple deliberatelу hides specific files from users so they can’t access, edit, or delete these files. These files are usually critical macOS system files, so they’re hidden for a reason.
If you want to show hidden files in macOS to see what Apple has kept out of sight, you can use either the Finder or Terminal app to reveal them in the Finder.
Use Finder to Show Hidden Apps
Finder is the easiest way to show hidden files in macOS. You just need to open the folder and use a keyboard shortcut to reveal and hide the hidden files.
1. Select Finder in the toolbar, which is usually at the bottom of the screen.
2. Select Go in the menu bar.
3. Select Computer to access the root folder on the hard drive.
4. Press Command-Shift-Period keys to reveal the hidden files, which will be greyed out on the screen.
4. When you’re done, press Command-Shift-Period keys to re-hide the files.
Use Terminal to Show Hidden Files
The terminal app is another way to show and hide hidden files on macOS. Terminal is not as user-friendly as the Finder app. Still, these commands are useful if you work in the Terminal app and are familiar with its operation.
1. Select Launchpad in the toolbar, which is usually at the bottom of the screen.
2. Select the folder named Other in Launchpad.
3. Select the Terminal app to open it.
4. Enter the following string into the terminal:
defaults write com.apple.finder AppleShowAllFiles true; killall Finder.
5. Press Return to execute the script.
This first half of the command changes the ShowAllFiles parameter to true which will show all files, including those that were previously hidden. The second half is a killall command that restarts the Finder and displays the hidden files.
Use Terminal to Hide All Files
When you’re done working with the hidden files, it’s a good idea to re-hide the files, so you don’t accidentally modify or delete them. Follow the same first four steps above to open Terminal or simply press Command + Spacebar to open Spotlight and type in Terminal.
1. Select Launchpad in the toolbar, which is usually at the bottom of the screen.
2. Select the folder named Other in Launchpad.
3. Select the Terminal app to open it.
4. Enter the following string into the terminal:
defaults write com.apple.finder AppleShowAllFiles false; killall Finder.
5. Press Return to execute the command.
This command sets the ShowAllFiles parameter to false, which will hide the hidden files. Once again, the second line is a “killall” command that restarts the Finder and removes the hidden files from view.
Why You Should Keep Files Hidden
Be careful when working with hidden files as they typically are hidden for a reason. Most of these files are critical system files that are used by macOS or the apps you have installed. If these hidden files are modified or deleted, your operating system and apps may not work as expected. You may even have to reinstall macOS to get everything functional again.