How to Uninstall Java on Mac OS X

Java

Java is, and always has been, the source of many woes. And security holes. Lots of security holes. There’s really no reason to have it installed anymore, especially now that Minecraft has its own bundled Java for both OS X and Windows. So today is the day you remove it.

If you uninstall it and figure out that one of your applications depends on Java and won’t run anymore, it’s easy enough to reinstall it again. Or stop using that application and find a better alternative. But either way, uninstalling Java isn’t going to break your computer permanently.

Removing the Java Runtime

This is easy enough. Open up a Terminal window and paste in the following two lines. You’ll be prompted for your password.

sudo rm -fr /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin 
sudo rm -fr /Library/PreferencePanes/JavaControlPanel.prefpane

JavaVirtualMachines_—_-bash_—_67×14

Done! Now you can close and reopen the System Preferences window to see that the icon is gone.

Removing the Java JDK (Which May Not Be Installed)

The java development kit is different than the runtime, and to remove that, you’ll need to run a different command and look in a different folder to see if it even is installed (usually it’s not). Open up a Terminal window and type in (or paste) the following command to switch to the correct folder:

cd /Library/Java/JavaVirtualMachines

And then use “ls” at the prompt to see if there is anything in there. In my case, there was. So then you’ll type in the following:

sudo rm -rf jdk1

And then use the TAB key to make the shell complete the file name. It should look something like the following screenshot, but the number might be different in your case:

JavaVirtualMachines_—_-bash_—_67×14

That should be all you need to do.

Making Sure Java is Gone

It’s easy enough to make sure that Java is completely dead. You should already have noticed that closing and reopening System Preferences is enough to make the icon there go away, but to be really sure, you can open up a terminal and simply type “java”. You’ll be presented with the message, “No Java runtime present, requesting install”.

And then a little dialog box will pop up with the OK button highlighted, indicating that everything is going to be OK now.

JavaVirtualMachines_—_-bash_—_67×14

We’ve also covered how to uninstall Java from your Windows computer if you want to do that.

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.