30

I recently installed the Java runtime (through Software Update) and enabled the Java browser plug-in and WebStart on Lion, but I don't need them anymore.

Unchecking "Enable Java" in Safari preferences gets the job done, but I'd rather get rid of Java completely. So the question is, how do I do this? I want to go back to a clean Lion install, Java-wise.

2
  • 1
    There you go Can. I just checked a fresh install of Lion and the files are indeed there. I have modified the answer in kind. It is now the definitive guide to removing Java from OS X Lion :)
    – user10355
    Sep 8, 2011 at 2:07
  • I linked from a Mountain Lion question to this question, with an assumption that general advice below will be applicable to the more modern system. Feb 2, 2013 at 19:42

2 Answers 2

24

Removing all traces of Java, cleanly, from OS X Lion

Uninstalling Java for Lion is simple. Remove the following directory (which contains the file 1.6.0.jdk):

/System/Library/Java/JavaVirtualMachines/

Then (for completeness), clean up the installer records by removing them from /private/var/db/receipts/:

com.apple.pkg.JavaForMacOSX107.bom
com.apple.pkg.JavaForMacOSX107.plist

And lastly, we clear out any traces of the product installation from Software Update by editing the following plist file: InstallHistory.plist, located in:

/Library/Receipts/

Note: Editing the install history plist file is better done by copying the plist to your desktop (as it owned by root and won't let you modify it), but make sure you restore the default ownership by running the following command:

sudo chown root:admin InstallHistory.plist

You can open the file up in Text Edit and remove the following lines:

<dict>
    <key>date</key>
    <date>2011-09-06T14:43:35Z</date>
    <key>displayName</key>
    <string>Java for Mac OS X 10.7</string>
    <key>displayVersion</key>
    <string>1.0</string>
    <key>packageIdentifiers</key>
    <array>
        <string>com.apple.pkg.JavaEssentials</string>
        <string>com.apple.pkg.JavaForMacOSX107</string>
    </array>
    <key>processName</key>
    <string>Software Update</string>
</dict>

Additional information

There are two packages that are found in the Java for Mac OS X 10.7 dmg, JavaEssentials and JavaForMacOSX107. The former does not install anything. I have compared the files found on a clean OS X 10.7 install (that does not include Java) and those found in that package, and they are all present and moreover, are identical in every way (v14.0.3). Thus, the only package that needs to be removed is the SDK. Additionally, you can remove the receipts and the install record, but those are more cleanliness than anything. Remove the SDK is sufficient (try running a program that requires Java after the removal of that file, and you will once again be greeted with the notice to install Java).

6
  • wow, that is a comprehensive answer. I will give it a try, but probably not right now. =) thanks. Sep 4, 2011 at 19:42
  • 1
    Please do follow up with us Can. It would be nice to have a guide for removing Java as I'm sure this is going to come up for others using Lion. I am certainly interested and would commit to testing. Perhaps we can even collaborate on an Applescript for the lazy or less technically savvy.
    – user10355
    Sep 5, 2011 at 4:36
  • That would be great. As I said under Kevin's answer, I will probably reinstall Lion soon anyway, so I might be able to generate a proper diff. Sep 5, 2011 at 15:00
  • You, sir, have truly deserved the accept. Thanks! =) Sep 8, 2011 at 19:42
  • 1
    Why do you keep /System/Library/Java/?
    – gentmatt
    May 22, 2012 at 12:21
0

This is what I found:

https://superuser.com/questions/5950/uninstall-java-on-mac-os-x

It seems like the only way would be to go back to a "clean Lion install all-wise". Java used to be part of the core OS: it helps not only on running web content, but also some apps and scripts.

Having said this, I suppose the reason why it doesn't come pre-installed in lion is because its heavy, and Apple wanted to make the download as light as possible. Nevertheless, I don't expect it to be uninstallable because some of its components get deep into the OS.

I suggest you simply turn it off. As you said before it gets the job done, plus you never know when you might need it again; as I mentioned before, even some native apps make use of it. It's there. It's sleeping. It isn't hurting anyone... I think its the best option.

Hope it helps.

7
  • hmm, I thought (and still do, actually) things might be different in Lion. and right now, the only app that needs Java on my system is Photoshop, so Java isn't really required, that's why Apple got rid of it. Sep 4, 2011 at 14:24
  • But it still asks for installation whenever you need it. Mac OS X doesn't need it to run, but I'd say its like many other services you can't uninstall, such as the apache web server that comes in every mac. Anyhow I suggest you keep it, since Photoshop needs it.
    – kevin9794
    Sep 4, 2011 at 15:22
  • Actually my initial plan was to only get rid of the browser plug-in and webstart, but then I thought it might be easier to uninstall everything and start from scratch. Well, I guess I'll reinstall Lion soon anyway. Sep 4, 2011 at 17:04
  • 1
    @kevin9794 This doesn't apply to Lion.
    – user10355
    Sep 4, 2011 at 18:09
  • 1
    @kevin9794, because that pertains to prior version of OS X that shipped with Java. Not only did we not have a list of installed files, it would be nigh impossible to remove them all without breaking something. However, Lion does not ship with Java, it is now a separate package, and thus, affords us all a nice and neat view of exactly what files are installed. While technically there exists no uninstaller, it shouldn't be hard to find run a comparison against a clean Lion install and then pull out all the files manually. Thus certainly making the answer a resounding "YES! You can remove Java!"
    – user10355
    Sep 5, 2011 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .