0

The title pretty much says it all: How can I install an Apple Silicon (ARM) native version of Oracle’s InstantClient (OCI8) for use with MAMP?

As I understand it, Oracle has not released an official Apple Silicon (ARM) native version of their InstantClient (OCI8). This is a pain, and it means that I have to use the Intel native version of MAMP that will run via translation via Rosetta 2. And I have to install the Intel version of Oracle’s InstantClient (OCI8) to get it to work.

I’m not obsessed with speed since I use MAMP for general development purposes, but I would like to have a cleaner install process for MAMP than what I currently have to do; kludge MAMP’s Intel installer to force it to install on my MacBook Air (M2; 2022).

How can this be done?

1 Answer 1

2

Hooray! As of June 24, 2024 Oracle has finally released an Apple Silicon (ARM) binary of their InstantClient (OCI8). Official blog post of the announcement can be found here:

It has been a long wait, but it is finally here!
The macOS ARM64 Oracle Instant Client for Oracle Database compatible with Apple M1/M2/M3 machines is now available!

The downloads can be found here: Oracle Instant Client Downloads for macOS (ARM64).

In the case of MAMP, you need to download and install basic client as well as the SDK which can be found here; here are direct download links:

As far as installing in on macOS for use with MAMP, it is pretty much the same procedure as the Intel version. Those instructions are presented below for easy reference.

Install MAMP and set it up in your Bash $PATH.

On a most basic level, first download and install MAMP here. These instructions are based on installing MAMP 6.9, so here is a direct download link for MAMP 6.9 for Apple Silicon here.

Once that is done, edit your .bash_profile file like this; I use nano .bash_profile to edit it and add these lines in an appropriate place:

# MAMP stuff.
export MAMP_BIN="/Applications/MAMP/Library/bin";
# export MAMP_PHP="/Applications/MAMP/bin/php/php7.4.33/bin";
export MAMP_PHP="/Applications/MAMP/bin/php/php8.2.0/bin";

# Final $PATH setting.
# export PATH="/usr/local/bin:/usr/local/sbin:$PATH";
export PATH="/usr/local/bin:/usr/local/sbin:$MAMP_BIN:$MAMP_PHP:$PATH";

Note I have two entries for export MAMP_PHP since MAMP always has two options for PHP installed. Choosing to use PHP 8.2.0 in this example since it is more recent than PHP 7.4.33.

Once that is setup, exit the Terminal and then reopen it and type which php, the path to PHP that should be returned is:

/Applications/MAMP/bin/php/php8.2.0/bin/php

Install the Oracle InstantClient (OCI8).

NOTE: Oracle has some very basic install scripts with their binaries, but I don’t like using them because the install the InstantClient into your Downloads/ directory; which seems frankly ridiculous. I use this method instead which I think is cleaner/saner.

Now, within the Terminal, run this command to create a safe destination path for the Oracle InstantClient stuff here:

sudo mkdir -p /opt/oracle/instantclient/instantclient_23_3

Since that is a sudo command, it will ask for an administrator’s password. But once that is done, move onto the next step.

Mount the two DMG files by double-clicking on them. Once they are mounted, run these two cp commands:

sudo cp -RPf /Volumes/instantclient-basic-macos.arm64-23.3.0.23.09/* /opt/oracle/instantclient/instantclient_23_3
sudo cp -RPf /Volumes/instantclient-sdk-macos.arm64-23.3.0.23.09/sdk /opt/oracle/instantclient/instantclient_23_3

And the Oracle InstantClient (OCI8) should be installed. You can confirm by running this command:

ls -la  /opt/oracle/instantclient/instantclient_23_3

If the contents look like the below output, you are good to go!

total 551896
drwxr-xr-x@ 49 root  wheel       1568 Aug 13 14:55 .
drwxr-xr-x   3 root  wheel         96 Aug 13 14:49 ..
-r--r--r--@  1 root  wheel       6506 Aug 13 14:54 BASIC_LICENSE
-r--r--r--@  1 root  wheel        455 Aug 13 14:54 BASIC_README
-r-xr-xr-x@  1 root  wheel        548 Aug 13 14:54 INSTALL_IC_README.txt
-r-xr-xr-x@  1 root  wheel     112000 Aug 13 14:54 adrci
-r-xr-xr-x@  1 root  wheel    1335376 Aug 13 14:54 fips.dylib
-r-xr-xr-x@  1 root  wheel     129264 Aug 13 14:54 genezi
-r-xr-xr-x@  1 root  wheel       1072 Aug 13 14:54 install_ic.sh
-r-xr-xr-x@  1 root  wheel    3205968 Aug 13 14:54 legacy.dylib
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.10.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.11.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.12.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.18.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.19.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.20.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.21.1 -> libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         20 Aug 13 14:54 libclntsh.dylib.22.1 -> libclntsh.dylib.23.1
-r-xr-xr-x@  1 root  wheel   51248032 Aug 13 14:54 libclntsh.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.12.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.18.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.19.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.20.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.21.1 -> libclntshcore.dylib.23.1
lrwxr-xr-x@  1 root  wheel         24 Aug 13 14:54 libclntshcore.dylib.22.1 -> libclntshcore.dylib.23.1
-r-xr-xr-x@  1 root  wheel    2663552 Aug 13 14:54 libclntshcore.dylib.23.1
-r-xr-xr-x@  1 root  wheel    5577424 Aug 13 14:54 libnnz.dylib
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.10.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.11.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.12.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.18.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.19.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.20.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.21.1 -> libocci.dylib.23.1
lrwxr-xr-x@  1 root  wheel         18 Aug 13 14:54 libocci.dylib.22.1 -> libocci.dylib.23.1
-r-xr-xr-x@  1 root  wheel     793232 Aug 13 14:54 libocci.dylib.23.1
-r-xr-xr-x@  1 root  wheel  198179664 Aug 13 14:54 libociei.dylib
-r-xr-xr-x@  1 root  wheel     235344 Aug 13 14:54 libocijdbc23.dylib
drwxr-xr-x@  3 root  wheel         96 Aug 13 14:54 network
-r--r--r--@  1 root  wheel    7105082 Aug 13 14:54 ojdbc11.jar
-r--r--r--@  1 root  wheel    6977779 Aug 13 14:54 ojdbc8.jar
-r-xr-xr-x@  1 root  wheel    3240448 Aug 13 14:54 pkcs11.dylib
drwxr-xr-x@  7 root  wheel        224 Aug 13 14:55 sdk
-r--r--r--@  1 root  wheel    1483267 Aug 13 14:54 ucp.jar
-r-xr-xr-x@  1 root  wheel     197728 Aug 13 14:54 uidrvci
-r--r--r--@  1 root  wheel      32663 Aug 13 14:54 xstreams.jar

Compiling and installing the Oracle InstantClient (OCI8) module for PHP.

Okay, with MAMP installed and the Oracle InstantClient (OCI8) installed, we now move onto actually compiling the oci8.so module for PHP.

Run this command:

pecl install oci8

And hang on while the oci8.so module compiles!

During the install you might be asked to provide the ORACLE_HOME path via a message like this:

Please provide the path to the ORACLE_HOME directory. Use
'instantclient,/path/to/instant/client/lib' if you're compiling with Oracle Instant Client [autodetect] :

We are not permanently setting ORACLE_HOME, so just use this as the path:

instantclient,/opt/oracle/instantclient/instantclient_23_3

After PECL does its thing, the oci8.so should be compiled and ready to go.

Installing the InstantClient (OCI8) module in PHP.

Now adjust the PHP config file (php.ini) like this to get PHP to recognize it. Open up the php.ini like this:

nano /Applications/MAMP/bin/php/php8.2.0/conf/php.ini

And add this stuff to the bottom of the file:

[OCI8]
extension=oci8.so

Now start MAMP again and check the output of the PHP info page (http://localhost:8888/MAMP/phpinfo.php) and OCI8 should now be clearly listed there under installed components; screenshot below: PHP info in MAMP showing OCI8 3.4.0 is installed.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .