PG_CONFIG(1)
π 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 thepsqlprogram. this is normally also wherepg_configitself 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 theconfigurescript 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 theCCvariable used for building PostgreSQL. this shows you the C compiler that was used.--cppflagsβ prints the value of theCPPFLAGSvariable used for building PostgreSQL. this shows the C compiler switches needed at preprocessing time (typically,-Iswitches).--cflagsβ prints the value of theCFLAGSvariable used for building PostgreSQL. this shows C compiler switches.--cflags_slβ prints the value of theCFLAGS_SLvariable used for building PostgreSQL. this shows extra C compiler switches used for building shared libraries.--ldflagsβ prints the value of theLDFLAGSvariable used for building PostgreSQL. this shows linker switches.--ldflags_exβ prints the value of theLDFLAGS_EXvariable used for building PostgreSQL. this shows linker switches used for building executables only.--ldflags_slβ prints the value of theLDFLAGS_SLvariable used for building PostgreSQL. this shows linker switches used for building shared libraries only.--libsβ prints the value of theLIBSvariable used for building PostgreSQL. this normally contains-lswitches for external libraries linked into PostgreSQL.--versionβ prints the version of PostgreSQL. simple, clean, slay.-?,--helpβ shows help aboutpg_configcommand 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--libswere added in PostgreSQL 8.1. - The option
--htmldirwas added in PostgreSQL 8.4. - The option
--ldflags_exwas 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 πππ¦
π¦ where this page comes from
- opensuse-leap 16.0: postgresql16-server-devel 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16-server-devel 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16-server-devel 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16-server-devel 16.15-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms