一键显示Mac下隐藏文件

Mac系统下默认是不显示隐藏文件,一般要借助Onyx或者在终端使用命令来显示。其实可以通过Apple Script来简化这个操作。

相关截图


使用方法

打开“应用程序”──“使用工具”──“AppleScript编辑器”,输入下面的代码,存储为应用程序即可。

try
	do shell script "defaults read com.apple.finder AppleShowAllFiles"
on error
	get 0
end try

set i to (result + 1) mod 2 -- Get opposite of current value 

tell application "Finder"
	activate
	get item (i + 1) of {"Hide", "Show"}
	display dialog (result & " all hidden files in Finder?") buttons {"Cancel", (result & " Hidden Files")} default button 2 with icon note
	quit
end tell

delay 0.5

try
	do shell script "defaults write com.apple.Finder AppleShowAllFiles " & i
	launch application "Finder"
on error errorMsg number errorNum
	display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
end try

运行后会重启Finder并显示隐藏文件,再次运行则恢复隐藏。为了方便使用,我们还可以把它拖到Finder的工具栏上,就像图中那样。

p.s.现在用的默认主题真是悲剧啊,看来要抓紧做主题了。

此条目发表在 macOS 分类目录。将固定链接加入收藏夹。

一键显示Mac下隐藏文件》有 10 条评论

  1. 非设计 说:

    这个好用,谢谢

  2. SKF轴承 说:

    还没有接触MAC的系统,明年计划买个MAC电脑。

  3. discounted uggs 说:

    嗯,方便,那我就不客气了,偷走了

  4. Mucid 说:

    Ctrl+H么……

  5. seven 说:

    您好。保存是出现语法错误显示 需要“,”却找到“数字”。 我用的是10。7 的。
    应该怎么做呢? 249281633@qq.com

  6. 卡米尔 说:

    哈哈 你锝看看上面锝截图哦

  7. appleFans 说:

    不用这么麻烦哦,这个叫"Folder Explorer"的软件很好用
    https://itunes.apple.com/cn/app/folder-explorer/id560812776?mt=12

  8. Gezi Rehberi 说:

    Thanks for this, always I need it but cannot remember it. Need search always.

  9. AirChrysalis 说:

    Expected “,” but found number.