How to set LD_PATH elegant?

Dan Nelson dnelson at
Fri Mar 19 22:06:34 UTC 2010

In the last episode (Mar 19), O. Hartmann said:
> I'm a little bit new to setting library paths, so sorry for the noise.
> I install some packages and libraries apart the FreeBSD package/ports
> system and need to setup the search path for shared libraries the proper
> way.
> At this very moment I 'hardcode' this additional search path by setting
> ldconfig_paths=
> in /etc/rc.conf,
> but since this is a 'system related' location I'm looking for a proper and
> clean method setting this search path via environment variable and/or some
> /usr/local/etc/rc.conf.add stuff or similar.

Create a file in /usr/local/libdata/ldconfig/ containing the directories you
want added to the ld search path.  Call it something descriptive so you know
what it's for.  /etc/rc.d/ldconfig will process those files and run ldconfig
on them on bootup.  If you've installed zsh, mysql, or firefox from ports,
you may already have a couple files in there.

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list