Published on

Installing an Oracle Database on Mac OS Sierra 10.12 or Later

Authors

If you want to create an application using Oracle Database on Mac OS, you might be faced with the question of how to install the database and which tools to use.

The first solution you'll find is VirtualBox. It's possible, but it's a very cumbersome solution:

  • Install the VirtualBox software
  • Download the Oracle Database virtual machine (~7 GB)
  • Configure the ports
  • Meet the system requirements

The requirements are available here: Oracle VM Database.

oracle-on-mac-10-12-oracle-conf A much lighter method is to use Docker to store the database and SQL Developer to connect to it.

Install Docker

  1. Download Docker for Mac from the official website.
  • Create a Docker account (username, password, email).
  1. Open the Docker.dmg file and drag the icon into the Applications folder. oracle-on-mac-10-12-docker-move-install
  2. Launch Docker from the Applications folder.

  • The Docker icon will appear in the top right corner of the screen.
  • To verify that Docker is working, you can run the following in the terminal:
oracle-on-mac-10-12-docker-run
docker version
oracle-on-mac-10-12-docker-version

Store the Oracle Database image in Docker

You now need a database to store in Docker.

Several database images are available on Docker.

In this tutorial, we're using the truevoly/oracle-12c image.

You can use it if it's still available, otherwise you can search for other oracle-12c images on the Docker website.

In a terminal, run the following command to download the image to Docker:

docker pull truevoly/oracle-12c

Once the download is complete, the following message appears:

Status: Downloaded newer for truevoly/oracle-12c:latest

Create the container

The container will store the database locally.

  1. First, create a folder for the image:
mkdir ~/oracle_data

Now create the container and mount it in the folder created using the oracle-12c image. This command will also launch the instance:

docker run -d -p 8080:8080 -p 1521:1521 -v ~/oracle_data/:/u01/app/oracle truevoly/oracle-12c

At the end of the execution, a hash will be generated. Verify that the container is running with the following command:

docker ps
oracle-on-mac-10-12-docker-ps

Manage the container with Kitematic

Kitematic is a legacy desktop solution that allows you to manage Docker containers via a graphical interface.

Once installed, open Kitematic and you will see the Oracle container running. oracle-on-mac-10-12-container-conf

Creating databases from the command line

You can use the terminal to connect to the database, but it's better to use a client.

It's easier to manage this way.

If you still want to use the command line, it's accessible via Kitematic.

  • Click the EXEC button → a terminal will open. - You can connect to sqlplus with the following command:
sqlplus system/oracle@//localhost:1521/xe
oracle-on-mac-10-12-sqlplus

Users and Databases

In Oracle 12c, users and databases are the same, so you can create them directly in this console.


Using SQL Developer

  1. Download SQL Developer from the official website.
  2. Unzip the .zip file and place it in the Applications folder.
  3. Open SQL Developer.

You can test the connection to your Oracle database using:

  • Username: system
  • Password: oracle

Choose any login name. You can keep the host, port, and SID as they are.