# Using Shared Libraries on macOS*

This topic only applies to macOS*.

On macOS*, it is possible to store path information in shared libraries to perform library searches. The compiler installation changes the path to the installation directory, but you will need to modify these paths if you move the libraries elsewhere. For example, you may want to bundle redistributable Intel® libraries with your application. This eliminates the dependency on libraries found on `DYLD_LIBRARY_PATH`.

If your compilations do not use `DYLD_LIBRARY_PATH` to find libraries, and you distribute executables that depend on shared libraries, then you will need to modify the Intel shared libraries (../lib/*.dylib) using the install_name_tool to set the correct path to the shared libraries. This also permits the end-user to launch the application by double-clicking on the executable. The command below will modify each library with the correct absolute path information:

    for i in *.dylib
    do
        echo -change $i `pwd`/$i
        done > changes
    for i in *.dylib
    do
        install_name_tool `cat changes` $i
    done

You can also use the install_name_tool to set @executable_path to change path information for the libraries bundled in your application by changing the path appropriately.

Be sure to recompile your sources after modifying the libraries.

Parent topic: Libraries