Oracle Database setup on M1 Mac - v22-appfactory/appfactory-wiki GitHub Wiki
This guide will walkthrough the steps to setup an Oracle database instance on the M1 Mac and connect to a Node.js application.
- Uninstall Docker desktop if it is already installed.
- Using Homebrew or another package manager, install Colima. More info at https://github.com/abiosoft/colima
# Homebrew
brew install colima
# MacPorts
sudo port install colima
# Nix
nix-env -iA nixpkgs.colima
- Reinstall Docker desktop
- Confirm you are in the correct docker context by running:
docker context ls
- Start a Colima instance with at least 21 GB of disk space and 2 GB of memory.
colima start --cpu 1 --memory 2 --disk 21
- Navigate to the Oracle container registry and create a free account if you do not have one.
- Go to the enterprise database container page and accept the user license agreement for the database container.
- Login to Oracle through Docker in your terminal.
- Pull and start a prebuilt Oracle database image from the Oracle image repository by running command:
docker run -d --name <container_name> \
-p <host_port>:1521 -p <host_port>:5500 \
-e ORACLE_SID=<your_SID> \
-e ORACLE_PDB=<your_PDBname> \
-e ORACLE_PWD=<your_database_password> \
-v [<host_mount_point>:]/opt/oracle/oradata \
container-registry.oracle.com/database/enterprise:19.3.0.0
Note: This container will take a while to start, around 45 minutes to 1 hour. After a successful start, the container status will be ‘healthy’
- Uninstall all versions of Node.js
- Install Rosetta 2 if not already installed
- Run the following install command from a native (ARM) terminal:
# See https://github.com/nvm-sh/nvm#installing-and-updating
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
# Don't forget to source the command in your shell profile to make it available in new terminals!
- From Rosetta Terminal (tick checkbox in Terminal right click menu -> Get Info -> Open using Rosetta)
- To verify you are running in Rosetta run:
arch
-> i386
- Install node. Run:
nvm install lts/fermium
# Verify node installation
nvm use lts/fermium
node -e 'console.log(process.arch)'
-> x64
- Open a native terminal if not open already, verify you are running natively:
arch
-> arm64
- Install Node
nvm install stable
- Verify installation:
nvm use stable
node -e 'console.log(process.arch)'
-> arm64
# To make DX a bit better you can alias your installations:
nvm alias arm stable
# arm -> stable (-> v15.6.0)
nvm alias intel lts/fermium
# intel -> lts/fermium (-> v14.15.4)
# To test aliases:
nvm use arm
# Now using node v15.6.0 (npm v7.4.0)
node -e 'console.log(process.arch)'
-> arm64
nvm use intel
# Now using node v14.15.4 (npm v6.14.10)
node -e 'console.log(process.arch)'
-> x64
- Download Instant Client from Oracle.
- Follow install instructions on the bottom of the same link as the download.
NOTE: make sure you are using a Rosetta terminal for this install.
- Use lts/fermium version of installed node.js
- Run ‘npm install node-oracledb’. Note: if using TypeOrm or Knee.js, node-oracledb is included and you only need to install one of those ORM’s
Further reading: