macOS 卸载 JDK

  1. 列出已安装的JDK版本
$ pkgutil --pkgs|grep -i oracle
  1. 显示要卸载的JDK信息
$ pkgutil --info *package-id*

e.g

package-id: com.oracle.jdk8u172
version: 1.1
volume: /
location: Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk
install-time: 1527436938
  1. 移除JDK
$ sudo rm -R /Library/Java/JavaVirtualMachines/*package-id*
  1. 移除JDK入口
$ sudo pkgutil --forget *package-id*

推荐阅读更多精彩内容