LD_LIBRARY_PATH always blank after sudo

environment-variablesshared librarysudo

I get shared library errors whenever I seem to install software manually. Upon executing echo $LD_LIBRARY_PATH it shows up as.. nothing. I've tried adding /usr/local/lib to a .conf file in /etc/ld.so.conf.d but it seems like it never executes.

This doesn't work, either (quotes or otherwise):

LD_LIBRARY_PATH="/usr/local/lib"
export LD_LIBRARY_PATH
sudo ldconfig -v

The value will be set temporarily, but it will not retain the value if I so much as exit a terminal window. Rebooting does nothing, either.

Best Answer

Add the following to your .bashrc:

vim ~/.bashrc

...
export LD_LIBRARY_PATH=/usr/local/lib

This will let you restart your computer, and still have that path assigned.

Related Question