PG_CONFIG(1)
π 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 thepsqlprogram. this is normally also the location where thepg_configprogram 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 theconfigurescript 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 theCCvariable that was used for building PostgreSQL. this shows the C compiler used.--cppflagsβ prints the value of theCPPFLAGSvariable that was used for building PostgreSQL. this shows C compiler switches needed at preprocessing time (typically,-Iswitches).--cflagsβ prints the value of theCFLAGSvariable that was used for building PostgreSQL. this shows C compiler switches.--cflags_slβ prints the value of theCFLAGS_SLvariable that was used for building PostgreSQL. this shows extra C compiler switches used for building shared libraries.--ldflagsβ prints the value of theLDFLAGSvariable that was used for building PostgreSQL. this shows linker switches.--ldflags_exβ prints the value of theLDFLAGS_EXvariable that was used for building PostgreSQL. this shows linker switches used for building executables only.--ldflags_slβ prints the value of theLDFLAGS_SLvariable that was used for building PostgreSQL. this shows linker switches used for building shared libraries only.--libsβ prints the value of theLIBSvariable that was used for building PostgreSQL. this normally contains-lswitches for external libraries linked into PostgreSQL.--versionβ prints the version of PostgreSQL. β-?,--helpβ show help aboutpg_configcommand 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--libswere added in PostgreSQL 8.1. π - the option
--htmldirwas added in PostgreSQL 8.4. π¦ - the option
--ldflags_exwas 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. ππ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17-server-devel 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17-server-devel 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17-server-devel 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17-server-devel 17.11-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