If you have installed JDK6 on macOS Sierra or OS X El Capitan using Java for OS X, it was quite difficult to remove it cleanly, so make a note.
$ sw_vers
ProductName: Mac OS X
ProductVersion: 10.12
BuildVersion: 16A323
The question "what's wrong?" Is that you can't change the symbolic links created when you install Java for OS X (ln -fs
, ʻunlink,
rm`).
The symbolic link in question is below.
$ ls -al /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
lrwxr-xr-x 1 root wheel 59 1 27 01:03 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK -> /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
This doesn't disappear easily. The ln
command seems to pass and does not change, and the ʻunlink and
rm` commands return Permission denied.
After investigating, it seems that the cause was that protection by a function called SIP (System Integrity Protecton) implemented after ʻOS X El Capitan` was working.
There were people who were having trouble with the same thing on stackexchange, so it was very helpful. => [delete-unnecessary-files-in-system-library-for-mac-os-x](http://apple.stackexchange.com/questions/214538/delete-unnecessary-files-in-system-library- for-mac-os-x)
Once you know this, it's not that difficult to deal with later. Follow the steps below.
⌘
+ r
before booting.csrutil disable
to run it. (This command disables SIP.)/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
.that's all.
After all the operations, it is recommended to start macOS utility again and run csrutil enable
to enable SIP just in case.
Let's install it with Homebrew. You can install JDK6 with the following command.
However, even with this method, /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
may be overwritten, so it may be better to prepare for checking the path of the symbolic link and replacing it. not.
$ brew cask install java6
$ ls /Library/Java/JavaVirtualMachines/
1.6.0.jdk/ jdk1.7.0_79.jdk/ jdk1.8.0_121.jdk/ jdk1.8.0_91.jdk/
$ ls -al /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
8 lrwxr-xr-x 1 root wheel 59 2 4 20:11 /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK -> /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents
$ sudo unlink \
> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
$ sudo ln -s \
> /Library/Java/JavaVirtualMachines/jdk1.8.0_121.jdk/Contents \
> /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK
Recommended Posts