ThatJeffSmith

Install Oracle SQL Developer on OS X (Mountain Lion)

One of the great benefits to having an application developed on the Java platform is the ability to run it on many different operating systems. While Windows may still be the corporate standard in more shops than not, geeks worldwide know that Apple’s hardware and OS (OS X) are ‘superior.’ With yesterday’s release of Mountain Lion (10.8) I figured this was a good time to do a quick write-up on how to get started with SQL Developer on your [i]Mac[Book|Mini].

But wait, where is the Java?

The Java runtime that had been included with the OS X installs is no longer available in Mountain Lion. As I understand it, even if you had installed your own version of Java, when you upgrade or install 10.8, they will go away.

So if you try to run a previously installed version of SQL Developer, you won’t get very far. Java applications don’t run very well sans Java, tsk, tsk.

So for the n00bs out there (including me), here’s your

Step-By-Step Guide for Installing Java and SQL Developer

Let’s install Java first.

Getting to the download page is your first task. I’ll make it easy for you.

Java SE Development Kit 7 Downloads

* Yes, I know we officially support 1.6 and not 1.7, but here’s a secret: 1.7 works just fine in version 3.2.20_09 of SQL Developer!

Once it’s downloaded, double-click it.

You want the download that says ‘OS X’

But wait! Oh no!

Stop, do not pass go, do not collect $200.

Open your preferences, go to the security panel, and select the unsigned software option

We’re OK, but you still need to be careful what you install.

Now, we’re cooking with gas! Try double-clicking the download again.

This is what you want to see, click ‘Continue’

It should go without a hitch. If it does, you’ll see something like this:

Success!

Make sure the ‘right’ java is setup and working.

Open a terminal, and run

java -version

If you see ANYTHING but the following…

What version of Java is installed and running by default?

…you may have a problem.

But this is Apple and OS X, and so it will find Java just fine.

Ok, now we can worry about downloading and installing SQL Developer.

Go here and download ‘Oracle SQL Developer for Mac OSX platforms.

Once it’s downloaded, you’ll need to extract it and run it.

I would move it out of the downloads folder to your applications folder first, but this will still work.

Wait a second…

This is a very good sign!

You know it’s going to ‘work’ if you see the splash screen :)

SQL Developer running and ready to go in OS X Mountain Lion

But My SQL Developer is Using the Wrong JDK!?

SQL Developer will use whatever Java it can find. If you have the 1.6JDK installed as well, it might find that first. If you want to force it to use the 1.7 you just installed, all you need to do is explore the SQL Developer package, and edit the sqldeveloper-Darwin.conf file in the bin directory.

Update the ‘SetJavaHome’ line to point to the 1.7 JDK

You may have noticed that Java 1.6 installs to a different directory than 1.7 on OS X.

  • 1.6 – /System/Library/java/JavaVirtualMachines/1.6.0.jdk/Contents/home/
  • 1.7 – /Library/java/javaVirtualMachines/1.7.0.jdk/Contents/Home/

Just update the ‘SetJavaHome’ entry to the version of Java you want SQL Developer to use when it runs.

A Few More Notes

You might be wondering why I installed Java 1.7 when we technically only support 1.6. Well, 1.7 will work, and that’s what many of our developer use internally. If you don’t like bleeding edge, feel free to follow the exact same instructions and grab JDK 6 instead.

This is one of the first work related blogs I’ve written on my home machine a la Mac. I didn’t have my trusted Windows friend SnagIt at hand, but @brentO turned me onto a free and very handy utility called ‘Skitch.’ It works, and once you forget all the normal Windows application ‘way of doing things,’ is also very intuitive. And it’s free, did I mention that? Thanks Brent!

If you don’t like that the application title has an underscore in it, e.g. ‘SQL_Developer,’ then here’s a nice post from @martinpaulnash explaining how to fix that too.