PG_CONFIG(1)

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

πŸŽ€ PG_CONFIG(1) πŸŽ€

okay so bestie, welcome to the <pink>pg_config</pink> page β€” this is the <purple>PostgreSQL 17.11 Documentation</purple> glow-up of the classic man page, and it's genuinely so useful once you get it. sit down, grab a strawberry πŸ“, let's go.


✨ NAME ✨

pg_config β€” retrieve information about the installed version of PostgreSQL πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

pg_config [option...]

🌸 DESCRIPTION 🌸

okay so <pink>pg_config</pink> is literally the "hey what's my setup actually" utility. it prints configuration parameters of the currently installed version of PostgreSQL. πŸ“‹

who's it for? it's intended, for example, to be used by software packages that want to interface to PostgreSQL, to make finding the required header files and libraries way easier. like, no more guessing, the tool just tells you. iykyk. 🫢


πŸ’– OPTIONS πŸ’–

to use pg_config, supply one or more of the following options:

  • --bindir β€” prints the location of user executables. use this, for example, to find the psql program. this is normally also the location where the pg_config program itself resides. ✨
  • --docdir β€” prints the location of documentation files. πŸ“š
  • --htmldir β€” prints the location of HTML documentation files. 🌐
  • --includedir β€” prints the location of C header files of the client interfaces.
  • --pkgincludedir β€” prints the location of other C header files.
  • --includedir-server β€” prints the location of C header files for server programming. πŸ–₯️
  • --libdir β€” prints the location of object code libraries.
  • --pkglibdir β€” prints the location of dynamically loadable modules, or where the server would search for them. (other architecture-dependent data files might also be installed in this directory, jsyk.)
  • --localedir β€” prints the location of locale support files. (this will be an empty string if locale support was not configured when PostgreSQL was built β€” so if you get nothing back, that's why, don't panic 😭)
  • --mandir β€” prints the location of manual pages. πŸ“–
  • --sharedir β€” prints the location of architecture-independent support files.
  • --sysconfdir β€” prints the location of system-wide configuration files.
  • --pgxs β€” prints the location of extension makefiles.
  • --configure β€” prints the options that were given to the configure script when PostgreSQL was configured for building. this can be used to reproduce the identical configuration, or to find out with what options a binary package was built. (note however that binary packages often contain vendor-specific custom patches.) 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 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 β€” show help about pg_config command line arguments, and exit. 🫢
bestie, quick vibe check: if more than one option is given, the information is printed in that order, one item per line. and if no options are given at all, all available information is printed, with labels. πŸ’…

πŸ’€ NOTES πŸ’€

history lesson, but make it fun β€” here's when stuff got added:

  • 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. 🌈

πŸ”₯ EXAMPLE πŸ”₯

to reproduce the build configuration of the current PostgreSQL installation, run the following command:

eval ./configure `pg_config --configure`

okay and this part matters, fr fr: the output of pg_config --configure contains shell quotation marks so arguments with spaces are represented correctly. therefore, using eval is required for proper results. don't skip the eval, it's not optional, it's the whole point. πŸ™ˆ


✨ and that's the whole page bestie, you ate that ✨

πŸŽ€ sign-off time: this iconic piece of documentation comes from <purple>PostgreSQL 17.11</purple> and it's dated 2026` β€” periodt. πŸ‘‘πŸ’œ