How To Disable Java on OS X Lion to Protect from Zero-Day Bug

A Java zero-day exploit was reported today. Here’s how to disable Java on Mac OS X Lion so that for the time being, you won’t accidentally run any applets that could compromise the security of your system(s). A command to reverse your changes is also included so that once the all clear is given we can very easily enable Java again. That said, not many public websites use Java these days, so it is worth considering the idea of leaving it disabled indefinitely.

Run:

/usr/libexec/PlistBuddy -c "Set GeneralByTask:Any:WebComponentsEnabled 0" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$(ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }').plist

You can confirm it worked properly by running Java Preferences (you can search for it via Spotlight) and checking to ensure the “Enable Applet plug-in and Web Start applications” box is NOT checked.

When you’re ready to re-enable Java, run this command:

/usr/libexec/PlistBuddy -c "Set GeneralByTask:Any:WebComponentsEnabled 1" /Users/$USER/Library/Preferences/ByHost/com.apple.java.JavaPreferences.$(ioreg -rd1 -c IOPlatformExpertDevice | awk '/IOPlatformUUID/ { split($0, line, "\""); printf("%s\n", line[4]); }').plist

Posted

in

,

by

Tags:

Comments

One response to “How To Disable Java on OS X Lion to Protect from Zero-Day Bug”

Leave a Reply

Your email address will not be published. Required fields are marked *