linux - could not load library

If you see this error:

ERROR: could not load library

you may have to update the dynamic linking cache.
Here is an example.

I tried to run
$psql -f /usr/share/lwpostgis.sql -d sfmaps
and I got this error meesage
bash-3.2$ psql -f /usr/share/lwpostgis.sql -d sfmaps
BEGIN
psql:/usr/share/lwpostgis.sql:44: NOTICE: type "histogram2d" is not yet defined
DETAIL: Creating a shell type definition.
psql:/usr/share/lwpostgis.sql:44: ERROR: could not load library "/usr/lib/pgsql/liblwgeom.so": libgeos_c.so.1: cannot open shared object file: No such file or directory
followed by lots of lines like this:
psql:/usr/share/lwpostgis.sql:50: ERROR: current transaction is aborted, commands ignored until end of transaction block

It appears that libgeos_c.so.1 is not being found.
It is in fact on the system at this location - /usr/local/lib/libgeos_c.so.1
To resolve this problem, I add this line

/usr/local/lib/

to

/etc/ld.so.conf

Then run ldconfig.
Read the ldconfig man page.