Search code examples
installationsqlplusoracleclient

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!


Solution

  • 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.