# teaching M2 how to find its shared libraries

Perhaps you know that your M2 executable is located at /foo/bar/bin/M2, say, but when you run it, you get something like this:
    /foo/bar/bin/M2
M2: error while loading shared libraries: liblapack.so: cannot open shared object file: No such file or directory
What that means is that M2 hasn't been told where its shared libraries are. Actually, it's the operating system that has to be told, since otherwise M2 can't even start up. Hopefully, the missing shared libraries are located in /foo/bar/lib, and all we have to do is to tell the operating system by setting the environment variable LD_LIBRARY_PATH, if you are running a Unix operating system. If you have downloaded a version of Macaulay2 that comes with dynamically loaded libraries of its own, they will be in the directory /foo/bar/lib/Macaulay2/lib/lib/. After setting LD_LIBRARY_PATH temporarily you may use setup to record the correct value in your system start up files.

Alternatively, you may be getting something like this:

    \$ /foo/bar/bin/M2
Trace/BPT trap