Installing an Oracle database on a Mac computer is a bit different to installing it on a Windows or Linux computer.
If you’re running a MacBook (like I am), or any type of Mac, this article will be useful for you. You’ll see the step-by-step instructions to install Oracle on a Mac.
Oracle doesn’t support running an Oracle database directly on a Mac computer. You can’t install Oracle Express, for example, in the same way you can on a Windows computer.
The good news is that you can use a Virtual Machine. To get set up with Oracle on your Mac, the general process is:
- Get a program that runs virtual machines (VirtualBox)
- Get a pre-configured virtual machine
- Install the virtual machine file
- Set up the network settings so your Mac can connect to the Oracle database inside the virtual machine
- Start writing SQL on your Mac!
Let’s take a look at the requirements, and then get into the steps.
So, what do you need to be able to run Oracle using a VM on a Mac?
The requirements for running a virtual machine are listed on Oracle’s page here, and are shown below:
- At least 2GB RAM. Default VM is 1G RAM, for better performance increase.
- At least 15GB of free space
- 2GHz processor (a lesser processor will be acceptable but slower)
- Mozilla Firefox 2.0 or higher, Internet Explorer 7 or higher, Safari 3.0 and higher or Google Chrome 1.0 or higher
- Admin privileges on your computer
My current Mac is a 2015 MacBook Air with 4GB of RAM and a 128GB hard drive. It actually runs pretty slowly, because the 4GB RAM is split with 2GB for the VM and 2 GB for the Mac OS, bringing both systems to a crawl. MacBook Airs are not designed to be able to run intensive programs such as VMs.
In the future, I plan on updating to a new MacBook Pro. I’ve read a few reviews and haven’t heard of any poor performance when using a MacBook Pro. Probably because they have a lot more RAM.
If you really want to use Oracle on a Mac, but don’t quite meet the requirements, you can use Oracle Live SQL, which is a web-based Oracle database.
Assuming you want to install Oracle on your Mac, let’s look at the steps.
Step 1: Get VirtualBox
The first step to getting Oracle on your Mac is to download a program called VirtualBox. This program allows you to run virtual machines, which are self-contained operating systems. It will let you run a Windows or Linux operating system inside your Mac.
I suggest VirtualBox because it’s free, and Oracle provides a ready-made file that you can use with it. One alternative is Parallels, which I explain at the end of this guide.
To download VirtualBox:
1. Go to the VirtualBox website: https://www.virtualbox.org/wiki/Downloads
The current version is shown at the top of the page (currently it is 5.2.18).
2. Click on “OS X Hosts”. This is a direct link to a .dmg file, which is the installer file for Mac.
The file will start downloading. It’s approximately 92 MB.
3. Once the file is downloaded, open it.
4. Double click the VirtualBox.pkg icon in the window that appears.
5. Click Continue if a message appears about installing the package.
6. Click Continue on the welcome screen.
The installer will tell you how much space VirtualBox will take up (approx 182.9 MB).
7. Click Install.
8. Enter your password if prompted. The program will now be installed.
9. Once completed, it will inform you the installation was successful.
10. Click Close, and move the installer to the trash.
Step 2: Download the Oracle Developer VM
Now you’ve got VirtualBox installed, you need to download the file that contains the Oracle database. This is the virtual machine file and is provided by Oracle.
It’s called the “Oracle Developer VM” or “Oracle Developer Day VM”, as it was originally created for developers but it has expanded since then.
To download this file:
1. Visit the Oracle Developer Day download page here.
This page lists the versions of software it comes with. At the time of writing, this is Oracle Linux 7 with Oracle Database 12.2.
2. Scroll to the bottom of the page and click Accept license agreement.
3. Click the link to Oracle DB Developer VM.
This file is about 7GB so may take a while. I’ve had no issues downloading it with Chrome, but you may want to use a download manager if your connection isn’t very good.
4. You’ll be asked to log in to your Oracle account. If you have an account, enter your details. If you don’t have an account, you can create one. It’s easy and free.
5. Once you have logged in, the Developer Days VM file will start downloading. It has an “ova” extension.
Step 3: Set Up the Oracle VM
Now you have downloaded the Oracle VM file, it’s time to set it up.
1. Open VirtualBox. I usually do this by pressing Command and Space, and entering VirtualBox.
2. Click File, then click Import Appliance. The Appliance to Import screen is displayed.
3. Click the Choose File button on the right of the textbox, which is the little yellow folder icon with the green arrow.
4. Select the DeveloperDays OVA file you have just downloaded, and click Open.
5. Click the Continue button on the main installer.
6. Click Import on the Application Settings page.
7. Click Agree on the popup that appears.
8. The import process will begin. This process took about 5-10 minutes for me, despite what the popup says.
9. Once the installer is finished, you should see “Oracle Developer Days (Powered Off)” on the left panel of the VirtualBox window. This means the VM is installed but not running.
Step 4: Run the Oracle VM
Now the installation has finished, it’s time to run the Oracle VM.
1. To run the Virtual Machine, double-click on it. If there are any information dialogs that appear, click OK.
2. When a login screen appears, enter a username of “oracle” and a password of “oracle”.
3. When you see a terminal window, the virtual machine is ready to use. You can close this terminal window if you like.
Step 5: Make it Visible to the Mac (Host)
You’ve got the Oracle Virtual Machine running now. It comes with SQL Developer so you can run that inside the Virtual Machine if you like.
However, I prefer to use the SQL Developer that’s on my Mac. That’s possible with this virtual machine. If you want to do that as well (or use a different IDE of your choice), you can do that by making the virtual machine visible to your Mac for connecting to the database.
- Look at the top right of the corner of your virtual machine. It should show a connection icon, and if you click on it, it should show the word Wifi in bold, to indicate that it’s connected. We need to open the port on the firewall that’s running on the Linux virtual machine.
- Click on the System menu at the top, then click Administration > Firewall.
- Click Other Ports.
- Click Add
- Click User Defined
- Enter port 1521 and a protocol of TCP.
- Click OK and close the Firewall Configuration menu.
Step 6: Set Up Port Forwarding
The next step is to set up port forwarding. To do this, you need to find the IP address of your virtual machine.
- In the terminal window on the virtual machine, run the command “ifconfig”.
- In the output, an IP address will appear. It would start with a number 10.
- Now, go to the VirtualBox application and click VirtualBox > Devices > Network Adapters.
- Click on the Network tab.
- Click on Adapter 1.
- Click Port Forwarding.
- Click Add.
- Enter a name, then use protocol TCP.
- Enter a Host IP of 127.0.0.1.
- Enter a Host Port of 1521.
- Enter a Guest IP which is the IP address you found earlier when running the ifconfig command.
- Enter a Guest Port of 1521 as well.
- Click OK.
This should now allow you to connect from your MacOS to the virtual machine and then to the Oracle database.
Step 7: Test Using SQL Developer
The last step is to test this connection using SQL Developer.
1. Open SQL Developer on your mac. If you haven’t downloaded it, you can download it from the Oracle website.
2. Create a new connection by clicking on the green + icon.
3. Enter these details for your connection:
- Name: whatever you like. A name such as “Oracle VM” is OK if you can’t think of anything.
- Username: hr
- Password: oracle
- Check Save Password if you don’t want to enter the password every time.
- Hostname: localhost
- Port: 1521
- Select “Service Name” instead of “SID”
- Service Name: PDB1
- Connection Type: Basic
4. Click “Test” to test the connection. The message should say “Success”, which means the connection has worked.
5. Click Save to save your connection in the list.
6. Click Connect. After a moment, a new SQL worksheet window is opened on this new connection.
You can now run SQL queries on Oracle on your Mac. This will work for as long as you have the Virtual Machine running in the background.
If you have any issues with connecting, check out this post for some common issues and solutions.
Once you have finished with your Oracle SQL session, you can shut down your VM. To do this, go to System > Shut Down. The Virtual Machine will go back to a “Powered Off” when it’s done.
Alternative to VirtualBox: Use Parallels
One alternative to this process of using VirtualBox and the Oracle VM is to use Parallels. Parallels is a VM application, just like VirtualBox. The key differences are:
- It has a different VM file format, so you can’t use Oracle’s VM files.
- It’s a paid tool, unlike VirtualBox which is free.
- You can install your own operating system on it, so you can run Windows 10 for example, instead of Oracle Linux. VirtualBox allows this as well.
- You can install your own version of Oracle on there, such as Oracle Express or an earlier/later version of Oracle.
The steps are quite similar to setting up VirtualBox. To set up Parallels for an Oracle database on your Mac, the high-level steps are:
- Purchase and download Parallels for Mac (or use the free trial).
- Install Parallels.
- Set up a new Virtual Machine on Windows 10. I don’t know if you have to download the Windows 10 (or other Windows version) ISO file, or if Parallels can do that for you.
- Once the operating system is installed, download Oracle or Oracle Express from the Oracle website, inside your virtual machine.
- Install it on your virtual machine as though you’re running it on a Windows computer.
- Configure the port settings in a similar way as you did for VirtualBox
- Connect to the virtual machine from SQL Developer on your Mac.
I’ve used Parallels in the past for this. The only reason I stopped was because my MacBook air didn’t have the specs to keep up with running a VM.
Some developers want to run an Oracle database on a Mac. While Oracle is not natively available on a Mac computer, it’s possible to run Oracle or Oracle Express on a Mac using a virtual machine.
This article describes the steps you need to take to set up the existing Oracle Developer VM and VirtualBox on your Mac to get it up and running.