PG_CONFIG(1)

πŸ“¦ version 16.15, in opensuse-leap 16.0

πŸ’… PG_CONFIG(1) β€” the pg_config glow-up

ok so first things first: this is the man page for pg_config, and it lives in the PostgreSQL 16.15 docs. Buckle up bestie, we're going on a tour of where everything on your machine actually lives ✨


🌸 NAME 🌸

pg_config β€” like, retrieve info about the version of PostgreSQL you actually have installed. no cap, that's it, that's the whole job 🫢


✨ SYNOPSIS ✨

pg_config [option...]

πŸ¦‹ DESCRIPTION πŸ¦‹

So pg_config prints out the configuration parameters of the PostgreSQL version that's currently installed on your system. literally just tells you where stuff is and how it was built πŸ’–

Who's it for? Software packages that wanna interface with PostgreSQL β€” they use it to find the header files and libraries they need. iconic middleman energy, honestly πŸ‘‘


πŸŽ€ OPTIONS πŸŽ€

To use pg_config, you just supply one or more of these bad boys:

  • --bindir β€” prints where the user executables live. use this, for example, to find the psql program. this is normally also where pg_config itself resides, so it's giving "home address" 🏠
  • --docdir β€” prints where the documentation files are.
  • --htmldir β€” prints where the HTML documentation files are.
  • --includedir β€” prints where the C header files for the client interfaces are.
  • --pkgincludedir β€” prints where the other C header files are.
  • --includedir-server β€” prints where the C header files for server programming are.
  • --libdir β€” prints where the object code libraries are.
  • --pkglibdir β€” prints where the dynamically loadable modules are, or where the server would go looking for them. (other architecture-dependent data files might also be chilling in this directory, fyi.)
  • --localedir β€” prints where the locale support files are. (heads up: this'll be an empty string if locale support wasn't configured when PostgreSQL was built 😭)
  • --mandir β€” prints where the manual pages are. yes, the very pages you're reading bestie, meta πŸ’…
  • --sharedir β€” prints where the architecture-independent support files are.
  • --sysconfdir β€” prints where the system-wide configuration files are.
  • --pgxs β€” prints where the extension makefiles are.
  • --configure β€” prints the options that were handed to the configure script when PostgreSQL was configured for building. use this to reproduce the identical configuration, or to snoop and find out what options a binary package was built with. (but note: binary packages often contain vendor-specific custom patches, so don't expect a perfect mirror πŸ™ˆ) see also the examples below.
  • --cc β€” prints the value of the CC variable used for building PostgreSQL. this shows you the C compiler that was used.
  • --cppflags β€” prints the value of the CPPFLAGS variable used for building PostgreSQL. this shows the C compiler switches needed at preprocessing time (typically, -I switches).
  • --cflags β€” prints the value of the CFLAGS variable used for building PostgreSQL. this shows C compiler switches.
  • --cflags_sl β€” prints the value of the CFLAGS_SL variable used for building PostgreSQL. this shows extra C compiler switches used for building shared libraries.
  • --ldflags β€” prints the value of the LDFLAGS variable used for building PostgreSQL. this shows linker switches.
  • --ldflags_ex β€” prints the value of the LDFLAGS_EX variable used for building PostgreSQL. this shows linker switches used for building executables only.
  • --ldflags_sl β€” prints the value of the LDFLAGS_SL variable used for building PostgreSQL. this shows linker switches used for building shared libraries only.
  • --libs β€” prints the value of the LIBS variable used for building PostgreSQL. this normally contains -l switches for external libraries linked into PostgreSQL.
  • --version β€” prints the version of PostgreSQL. simple, clean, slay.
  • -?, --help β€” shows help about pg_config command line arguments, and exits. your lil escape hatch πŸšͺ

Okay so here's the vibe check on behavior: if you give more than one option, the information gets printed in that order, one item per line. and if you give no options at all, it prints all available information, with labels. easy πŸ’–


πŸ”₯ NOTES πŸ”₯

History lesson, but make it cute β€” some of these arrived later than others:

  • The options --docdir, --pkgincludedir, --localedir, --mandir, --sharedir, --sysconfdir, --cc, --cppflags, --cflags, --cflags_sl, --ldflags, --ldflags_sl, and --libs were added in PostgreSQL 8.1.
  • The option --htmldir was added in PostgreSQL 8.4.
  • The option --ldflags_ex was added in PostgreSQL 9.0.

they really said "we'll keep adding to the family" and honestly? growth 🌱


🌈 EXAMPLE 🌈

Wanna reproduce the build configuration of your current PostgreSQL installation? run this:

eval ./configure `pg_config --configure`

now listen, this part matters: the output of pg_config --configure contains shell quotation marks so that arguments with spaces get represented correctly. that's exactly why eval is required for proper results. skip the eval and it's not gonna go how you want it to, fr fr ⚠️

bestie do NOT forget the eval. it's not decorative. it's load-bearing.

and that's the whole page, you ate that πŸ’…βœ¨

this little masterpiece was brought to you by PostgreSQL 16.15, dated 2026, and it's the PG_CONFIG(1) page β€” go forth and find your directories, queen πŸ‘‘πŸŽ€πŸ¦‹