Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 42 additions & 20 deletions docs/install-on-osx.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,66 @@
Install ruby-oci8 on macOS
=========================

**Note: Ruby-oci8 doesn't run on Apple Silicon because Oracle instant client
for Apple Silicon has not been released yet.**

Prerequisite
------------

* Command line tools for Xcode or Xcode (by executing `xcode-select --install`) or [Xcode]

Install Oracle Instant Client Packages
--------------------------------------

If you have installed [Homebrew], use the following command:
Download Oracle Instant Client Packages
---------------------------------------

Go [oracle site](https://www.oracle.com/database/technologies/instant-client/macos-arm64-downloads.html) and download:

* instantclient-basiclite-macos.arm64-23.3.0.23.09.dmg
* instantclient-sdk-macos.arm64-23.3.0.23.09.dmg
* instantclient-sqlplus-macos.arm64-23.3.0.23.09.dmg

```shell
$ brew tap InstantClientTap/instantclient
$ brew install instantclient-basic # or instantclient-basiclite
$ brew install instantclient-sdk
$ brew install instantclient-sqlplus # (optionally)
Mount DMG package and prepare folder
------------------------------------

```bash
hdiutil mount ~/Downloads/instantclient-basiclite-macos.arm64-23.3.0.23.09.dmg
cd /Volumes/instantclient-basiclite-macos.arm64-23.3.0.23.09
sh ./install_ic.sh
```

Otherwise, look at this [page][OTN] and set the environment variable
`OCI_DIR` to point the the directory where instant client is installed.
Ruby-oci8 installation script checks the directory.
```bash
hdiutil mount ~/Downloads/instantclient-sdk-macos.arm64-23.3.0.23.09.dmg
cd /Volumes/instantclient-sdk-macos.arm64-23.3.0.23.09
sh ./install_ic.sh
```

```shell
export OCI_DIR=$HOME/Downloads/instantclient_19_8 # for example
```bash
hdiutil mount ~/Downloads/instantclient-sqlplus-macos.arm64-23.3.0.23.09.dmg
cd /Volumes/instantclient-sqlplus-macos.arm64-23.3.0.23.09
sh ./install_ic.sh
```

```bash
sudo mv ~/Downloads/instantclient_23_3 /opt
```

Install ruby-oci8
-----------------

Note that `/usr/bin/ruby` isn't available. You need to use [`rbenv`] or so.

```shell
$ gem install ruby-oci8
```bash
cd /usr/local/bin
sudo ln -s /opt/instantclient_23_3/sqlplus sqlplus
export OCI_DIR=/opt/instantclient_23_3
gem install ruby-oci8
```


Put tnsnames.ora
----------------

```bash
export TNS_ADMIN=/opt/instantclient_23_3/network/admin/
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8 # avoid warning, optional
```

[Homebrew]: http://brew.sh/
[OTN]: https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html#ic_osx_inst
[Xcode]: https://apps.apple.com/us/app/xcode/id497799835
[`rbenv`]: https://github.com/rbenv/rbenv
2 changes: 1 addition & 1 deletion lib/oci8.rb
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
end

require 'oci8/version.rb'
if OCI8::VERSION != OCI8::LIB_VERSION
if OCI8::VERSION.split('.').take(3).join('.') != OCI8::LIB_VERSION.split('.').take(3).join('.')
require 'rbconfig'
so_name = so_basename + "." + RbConfig::CONFIG['DLEXT']
raise "VERSION MISMATCH! #{so_name} version is #{OCI8::LIB_VERSION}, but oci8.rb version is #{OCI8::VERSION}."
Expand Down