macOS 卸载 pkg 包安装的 APP
普通APP在MacOS上要用pkg包安装的都是耍流氓,个人觉得= = 安装pkg的APP之后要怎么卸载呢,可以用到
pkgutil
这一命令
pkgutil
执行命令pkgutil --help
:
Usage: pkgutil [OPTIONS] [COMMANDS] ...
Options:
--help Show this usage guide
--verbose, -v Show contextual information and format for easy reading
--force, -f Perform all operations without asking for confirmation
--volume PATH Perform all operations on the specified volume
--edit-pkg PKGID Adjust properties of package PKGID using --learn PATH
--only-files List only files (not directories) in --files listing
--only-dirs List only directories (not files) in --files listing
--regexp Try all PKGID arguments as regular expressions
Receipt Database Commands:
--pkgs, --packages List all currently installed package IDs on --volume
--pkgs-plist List all package IDs on --volume in plist format
--pkgs=REGEXP List package IDs on --volume that match REGEXP
--groups List all GROUPIDs on --volume
--groups-plist List all GROUPIDs on --volume in plist format
--group-pkgs GROUPID List all PKGIDs in GROUPID
--files PKGID List files installed by the specified package
--lsbom PKGID List files in the same format as 'lsbom -s'
--pkg-groups PKGID List all GROUPIDs that PKGID is a member of
--export-plist PKGID Print all info about PKGID in plist format
--verify PKGID Verify file permissions of the specified package
--repair PKGID Repair file permissions of the specified package
--pkg-info PKGID Show metadata about PKGID
--pkg-info-plist PKGID Show metadata about PKGID in plist format
--file-info PATH Show metadata known about PATH
--file-info-plist PATH Show metadata known about PATH in plist format
--forget PKGID Discard receipt data for the specified package
--learn PATH Update --edit-pkg PKGID with actual metadata from PATH
File Commands:
--expand PKG DIR Expand the flat package PKG to DIR
--flatten DIR PKG Flatten the files at DIR as PKG
--bom PATH Extract any Bom files from the pkg at PATH into /tmp
--payload-files PATH List the paths archived within the (m)pkg at PATH
挺多功能的,自己看吧.
找出要删除的包
以TeamViewer
为例,执行命令pkgutil --pkgs | grep -i teamviewer
:
com.teamviewer.teamviewer10
com.teamviewer.teamviewer10Agent
com.teamviewer.teamviewer10Font
com.teamviewer.teamviewer10Restarter
找出到底安装了什么文件
执行命令pkgutil --files com.teamviewer.teamviewer***
:
TeamViewer.app/Contents/Resources/widget_whiteboard_fontsize_40.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/widget_whiteboard_fontsize_60.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/widget_whiteboard_marker.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/widget_whiteboard_no_fill.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/widget_whiteboard_pencil.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/widget_whiteboard_rectangle.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/widget_whiteboard_text.png
TeamViewer.app/Contents/Resources/[email protected]
TeamViewer.app/Contents/Resources/zh-Hans.lproj
TeamViewer.app/Contents/Resources/zh-Hans.lproj/Localizable.strings
TeamViewer.app/Contents/Resources/zh-Hans.lproj/ServicesMenu.strings
TeamViewer.app/Contents/Resources/zh-Hant-TW.lproj
TeamViewer.app/Contents/Resources/zh-Hant-TW.lproj/Localizable.strings
TeamViewer.app/Contents/Resources/zh-Hant-TW.lproj/ServicesMenu.strings
TeamViewer.app/Contents/Resources/zh-Hant.lproj
TeamViewer.app/Contents/Resources/zh-Hant.lproj/Localizable.strings
TeamViewer.app/Contents/Resources/zh-Hant.lproj/ServicesMenu.strings
TeamViewer.app/Contents/_CodeSignature
TeamViewer.app/Contents/_CodeSignature/CodeResources
一大陀…
开始删除
- 把以上文件删除干净
- 执行命令
sudo pkgutil –forget teamviewer.pkg
来让系统忘记这个pkg包 - 完成卸载
Tips
听说有个小脚本挺好用的(本人未测试)
Github: pkg_uninstaller