禁止 macOS 自动生成 .DS_Store 文件的方法

当我们在 macOS 上使用 U 盘之后,到 Windows 上一看,U 盘中就会出现很多 .DS_Store 文件,我们可以通过两条命令来禁止 macOS 在网络文件夹和 U 盘中自动生成 .DS_Store 文件。

禁止 .DS_Store 生成

defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

如果要恢复.DS_Store 生成

defaults delete com.apple.desktopservices DSDontWriteNetworkStores
defaults delete com.apple.desktopservices DSDontWriteUSBStores

其他常用的命令

1. 轻点执行点按操作

defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults -currentHost write -g com.apple.mouse.tapBehavior -int 1

2. 在访达中显示文件路径

defaults write com.apple.finder "ShowPathbar" -bool "true" && killall Finder

3. 在访达中显示隐藏文件

defaults write com.apple.finder "AppleShowAllFiles" -bool "false" && killall Finder

4. 访达中文件排序时,文件夹位于顶部

defaults write com.apple.finder "_FXSortFoldersFirst" -bool "true" && killall Finder

5. 桌面文件夹排序时,文件夹位于顶部

defaults write com.apple.finder "_FXSortFoldersFirstOnDesktop" -bool "true" && killall Finder

扩展阅读:

.DS_Store 是 macOS 在文件夹下自动生成的一个文件,该文件记录保存该文件夹的一些属性,比如文件夹的排序方式、图标大小等。

更多关于 macOS 的日志。

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>