PG_CONFIG(1)

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

πŸ’– pg_config β€” bestie edition πŸ’–

okay so this is the manual page for pg_config, which lives in the PostgreSQL 18.6 Documentation set. yeah. it's a whole manual page. for one (1) little utility. and honestly? it eats. πŸ’…


✨ NAME ✨

pg_config β€” literally just goes and fetches info about the PostgreSQL version you have installed on your machine. that's it. that's the job. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

pg_config [option...]

🌸 DESCRIPTION 🌸

so pg_config prints out the configuration parameters of the PostgreSQL version that's currently installed. iconic behavior honestly.

and like, who is this even for? bestie, it's for software packages that wanna interface with PostgreSQL β€” it helps them find the header files and libraries they need. it's basically the friend who knows where everything is at the party. 🫢


πŸ’… OPTIONS πŸ’…

to use pg_config, you give it one or more of these. one. or more. your call, queen. πŸ‘‘

  • --bindir β€” prints where the user executables live. use this, for example, to find the psql program. this is normally also where the pg_config program itself resides. it's giving "home address" energy. 🏠
  • --docdir β€” prints where the documentation files are. πŸ“š
  • --htmldir β€” prints where the HTML documentation files are. 🌐
  • --includedir β€” prints where the C header files of the client interfaces are. πŸ”§
  • --pkgincludedir β€” prints where the other C header files are. (the rest of them. the understudies.) 🎭
  • --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 searching for them. (other architecture-dependent data files might also be installed in this directory, so like, don't be shocked.) πŸ”
  • --localedir β€” prints where the locale support files are. heads up: this will be an empty string if locale support wasn't configured when PostgreSQL was built. empty. nada. πŸ’€
  • --mandir β€” prints where the manual pages are. (hello, you are here 🫡)
  • --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 given to the configure script when PostgreSQL was configured for building. you can use this to reproduce the identical configuration, or to figure out with what options a binary package was built. ⚠️ note though: binary packages often contain vendor-specific custom patches, so it's not always a perfect match. see also the examples below. πŸ‘€
  • --cc β€” prints the value of the CC variable that was used for building PostgreSQL. this shows the C compiler used. πŸ§‘β€πŸ’»
  • --cppflags β€” prints the value of the CPPFLAGS variable that was 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 that was used for building PostgreSQL. this shows C compiler switches. 🚩
  • --cflags_sl β€” prints the value of the CFLAGS_SL variable that was used for building PostgreSQL. this shows extra C compiler switches used for building shared libraries. πŸ”₯
  • --ldflags β€” prints the value of the LDFLAGS variable that was used for building PostgreSQL. this shows linker switches. πŸ”—
  • --ldflags_ex β€” prints the value of the LDFLAGS_EX variable that was used for building PostgreSQL. this shows linker switches used for building executables only. πŸƒ
  • --ldflags_sl β€” prints the value of the LDFLAGS_SL variable that was used for building PostgreSQL. this shows linker switches used for building shared libraries only. 🧩
  • --libs β€” prints the value of the LIBS variable that was used for building PostgreSQL. this normally contains -l switches for external libraries linked into PostgreSQL. πŸ“Ž
  • --version β€” prints the version of PostgreSQL. 🏷️
  • -?, --help β€” shows help about pg_config command line arguments, and exits. bye bestie πŸ‘‹

so if you give it more than one option, the info gets printed in that order, one item per line. and if you give it no options at all? it prints all available information, with labels. everything. the whole wardrobe. 🧚


πŸ‘‘ NOTES πŸ‘‘

some lore for you, because history matters:

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.

and the option --ldflags_ex was added in PostgreSQL 9.0.

glow-up timeline. πŸ“ˆ


🌟 EXAMPLE 🌟

wanna reproduce the build configuration of the current PostgreSQL installation? run this, bestie:

eval ./configure `pg_config --configure`

the output of pg_config --configure contains shell quotation marks so that arguments with spaces are represented correctly. therefore, using eval is required for proper results. don't skip the eval. the eval is not optional. the eval is the moment. 😀


and that's the whole page, gorgeous. this was pg_config from the PostgreSQL 18.6 docs, dated 2026. go find your header files. slay. πŸ’–βœ¨πŸŽ€πŸ¦‹