31 August 2011

Manually installing Java on OS X Lion

Today I hit yet another problem with my upgrade: IntelliJ IDEA wouldn’t start. It prompted me:

To run “IntelliJ IDEA 10”, you need a Java runtime. Would you like to install one now?

Clicking “Install” on the dialog went out to try to download the software, but then just popped up another warning box:

The software is currently unavailable.

To install a Java runtime later, open “IntelliJ IDEA 10” again.

Well that’s not very helpful. Unsurprisingly, repeatedly opening IntelliJ IDEA did nothing to solve the problem.

After scouring the Apple forums, it turns out there is a public download available in their support site: Java for OS X Lion. I downloaded and installed this and I was good to go.

See also my earlier notes on the Lion upgrade:

Update 31 August

It turns out that the root cause of this problem is because we use an internal update server at work and the server hasn’t yet been updated to work with Lion. You can check this with the defaults command for both user and system-wide software update settings:

$ defaults read com.apple.SoftwareUpdate
$ defaults read /Library/Preferences/com.apple.SoftwareUpdate

If the output of either includes a ‘CatalogURL’ value, then you have a custom update server. Switching back to the default Apple update server solved the problem for me, and also made the 10.7.1 update available.

Here’s how you reset a system-wide custom update server:

$ sudo defaults delete /Library/Preferences/com.apple.SoftwareUpdate CatalogURL

Once our IT team gets the update server up-to-date, I’ll be using defaults write to set the CatalogURL back to our internal server for faster updates again.