How to uninstall Java on a Mac
We can uninstall Java from a Mac using only 3 Terminal commands, and we need to be logged in with an administrator account to run the commands. Here are the commands from Oracle. We checked the commands on 25 November 2026. Below that is where a JDK is, and the folder Oracle says not to touch.
Updated
Remove Java, the way Oracle says
If you are trying to run commands you need to have admin rights because the commands will run with sudo. java.com
1. Open Terminal
You can open the Terminal by opening Finder, navigating to the Utilities folder, and double-clicking Terminal.
2. Paste Oracle's commands
Run each one. The terminal will ask you for your password the first time.
sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.pluginsudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefPanesudo rm -fr ~/Library/Application\ Support/Oracle/JavaA JDK, and what to leave alone
Developers often have a JDK as well as the Java plugin, and Oracle keeps JDKs in their own folder.
Where a JDK lives
Oracle's JDK guide says to go to this folder and remove the JDK's directory as an administrator:
/Library/Java/JavaVirtualMachinesLeave /usr/bin alone
Oracle says not to uninstall Java by removing the Java tools from /usr/bin. That folder belongs to macOS, and Apple puts it back when the system updates.
What DiskKind shows
DiskKind is a utility to let you know which apps are storing files and what type of files they are storing in your Library folder. It also lets you see what's left behind by Java before and after uninstalling it. Uninstall apps on a Mac
Every app, and what it keeps
DiskKind Free has compiled a list of every app installed on your computer and how much space it uses in your Library, including files used by Java.
Uninstall, with Put back
Apps and their files that Pro Uninstall moves are moved to the Trash. You can Put back anything it moves, and nothing is permanently deleted until you empty the Trash yourself.
Questions about uninstalling Java
How do I uninstall Java on a Mac?
Open Terminal and run Oracle's three sudo rm commands. They remove the browser plugin, the Java control panel and Java's folder in your Library.
Do I need to be an administrator?
Yes. Oracle says you need admin privileges, because those commands run as sudo.
How do I remove a JDK?
Oracle's JDK guide says to go to /Library/Java/JavaVirtualMachines and remove the JDK's directory as an administrator.
Can I delete Java from /usr/bin?
No. Oracle says not to, and Apple puts it back in place when macOS updates.
Find out what all of your apps have installed on your Mac.
DiskKind Free tells you what each app keeps in your Library, then only moves what you want to the Trash. Never deletes anything!
