Forked from keithhamilton/gist:9b618e99eb58779b665f
Last active
August 29, 2015 14:07
-
-
Save edeustace/f546553f5bcb2c43170b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Oracle hasn't updated the Java 1.7u65 installer to support Yosemite, | |
# so here's a way to get it installed. | |
# This is actually what I used to get IntelliJ IDEA running, but even | |
# if you aren't running that IDE, this is a quick script to get Java | |
# going strong on your fresh install of OS X 10.10 | |
# Install Java 6 for OS X | |
# --------------------------------------------- | |
JAVA6_DMG='JavaForOSX2014-001.dmg' | |
JAVA6_INSTALLER='JavaForOSX.pkg' | |
JAVA6_VOLUME='/Volumes/Java\ for\ OS\ X\ 2014-001' | |
wget http://support.apple.com/downloads/DL1572/en_US/JavaForOSX2014-001.dmg -O ~/Downloads/$JAVA6_DMG | |
hdiutil mount ~/Downloads/$JAVA6_DMG | |
sudo installer -pkg $JAVA6_VOLUME/$JAVA6_INSTALLER -target / | |
diskutil unmount $JAVA6_VOLUME | |
# Install Oracle Java 7u65 SDK | |
# --------------------------------------------- | |
CORE_SERVICES='/System/Library/CoreServices' | |
JDK7_VOLUME='/Volumes/JDK\ 7\ Update\ 65' | |
JDK7_DMG='jdk-7u65-macosx-x64.dmg' | |
JDK7_INSTALLER='JDK\ 7\ Update\ 65.pkg' | |
# create a clone of the SystemVersion plist replacing '10.10' with '10.7.3' | |
# then back up and replace the SystemVersion plist | |
sudo cat $CORE_SERVICES/SystemVersion.plist | sed 's/10.10/10.7.3/g' > /tmp/SystemVersion.plist | |
sudo cp $CORE_SERVICES/SystemVersion.plist $CORE_SERVICES/SystemVersion.plist.bak | |
sudo mv /tmp/SystemVersion.plist $CORE_SERVICES/SystemVersion.plist | |
# Install Java | |
if [ ! -e /opt/homebrew-cask ]; then | |
read -p "--> homebrew-cask not found. Please download the Java 7u65 SDK installer to your Downloads folder. Press ENTER once it has finished downloading" | |
hdiutil mount ~/Downloads/$JDK7_DMG | |
sudo installer -pkg /Volumes/$JDK7_VOLUME/$JDK7_INSTALLER -target / | |
diskutil unmount /Volumes/$JDK7_VOLUME | |
else | |
brew tap caskroom/versions | |
brew cask install java7 | |
fi | |
# replace the original plist file | |
sudo mv $CORE_SERVICES/SystemVersion.plist.bak $CORE_SERVICES/SystemVersion.plist |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment