Running Oracle Database Express Edition (XE) On Mac
Oracle describe Oracle XE as:
Free Oracle Database for Everyone
Oracle XE is an excellent local database that can be used for a variety of uses including local development.
Oracle Database XE can be downloaded for free (assuming you have an Oracle login - also free) from https://www.oracle.com/database/technologies/xe-downloads.html. Unfortunately, there are downloads for Windows and Linux only - there is no native package for the Mac.
So, how can we run Oracle XE on a Mac ?
The simplest way is via Docker. The steps we will follow to achieve this are:
- Download the Oracle XE image for Linux
- Create a Docker image
- Run the Docker image.
I'm assuming you already have Docker installed and working on your Mac, if not, checkout the Docker documentation.
Download the Oracle XE Image
Since the Oracle XE image is proprietary, we need to create our own Docker image rather then download a pre-generated image from Docker Hub. To enable us to download, we must login to the Oracle site and download the XE image from: https://www.oracle.com/database/technologies/xe-downloads.html . This link will require a login, and remember that the Linux image must be downloaded.
Once downloaded, you should have a file called something like:
Create a Docker Image
After downloading the Oracle Linux image, we are in a good position to create a Docker image. To make this easier, Oracle have provided some scripts that can be cloned from GitHub that take all of the hard work out of the process.
Clone the Oracle
docker-images repo from
Change directory to the
docker-images/OracleDatabase/SingleInstance/dockerfiles directory within the cloned repository. Inside this directory, you will see subdirectories for each version of Oracle that we can create a Docker image for.
Since we are creating a Docker image for the XE version of the database, copy the downloaded Oracle image into the
We've now downloaded everything necessary and can create the Docker image. This is done by executing the following:
> cd docker-images/OracleDatabase/SingleInstance/dockerfiles > ./buildDockerImage.sh -v 18.4.0 -x
-v parameter tells the script to create an Oracle 18.4.0 version image, whereas the
-x option tells the script to create the image using the XE instance.
After a few minutes, the Docker image will be created. Execute
docker images to verify this.
docker images REPOSITORY TAG IMAGE ID CREATED SIZE oracle/database 18.4.0-xe 4a3df8f54b1b 56 minutes ago 8.44GB
Run the Docker image
After creating the Docker image, we can run it using the
docker run command. Execute the following:
docker run --name OracleXE -p 1521:1521 -p 5500:5500 -v /opt/oracle/oradata oracle/database:18.4.0-xe
This starts the Docker image and names the container OracleXE. Ports 1521 and 5500 are forwarded from the container to the local host.
After a few seconds / minutes, the Oracle database will be up and running as a Docker container.
docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES a79bb5a81feb oracle/database:18.4.0-xe "/bin/sh -c 'exec $O…" 42 minutes ago Up 42 minutes (healthy) 0.0.0.0:1521->1521/tcp, 0.0.0.0:5500->5500/tcp, 8080/tcp OracleXE
Since we didn't specify a password when starting the container, Oracle created a default one. This is logged to the console as:
ORACLE PASSWORD FOR SYS AND SYSTEM: **************
If you want to manually specify a password when the image is created, you can specify the
-e ORACLE_PWD parameter to the
docker run command above.
That's all there is to it. You can now run Oracle XE locally on a Mac with a minimum of trouble.