Macbook Pro 打开文件时,会保存最近使用的路径列表 —— Recent Places

有时候需要整理 Recent Places,清空或者设置最大保存长度,非常方便的保存最近的常用目录,不必逐级选目录

设置最近路径列表 Recent Places 数量(NSNavRecentPlacesLimit),没必要进入 root 权限(sudo -s),当前用户即可

 

一、清空 Recent Places

清空命令:

defaults delete -g NSNavRecentPlaces (慎用,最好不用)

清空后,最近路径列表,将全部被清除了,包含最近默认5条路径,也被清除了,即彻底空白

 

二、修改 Recent Places 的最大保存数量

设置最近路径列表 Recent Places 数量(NSNavRecentPlacesLimit),没必要进入 root 权限(sudo -s),当前用户即可

1、查看保存数量

defaults read -g NSNavRecentPlacesLimit

查看示例:

$ defaults read -g NSNavRecentPlacesLimit 
30

 

2、设置保存数量(核心

defaults write -g NSNavRecentPlacesLimit -int NUM

说明:NUM 就是要设置的最大保存数量,

例如:defaults write -g NSNavRecentPlacesLimit -int 30 (保存最近30个路径列表,默认为5个)

例如,保存最近路径为30条:

$ defaults write -g NSNavRecentPlacesLimit -int 30
$ defaults read -g NSNavRecentPlacesLimit         
30

 

3、取消最大保存数量设置 

defaults delete -g NSNavRecentPlacesLimit

使用示例:

$ defaults write -g NSNavRecentPlacesLimit -int 30		### 设置
$ defaults read -g NSNavRecentPlacesLimit         		### 查看
30
$ 
$ defaults delete -g NSNavRecentPlacesLimit       		### 删除
$ defaults read -g NSNavRecentPlacesLimit     			### 已删除,再查看,报错(已不存在)
2019-01-28 17:24:09.033 defaults[18540:20626393] 
The domain/default pair of (kCFPreferencesAnyApplication, NSNavRecentPlacesLimit) does not exist
$ 
$ defaults delete -g NSNavRecentPlacesLimit				### 已删除,再删除,报错(已不存在)
2019-10-28 17:24:10.993 defaults[18542:20626404] 
Domain (kCFPreferencesAnyApplication) not found.
Defaults have not been changed.
$ 
$ defaults write -g NSNavRecentPlacesLimit -int 30		### 最后设置
$ defaults read -g NSNavRecentPlacesLimit       		### 查看 
30

 

 

How to Clear and Manage “Recent Places” In OS X

Whenever you save files to a specific location on your Mac, OS X will save this location in a “Recent Places” listing which will be available the next time you save another file. This feature allows quick access to the folders you commonly use and hence saves a lot of your precious work time.

By default, the recent places list will show you the past five most recently accessed folders. Now, while this may be convenient for some, it can become annoying, especially if you would just like to clear an item or the entire list. Unfortunately, the only way to do so via the OS X interface is to save items in at least five new locations, thus forcing the one you want to remove from the list.

 

This isn’t quite the best approach out there, and if you prefer to use another method, then you can use Terminal to remove the saved recent place entries from your OS X account. To do this:

1. Open Terminal on your OS X System.

 

2. Enter the following command to remove all the saved recent places:

defaults delete -g NSNavRecentPlaces

With this command, the Recent Places drop-down menu in the saved windows will be emptied and will then begin to populate with new folders as you save files to them.

Another tip for you is that you can also adjust the number of recent items that the system stores.

By default the number of items is five, but you can adjust this to a value of your liking with the following command:

defaults write -g NSNavRecentPlacesLimit -int NUM

Example:

defaults write -g NSNavRecentPlacesLimit -int 30

Here, simply replace NUM will the number of entries you want. Entering Zero will disable the recent places list.

 

Additionally, you can run the following command to remove the limit:

defaults delete -g NSNavRecentPlacesLimit

 

Did this work for you?

Be sure to tell us in the comments below!

 

 

参考推荐

iPhone6 快捷键大全

苹果手机 iPhone 定位导航系统有哪些

Apple Watch 上的两个按键功能

Mac 系统快捷键大全

Mac 电脑锁屏快捷方法

Mac 强制退出程序的六种方法

Mac OS X 系统命令查看系统版本号

Mac 上启用 root 用户或更改 root 密码

Mac parallels desktop 13破解下载及Windows安装方法

Macbook Pro 如何清空/修改最近路径列表 Recent Places 数量