macOS Big Sur隐藏Dock中的Finder和 Trash

121

用Path Finder替换了Finder,Dock中的Finder太过多余,便想将其隐藏。

在BigSur之前,这个操作是比较简单的,只需要关闭SIP后挂载根目录为可读写,然后修改DockMenus.plist即可。但是在BigSur中文件系统有了很大的变化,使得挂载的过程变得复杂。

1 关闭SIP和只读文件系统authenticated-root

见此:如何正确关闭macOS 11和12的SIP以及只读文件系统authenticated-root

2 挂载Volume

最麻烦的地方来了,这是在BigSur之前都没有的操作(参考 writing-to-the-macos-system-partition):

2.1 确认 live volume 名称 diskNsM

在终端执行mount,在返回结果里找到挂载点/的设备名。

mount

在上图中挂载点/的设备名为/dev/disk3s5s1,我们并不直接用这个名字,要舍去后两位,只取disk3s5

diskNsM 即为 disk3s5,为了表达方便后面都用diskNsM,因为这个值因人而异。

2.2 挂载 diskNsM

创建一个挂载目录/path/to/mntpoint,可创建在任意有写入权限的位置,例如:/Users/用户名/mnt3s5

在终端执行:sudo mount -o nobrowse -t apfs /dev/diskNsM /path/to/mntpoint

(注意替换diskNsM/path/to/mntpoint,下同)

2.3 备份DockMenus.plist

cp /path/to/mntpoint/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist /path/to/mntpoint/System/Library/CoreServices/Dock.app/Contents/Resources/DockMenus.plist.bak

2.4 修改DockMenus.plist

搜索finder-runningtrash,分别在他们的末尾,</array>之前添加下列内容:

<dict>
	<key>command</key>
	<integer>1004</integer>
	<key>name</key>
	<string>REMOVE_FROM_DOCK</string>
</dict>

2.5 创建snapshot,并且下次从之启动

在终端执行sudo bless --folder /path/to/mntpoint/System/Library/CoreServices --bootefi --create-snapshot

3 重启完成

在Finder和Trash上单击右键即可看到移除选项。