Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dyld: Library not loaded - sqlplus installation

I want to install sqlplus on my Mac. So, first I downloaded two files from this link https://www.oracle.com/technetwork/topics/intel-macsoft-096467.html these two file:

  1. instantclient-basic-macos.x64-18.1.0.0.0.zip

  2. instantclient-sqlplus-macos.x64-18.1.0.0.0.zip

Then, I moved these files.zip on my desktop and from my terminal I wrote these commands:

unzip /Users/nietmochi/Desktop/instantclient-basic-macos.x64-18.1.0.0.0.zip

and

unzip /Users/nietmochi/Desktop/instantclient-sqlplus-macos.x64-18.1.0.0.0.zip

and then:

export PATH=/Users/nietmochi/Desktop/instantclient_18_1:$PATH

and:

which sqlplus

Now, when I try to launch sqlplus with the command sqlplus, I have this message:

dyld: Library not loaded: @rpath/libclntsh.dylib.18.1
  Referenced from: /Users/nietmochi/Desktop/instantclient_18_1/sqlplus
  Reason: image not found
Abort trap: 6

Why? How to fix it?

Thanks a lot!

like image 728
Sam Avatar asked Sep 15 '26 19:09

Sam


2 Answers

The error suggests that your ~/Desktop/instantclient_18_1 directory only has the contents of the instantclient-sqlplus-macos.x64-18.1.0.0.0.zip file. I suspect you've tried this several times from various locations, and you've ended up with a mix of partial and full installations, and you're happening to pick up a partial one.

When you do:

unzip /Users/nietmochi/Desktop/instantclient-basic-macos.x64-18.1.0.0.0.zip
unzip /Users/nietmochi/Desktop/instantclient-sqlplus-macos.x64-18.1.0.0.0.zip

then both zip archives should be expanded into the same instantclient_18_1 directory, which will be in your current working directory. If you didn't change to ~/Desktop before running then that could be anywhere...

I'd suggest you start again. Find and remove any directories called instantclient_18_1, from your home directory, ~/Desktop, ~/Downloads etc., anywhere you can find them; mostly just to avoid confusion.

Then, since your zip files are currently on the desktop, for simplicity for now do:

cd ~/Desktop
unzip instantclient-basic-macos.x64-18.1.0.0.0.zip
ls instantclient_18_1 | wc -l
unzip instantclient-sqlplus-macos.x64-18.1.0.0.0.zip
ls instantclient_18_1 | wc -l

The first ls should give you a count of 18 files. The second should give you a count of 23 files.

Once you have done that then sqlplus should work, using the PATH you've already modified.

You can put that instantclient_18_1 directory anywhere you want, as long as your PATH refers to it, and you can add setting your path to your ~/.bash_profile file so you don't have to do that manually in future.

like image 67
Alex Poole Avatar answered Sep 19 '26 21:09

Alex Poole


Installation has changed with 19c which introduced signed DMG packages. See Notarized macOS Oracle Instant Client Packages Make Installation Easier:

  • Download desired DMG packages from Oracle.

  • In Finder, double click on all desired Instant Client .dmg packages to mount them

  • Open a terminal window and change directory to one of the packages, for example:

    $ cd /Volumes/instantclient-basic-macos.x64-19.8.0.0.0dbru
    
  • Run the install_ic.sh script:

    $ ./install_ic.sh
    

    This copies the contents of all currently mounted Instant Client .dmg packages to $HOME/Downloads/instantclient_19_8

  • If you have multiple DMG packages mounted, you only need to run install_ic.sh once

  • In Finder, eject the mounted Instant Client packages

If you want a script that does the download and install automatically, see the blog post Notarized macOS Oracle Instant Client Packages Make Installation Easier.

When in doubt, follow the installation instructions which are on the page you download Instant Client from.

like image 40
Christopher Jones Avatar answered Sep 19 '26 20:09

Christopher Jones



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!