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.
But wait! Oh no!
Open your preferences, go to the security panel, and select the unsigned software option
Now, we’re cooking with gas! Try double-clicking the download again.
It should go without a hitch. If it does, you’ll see something like this:
Make sure the ‘right’ java is setup and working.
Open a terminal, and run
[text]
java -version
[/text]
If you see ANYTHING but the following…
…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.
Wait a second…
You know it’s going to ‘work’ if you see the splash screen 🙂
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.
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.
74 Comments
how to start and execute queries in mac..
thank you
write your query in a connected worksheet, hit ctrl+enter
Hey Jeff,
I am new to SQL on mac and i have tough time getting sql running on my mac. I have so far installed “jdk8″ ,”instant_client” and “sql developer” on my mac. I am not able to run the SQL prompt . Please help
‘the SQL prompt’ – do you mean the SQL Developer program (GUI), itself?
Also, an instant client isn’t required to run SQL Developer…
I was under the assumption that its similar to oracle 10g.
So there no traditional way of doing ” Select * from emp” stuff on SQL Developer? Is it more like PL-SQL?
We have a SQL Worksheet that can run pretty much anything – SQL or PL/SQL. When you said ‘SQL prompt’ I thought maybe you were referring to our SQL*Plus command line interface.
You say are having a tough time getting SQL Developer running. Where exactly are you getting stuck?
Your explanation is very clear and it helped.
Thanks
Re: Install of database. I followed you link to set-up a database and it had 2 files for download. 1 Virtual Box 2 Download mgr…Why is the download mgr file size 4.9GB and do we need it to set up the database? TY
If you need help getting the Developers Days image going, I wrote this tutorial.
Hallo!
How to open a new worksheet to an Oracle Cloud connection?
Just installed SQLDev 4 ua2 on Mavericks, using the instructions above. SQLDev opens nicely and I can connect to my Cloud acct, and see the default tables, look at the default data, etc. There are no other connections.
Now, its time to create my own objects. I am generating my scripts in a text editor and would like to run them. Something silly I’m missing?
I’m no newbie, except to v4; I’ve been using SQL Dev 3.x for the last 3 months, and then before my last gig (1.8yrs), had introduced, given classes, etc to SQLDev for a couple years at prior gig.
Thanks!
Setup:
iMac 2011/24G/1T/SuperDrive/OS X 10.9
Oracle Cloud Connections don’t support worksheets. You can use the web interface to run your commands or you can use our Cart feature to upload objects and their data.
Since it’s all REST access vs traditional SQL*Net/OCI stuff, we’ve had to build the APIs for all of the supported db features for it to work in SQL Developer. We haven’t gone beyond browsing objects at this point.
Thanks for the quick answer.
Since I’m all about scripts anyway, seems no big shakes, right? Will I be able to edit my data whilst browsing data (no access presently; am at work)? And, if I create views for my multi-table stuff (which I generally do ANYWAY), will be able to view my data that way? The destination is a spreadsheet ANYHOOOO…
Thanks,
Sorry, there’s no live editing of data in SQL Developer for a cloud connection. You can do that in the APEX interface though.
Thanks for your manual, Jeff, it was the solution for my installation-.problems
Hey Jeff,
You graduated from WVU in 1999? That’s cool! I graduated from WVU in 1970 and 1977. Let’s go Mountaineers!
My dad graduated in ’74, my sister in ’01, and my brother in ’03? Mom felt bad about being a slacker and ended up getting her Master’s degree in the early 90’s. Oh, and I met my wife first week of freshman year, and she gradated as the top student from the school of engineering, also in ’99. You could say my family bleeds blue and gold 🙂
Hi,
i just clicked on the links shared in this page and installed the latest Java kit and oracle developer on my mac 10.8
I am very new to Mac machine and this is my first time install of sql developer and i dono much abt creating users or unlocking or anything abt connection and all. These were taken care by someone else and i was just using the software. I am a starter so plz bare with me. I saw all tutorials regarding unlocking HR schema which comes default, i saw them unlocking on windows using sql*plus.. How do i unlock hr schema so that i can atleast get my hands on few queries? other than HR schema, how do i connect to other schemas. I am very new or oracle db and everything and want to learn. Kindly help
You can unlock users with SQL Developer, assuming you have a privileged account like SYS.
View > DBA
Open the Security node for your database, again requires that account with proper privs, then select users, then select HR. Now right-click on HR, and select ‘Unlock User…’
To connect to other schemas, you just need the username and password.
Where is your database? Who created it? Who’s maintaining it?
Hello sir, I was always given configured system till date and its hardly been sometime i got my hands on this technology. All wht i have done till now is install oracle sql developer and updated java version. I have installed anything else., i dono where to find the installation packages for my mountaion osx, i dono know how to configurre and get started. If you could guide me on this., from installation till configure and connection, it would be great help. Thnx
So you don’t have a database?
No. I found this link. now i am trying to install these packages
http://www.excession.org.uk/blog/how-to-install-oracle-sqlplus-on-mountain-lion.html
skip all that, just install this – you’ll have your own database and everything you need
i can’t edit SetJavaHome /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home
I find it through opening it with textwrangler but when i try to edit it, it says “save the file to be able to edit it since darwin file is not on the disk. but your edits won’t alter the file.”
what can i do?
thanks
Guys, I was also having issues running it from the icon, but I was able to run it from terminal. After that I added the SQL icon into the JavaVirtualMachines folder, copied to my desktop and now I can just launch from there without using terminal.
These instructions didn’t work for me. I had to add the line “/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home” to $HOME/.sqldeveloper/jdk
Adjust this line to match your machine’s location of Java.
hey jeff . i read your blog almost twice a day..really gr8 ..
i have macbook pro (os : mountain lion)and just have just installed sql developer and somehow i installed it correctly by reading ur article (here) but when i make a connection it gives me an error . i have tried alot to do something but i guess nothing is on my way ..please please do help me 🙁 . i have a lot of work pending .
my error:
STATUS :FAILURE -TEST FAILED :IO ERROR :THE NETWORK ADAPTER COULD NOT ESTABLISH THE CONNECTION.
Where is the database you’re trying to connect to? The error indicates that your machine can’t reach it on the network. Can you ping the server name or IP address you used in your connection properties?
Twice a day? I’m extremely humbled to know that you’re getting enough value to merit so many visits! Thanks for sharing that and making my day 🙂
Now let’s get your connection problem fixed!
i think i need to download oracle 10g database like we do on windows ..
cuz i dont have any for mac os X .. i dont understand jeff which database u are talking about .
in windows its a lot easier but when it come to mac ..things start to end up badly.
can u please tell me what all i need to install on my mac .i think i;m missing something. i dont have a database on my mac i have it on my windows desktop and even oracle doesnot provide downloads for mac’s
so what should i do jeff!
try to solve me out
Regards
SQL Developer is just the client – it can run pretty much anywhere. You’ll need a database to connect to, but that’s the subject of a different post. Most of us run VirtualBox VMs to get Oracle Database on a Mac, running XE or EE on a Linux virtual environment.
Thanks for the helpful instructions. I also ran into the “double clicking that sql icon nothing happens” issues.
I was however able to find a bit more information: activity monitor showed as bash process running at 100% for one cpu, inspecting this process showed SQL Developer.app as the parent process.
$java -version
java version “1.6.0_33”
Java(TM) SE Runtime Environment (build 1.6.0_33-b03-424-11M3720)
Java HotSpot(TM) 64-Bit Server VM (build 20.8-b03-424, mixed mode)
$ cd /Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin
$ ./sqldeveloper
Oracle SQL Developer
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
Registered TimesTen
Resulting in a splash screen, and the application launching. So not sure why the SqlDeveloper.app refuses to function, but running from the bin directory works.
Yup! This was what I needed – thanks so much!
Awesome! Thanks for sharing that Sandie 🙂
dear admin,
when I am giving this /Library/Java/JavaVirtualMachines/1.7.0.jdk path it is saying error
you mean, /Library/java/javaVirtualMachines/1.7.0.jdk/Contents/Home/, right?
You need to find out where java was installed before you can continue. Use Finder to look for the jdk directory and edit the sqldeveloper-Darwin.conf file to point to it.
when I am double clicking that sql Icon it is appearing on the taskbar as it does on mac it is popping up and down after some time when I am clicking on that icon it is saying application not responding.when I am trying to open sqldeveloper using
./sqldeveloper it is not working it is saying directory not exists
not ./
Go to the bin directory. on my mac it’s
/Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin
Open a terminal, cd to that directory, then try running ./sqldeveloper
it is coming like this Naveens-MacBook-Pro:bin naveen$ ./sqldeveloper
Oracle SQL Developer
Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
Type the full pathname of a J2SE installation (or Ctrl-C to quit), the path will be stored in ~/.sqldeveloper/jdk
Hi,
on my mac 10.8 I installed java which was shown on the top of this page. I even installed Sql. after double clicking that sql icon nothing happens. it is not responding can any bodu help me how to solve this issue. thanks in advance
Open a command prompt, try running java -version
Do you get something back?
Yes?
Then try running sql developer from the command prompt out of the bin directory. What comes back?
If previous answer is ‘No’, then you didn’t install Java correctly – or that’s my guess w/o more info.
Hey when I gave java -version this message is coming in my terminal
java version “1.7.0_05”
Java(TM) SE Runtime Environment (build 1.7.0_05-b06)
Java HotSpot(TM) 64-Bit Server VM (build 23.1-b03, mixed mode)
Good, that’s what you want to see! (Although we have a few known issues with the 1.7 JDK)
Next, try to launch sql developer from the command line – do you get anything back?
Jon,
Looks like the page URL changed – that’s what I get for including it in the post 🙂
I updated the link above and here it is again
Java 1.7 JDK Downloads Page
Jeff,
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1637583.html
gets a 404 now…
Tip for installing on Mountain Lion, just type Java in a terminal and it will prompt you to install. I did not see a 1.6 download available on Oracle for Mac either, but this will install 1.6.
http://www.dssw.co.uk/blog/2012/07/29/how-to-install-java-on-mountain-lion/
Thanks for the hint about the java preferences Ben. I did find that Mac update – I wasn’t sure if it would be an issue installing a patch for Lion but it was fine. In the end, my issue turned out to be due to a small typo in Jeff’s instructions where he listed the folder location for the 1.6 JDK (when you update the .conf file). It should be (on my machine at least):
/System/Library/java/JavaVirtualMachines/1.6.0.jdk/Contents/home/
(In case the difference isn’t obvious: there needs to be a period just before “jdk”.)
Thanks again to everyone for the help.
Typo fixed, thanks Martin!
Hi, I had the same problems described above with JDK 1.7 – but I can’t find a 1.6 install program for the Mac anywhere on the Oracle site.
When I ran “java -version” from terminal it seemed to install it, but I’m not confident that it’s working. My directories are all present, and I updated the .conf file, but I’m still not able to get SQL Developer to open. I suspect my java install is not quite correct.
Thanks for the post, I always find it a headache installing SQL Developer, it’s never clear what needs to be done. Your blog is a real godsend!
Just do a google for Java 6 jdk, there will be a download for OS X
Probably I’m just having one of those days, but when I go to the Java JDK 6 download page, I see Linux, Solaris, Windows… but no Mac. I went to all sorts of JDK archive pages too, nothing there. Even googling wider afield got me no luck. I must just be looking at the wrong thing:
http://www.oracle.com/technetwork/java/javase/downloads/jdk6-downloads-1637591.html
(For now I’m just using 1.7 and editing my SQL in a text editor to avoid the copy problem…)
Thanks again –
Martin
You can get the system to automatically get the file by opening the ‘Java Preferences’ app in /Applications/Utilities/ it will ask if you want to download the 1.6 JDK.
I also found it here:
http://support.apple.com/downloads/DL1421/en_US/JavaForMacOSX10.7.dmg
Cheers
Ben
I am followed all the steps was able to launch SQL Developer perfectly well. However, I am seeing all the above mentioned problems. Seeing ‘Launcher’, it pastes twice in text editor. In addition to all that, I have observed that fonts and text type are totally screwed up, and when i run query which has more than 50 results, I am not able to scroll down in query result windows to see results after count 50.
I can confirm the scroll issue, looks like it won’t let you do more than a single fetch – this is bad.
The fonts – I’m not seeing any issues? Can you take a screenshot and share it somewhere?
In the meantime, can you use the 1.6 JDK? I’ll amend my post as I don’t recommend anyone using SQL Developer on Mountain Lion with 1.7JDK as these issues are not…tolerable.
Just upgraded to ML and installed just Java 1.7 . After all steps, I’ve noticed that when I paste (Cmd-V) text in editor, the text is pasted two times, like I’ve pressed Cmd-V two times.
Any ideea what can I do to fix this?
I’m seeing the same thing. If i paste with my mouse, it works as expected. In our dev builds for the next release, it appears to be working as expected. So a fix should be available soon’ish.
I’ve already downgraded to Java 1.6 and i’m waiting for the next release.
I only hope that it is soon!
Thanks for a great work!
It’s been a long time, but I haven’t found any information about this issue anywhere else.
I’m using Oracle SQL Developer 4.0.3.16.84 and jdk 1.7.0_71 on mac osx 10.9.5 and still have this issue. In my case it is reproduced only if my keyboard language is set up to Russian (With the default U.S. cmd+v works fine). Is it possible to fix it? Thanks in advance!
Just upgrade to ML and installed both Java 1.6 and 1.7. After modifying sqldeveloper-darwin.conf to point to the 1.7 home, the menu bar app title reads “Launcher” instead of “SQL Developer”. Obviously you didn’t run into this problem. Any thoughts?
Nope, my copy does the same thing. I had been running the 1.6JDK as well, and didn’t notice the ‘Launcher’ title when I switched it over to 1.7. I’ll see what I can find out.
Apparently it’s an issue with the 1.7JDK on OS X in general. We’ve got it logged, so fingers-crossed.
I noticed that sqlplus which is available in instantclient package at OTN does not work anymore on Mac OS X 10.8. Is there any newer version that 10.2.0.4 which works?
I got the 32-bit version to work. Have you tried that?
I did, but I am unable to connect to any database. I always get following error:
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
My tnsnames.ora has not changed.
That’s not a SQL*Plus issue though, that’s SQLNET. What if you tried a direct connect instead, bypass TNSNames that is.
Do you get the same 12154 if you try to connect with SQL Developer using the TNSNames entry?
I need to check syntax how to supply all the parameters to SQL*Plus without tnsnames.
It works with SQL Developer using TNSNames entry.
Do a google for ‘direct connect.’ I have a blog post on how to do it here if you search.
It’s possible you have more than 1 tns file on your machine? Is your PATH env var set correctly?
Direct connect works.
Environment variables seem to be correct and I had no issues with SQL*Plus on 10.6 and 10.7.
Relevant variables:
DYLD_LIBRARY_PATH=/opt/sqlplus
SQLPATH=/opt/sqlplus
TNS_ADMIN=/opt/sqlplus
tnsnames.ora is in /opt/sqlplus.
I’m stumped then. You could contact Support or open a thread on our Forums. I’m just a SQL*Plus user after all.
Just FYI, Shift-Command-4 on a mac will let you choose a rectangle of screen to save as an image – I typically use that for my screenshots on a mac – thought yes, if you want to edit / add to that screenshot, Skitch is awesome.
Once I decide to upgrade to OS X ML I’ll give you instructions a shot – thanks!
And I used the Shift-Cmd-4 to take all the screen captures. It was just the ‘post processing’ tasks that I ended up using Skitch.