用 lsregister 重建 Launch Services 数据库
修复默认打开方式错误和"打开方式"重复条目,重置 macOS 的应用注册库。
运行 lsregister 并加 `-kill -r -domain local -domain system -domain user` 重建 Launch Services 数据库。
01命令
命令
$ /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user02作用说明
Launch Services 负责把文件类型映射到应用;当应用被移动或删除而废纸篓未清空时,残留条目会导致默认应用错误和"打开方式"里出现幽灵条目。lsregister -kill 清空数据库,-r 则重新扫描指定域(user、local、system),根据实际存在的应用包重建。完成后重启 Dock 或注销一次,让打开的应用刷新缓存。
03风险
!注意: 所有用户级的默认打开方式都会被重置,需要重新设置。
04撤销
✓无需撤销——该命令不会改变持久状态。
05来源
- LSRegister Command: Reset the Launch Services database in macOS依据: Documents lsregister -kill -r -domain options for rebuilding the Launch Services registration database.
- Bundle Types依据: Apple documents app bundles and the document-type declarations Launch Services indexes.
最后验证: 2026-09-17 · 分类: 系统与设置