Skip to main content

This page gives some essential instructions about building pgModeler from source, installing, and running it on all supported platforms. Please, read it carefully and avoid skipping any steps below even if you're an experienced user in compiling softwares from the source. If you stumble on any problem just ask for help at Github issues page by posting as many as possible details about it so the correct support can be provided. Finally, if you find any error in this document, please report it so the proper fixes can be applied. All suggestions or constructive criticisms to make the building steps easier to understand are welcome!

  • Requirements overview

    On all supported platforms, the first requirement is the Qt framework in at least the version 6.4.x. At the moment these instructions were being updated, Qt 6.9.2 was the latest stable version. Make sure to use a compatible version to avoid any further problems in the steps below. Bear in mind that failing to observe this first requirement in most cases will cause the compilation to fail due to incompatibilities between the pgModeler's source code and the Qt framework, or even the deployment steps below may not be enough to make the software work after a successful build.

    Second, you will need a PostgreSQL server installation. In this document we are using the RDBMS in its version 17, so note that the location of headers and libraries in the settings below may vary depending on the version of the database system you've chosen.

    Finally, you will need to download a fresh copy of pgModeler's source code. See the source download form for more details about retrieving the source code. Once retrieved the source code, extract it (in case of using a tarball) and run all the commands in the below sections from the root folder.


    Important notes

    1) Some Linux distros already deliver Qt framework runtime libraries and development packages, but in some few cases, the system installs different versions of the framework causing incompatibilities during the execution of the compilation procedures, so in order to make this step-by-step as simple as possible make sure to be using the Qt version compatible with the codebase being built.

    2) Due to the constant improvements in the Qt framework some deprecation warnings may be displayed during the building process. These warnings are harmless in 99.9% of the time but if the build is aborted due to errors that may point out some incompatibility, please, report it as soon as possible so a patch can be applied to pgModeler's source.

  • Platform specific requirements

    1) Qt framework: in the majority of Linux distros the Qt framework is provided by their package repositories, just make sure to install the runtime libraries and development packages. For these procedures, please refer to your preferred distro's docs for more information about the installation of the framework. To check if Qt is correctly installed run the command in the line (1) below in the console. If the result is similar to the line (2) then Qt framework is already installed. If an error is returned you need to check the installation.

    1: $QTPATHS_ROOT/qtpaths --install-prefix
    2: /opt/qt/[version]/gcc_64

    The $QTPATHS_ROOT represents a placeholder for the path where the qtpaths tool resides in your system. If you installed Qt from your distro's package repository, then qtpaths is certainly installed at /usr/bin. Now, if you have installed Qt from the official installer distributed by qt.io, by default, it is installed at /opt/qt/[version]/gcc_64, so, in that case, qtpaths tool is found at /opt/qt/[version]/gcc_64/bin/qtpaths. Replace the placeholder accordingly.

    2) CMake build system: pgModeler relies on cmake to build and install its executables and libraries. This command can be found in your preferred distro's software repository. If you are using the official Qt installer, the cmake is found by default at /opt/qt/[version]/Tools/Cmake/bin

    3) Clang or GCC compiler: pgModeler is coded in C++ language, so make sure to have a version of the mentioned compilers installed that supports C++ 17 in order to enable full language support. See the pages C++ Support in Clang and C++ Standards Support in GCC for more details.

    4) PostgreSQL client library: the communication between pgModeler and a database server is made through the PostgreSQL client interface called libpq. The library installation details are retrieved via pkg­-config command during compile time so to check if everything is okay run the command on line (1) in the console. If the result is similar to the line (2) then library is correctly installed. In case of an error is returned you need to check the installation.

    1: pkg-config libpq --cflags --libs
    2: -I/usr/include -L/usr/lib64/libpq.so


    5) XML2 library: generally the runtime files are already installed but the needed headers are absent in most cases. Make sure to access your distro's software management and install the development packages for XML2 which bundles the source code and libraries for compilation purposes. To check if the library is correctly installed run the command in the line (1) below in the console. If the result is similar to the line (2) then libxml2 is already installed. In case of an error is returned you need to check the installation.

    1: pkg-config libxml­2.0 --cflags --libs
    2: -I/usr/include/libxml2 -lxml2

    To make the compilation easier on Windows systems we recommend the use of MSYS2 which consists in a software distro and building platform which facilitates the installation of the needed packages and their dependencies including Qt framework and PostgreSQL. First, install MSYS2 64 bits and open the MSYS2 MinGW 64-bit available under MSYS2 group at Windows' start menu.

    Then run the following commands in the correct order. Lines (1) and (2) are intentionally duplicated and need to be executed if you're running MSYS2 for the first time. To avoid typos copy the lines below and paste them on the console. NOTE: You can replace the package mingw-w64-x86_64-clang by mingw-w64-x86_64-gcc if you prefer GCC over Clang.

    1: pacman -Suy
    2: pacman -Suy
    3: pacman -S base-devel mingw-w64-x86_64-cmake mingw-w64-x86_64-clang mingw-w64-x86_64-postgresql mingw-w64-x86_64-qt6

    1) Qt framework: since macOS doesn't come with this toolkit installed by default, download and install it from the official project's web site.

    2) CMake build system: on macOS, the cmake is found under the folder Tools in the Qt's installation path.

    2) Xcode: the development toolkit for macOS. The minimum requirement is the version 15.4 (Sequoia), but it's recommended to use the latest available because, depending on the Qt version, the compilation will fail mainly due to incomplete framework support on a specific macOS SDK.

    3) XML2 library: if you have installed Xcode correctly the needed headers and libraries are installed as well. You'll just need to change a few lines in the building script (see the next section).

    4) PostgreSQL client library: for practical reasons on macOS, the installers provided by EnterpriseDB are strongly recommended since they bundle all the needed headers and libraries.

  • Tweaking the building script (macOS only)

    If you are compiling pgModeler on macOS and installed a PostgreSQL version other than the default used in this step-by-step, there is a preliminary adjust to be made before running the main compilation command. You need to configure the location of the PostgreSQL headers and libraries by editing the file DefaultPaths.cmake. Assuming that you've already got the tool's source code, open the mentioned file in your favorite text editor and locate the following lines:

    if(APPLE)
    	set(PGSQL_INC /Library/PostgreSQL/17/include)
    	set(PGSQL_LIBS /Library/PostgreSQL/17/lib/libpq.dylib)
    
    	set(XML2_INC /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/libxml2)
    	set(XML2_LIBS /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libxml2.tbd)
    else()
    ...
    

    You need to change the values of the variables PGSQL_LIB, PGSQL_INC. These variables tell the compiler where to find the headers and libraries for libpq. Update the values according to the location of the files or folders in your system. Save the file and proceed to the next step.

  • Building the software

    We are now able to run the main building process. This step differs a bit on each operating system and it is described below. All the commands must be executed inside the console and from the root of the pgModeler's source code folder. In Windows system remember to run the commands from the MSYS2 MinGW 64-bit console available under MSYS2 group at start menu.

    In the following procedures, to shorten the commands, we are assuming that $QT_ROOT is the full path to the Qt installation which is the same as that one returned by qtpaths command in the section Platform specific requirements above.

    Finally, the $CMAKE_ROOT is where the cmake is installed. In the commands below, don't forget to replace the variables with the real paths according to your system otherwise the build will fail.


    $CMAKE_ROOT/cmake -S . -B ./cmake-build \
                      -DCMAKE_PREFIX_PATH=$QT_ROOT -DCMAKE_BUILD_TYPE=Release \
                      -DPGM_PREFIX=/opt/pgModeler --fresh CMakeList.txt
    $CMAKE_ROOT/cmake --build ./cmake-build --target all
    $CMAKE_ROOT/cmake --install ./cmake-build/
    
    qmake-qt6 -r CONFIG+=release PREFIX=$INSTALLATION_ROOT pgmodeler.pro
    make
    make install
    cd $INSTALLATION_ROOT
    windeployqt-qt6 pgmodeler.exe gui.dll
    
    $CMAKE_ROOT/cmake -S . -B ./cmake-build/ \
                      -DCMAKE_PREFIX_PATH=$QT_ROOT -DCMAKE_BUILD_TYPE=Release \
                      -DPGM_PREFIX=/Applications/pgModeler.app/Contents --fresh CMakeList.txt
    $CMAKE_ROOT/cmake --build ./cmake-build --target all													 
    $CMAKE_ROOT/cmake --install ./cmake-build/
    $QT_ROOT/bin/macdeployqt /Applications/pgModeler.app \
                             /Applications/pgModeler.app/Contents/MacOS/pgmodeler-ch \
                             /Applications/pgModeler.app/Contents/MacOS/pgmodeler-cli
    

  • Resolving dependencies

    After successfully compiling the source code and installing the binaries we need to copy some dependencies into the pgModeler's installation folder and run some commands to make the binaries locate them properly. As the previous section, in the steps below replace the variable $INSTALLATION_ROOT by the path were pgModeler is now installed. The variable $PGSQL_ROOT must be replaced by the full path to PostgreSQL's installation folder. The variable $MSYS2_ROOT must be replaced by the full path to MSYS2 installation (only for Windows).

    Note to Windows users: Since pgModeler building relies on MSYS2 infrastructure, depending on the version of the latter in your system, the DLLs to be copied in the steps below may not be enough. So, the recommendation is that you run the copy commands below as is and try to run pgModeler in the destination folder. If any error regarding to a missing DLL is reported you can copy that one DLL from MSYS2 folder to pgModeler's installation path. This procedure must be repeated until the software runs without errors. Please, don't forget to report which DLLs are missing so this step-by-step can be updated accordingly.


    echo -e "[Paths]\nPrefix=.\nPlugins=lib/qtplugins\nLibraries=lib" > /opt/pgModeler/qt.conf
    
    cd $QT_ROOT/lib
    
    cp libQt6DBus.so.6 libQt6PrintSupport.so.6 libQt6Widgets.so.6 libQt6Network.so.6 libQt6Gui.so.6 \
       libQt6Core.so.6 libQt6XcbQpa.so.6 libQt6Svg.so.6 libicui18n.so.* libicuuc.so.* libicudata.so.* \
       /opt/pgModeler/lib
    
    cd $QT_ROOT/plugins
    cp -r iconengines/ /opt/pgModeler/lib/qtplugins/
    cp -r imageformats/ /opt/pgModeler/lib/qtplugins/
    cp -r platforminputcontexts/ /opt/pgModeler/lib/qtplugins/
    mkdir /opt/pgModeler/lib/qtplugins/platforms
    cp -r platforms/libqxcb.so platforms/libqoffscreen.so /opt/pgModeler/lib/qtplugins/platforms
    cp -r printsupport/ /opt/pgModeler/lib/qtplugins/
    cp -r tls/ /opt/pgModeler/lib/qtplugins/
    cp -r xcbglintegrations/ /opt/pgModeler/lib/qtplugins/
    
    echo -e "[Paths]\nPrefix=.\nPlugins=qtplugins\nLibraries=." > $INSTALLATION_ROOT/qt.conf
    
    cd $MSYS2_ROOT/mingw64/bin/
    
    cp D3Dcompiler_47.dll libb2-1.dll libbrotlicommon.dll libbrotlidec.dll libbz2-1.dll libcrypto-3-x64.dll \
       libdouble-conversion.dll libfreetype-6.dll libgcc_s_seh-1.dll libglib-2.0-0.dll libgraphite2.dll \
       libharfbuzz-0.dll libiconv-2.dll libicudt*.dll libicuin*.dll libicuuc*.dll libintl-8.dll liblzma-5.dll \
       libmd4c.dll libpcre2-8-0.dll libpcre2-16-0.dll libpng16-16.dll libpq.dll libssl-3-x64.dll libstdc++-6.dll \
       libwinpthread-1.dll libxml2-2.dll libzstd.dll zlib1.dll $INSTALLATION_ROOT
    
    mkdir $INSTALLATION_ROOT/qtplugins/tls
    
    cp -r $MSYS2_ROOT/mingw64/share/qt6/plugins/platforms/tls/* $INSTALLATION_ROOT/qtplugins/tls
    
    cp $PGSQL_ROOT/lib/libpq*.dylib $PGSQL_ROOT/lib/libintl*.dylib \
       $PGSQL_ROOT/lib/libssl*.dylib $PGSQL_ROOT/lib/libcrypto*.dylib \
       $PGSQL_ROOT/lib/libgssapi_krb5.*.dylib $PGSQL_ROOT/lib/libkrb5.*.dylib \
       $PGSQL_ROOT/lib/libk5crypto.*.dylib $PGSQL_ROOT/lib/libcom_err.*.dylib \
       $PGSQL_ROOT/lib/libkrb5support.*.dylib $PGSQL_ROOT/lib/libiconv.*.dylib \
       /Applications/pgModeler.app/Contents/Frameworks
    
    install_name_tool -change "@loader_path/../lib/libssl.3.dylib" "@executable_path/../Frameworks/libssl.3.dylib" /Applications/pgModeler.app/Contents/Frameworks/libpq.5.dylib
    install_name_tool -change "@loader_path/../lib/libcrypto.3.dylib" "@executable_path/../Frameworks/libcrypto.3.dylib" /Applications/pgModeler.app/Contents/Frameworks/libpq.5.dylib
    install_name_tool -change "@loader_path/../lib/libcrypto.31.dylib" "@executable_path/../Frameworks/libcrypto.3.dylib" /Applications/pgModeler.app/Contents/Frameworks/libpq.5.dylib
    install_name_tool -change "@loader_path/../lib/libgssapi_krb5.2.2.dylib" "@executable_path/../Frameworks/libgssapi_krb5.2.2.dylib" /Applications/pgModeler.app/Contents/Frameworks/libpq.5.dylib
    install_name_tool -change "@loader_path/../lib/libcrypto.3.dylib" "@executable_path/../Frameworks/libcrypto.3.dylib" /Applications/pgModeler.app/Contents/Frameworks/libssl.3.dylib
    install_name_tool -change "@loader_path/../lib/libkrb5.3.3.dylib" "@executable_path/../Frameworks/libkrb5.3.3.dylib" /Applications/pgModeler.app/Contents/Frameworks/libgssapi_krb5.2.2.dylib
    install_name_tool -change "@loader_path/../lib/libcom_err.3.0.dylib" "@executable_path/../Frameworks/libcom_err.3.0.dylib" /Applications/pgModeler.app/Contents/Frameworks/libgssapi_krb5.2.2.dylib
    install_name_tool -change "@loader_path/../lib/libcom_err.3.0.dylib" "@executable_path/../Frameworks/libcom_err.3.0.dylib" /Applications/pgModeler.app/Contents/Frameworks/libkrb5.3.3.dylib
    install_name_tool -change "@loader_path/../lib/libintl.8.dylib" "@executable_path/../Frameworks/libintl.8.dylib" /Applications/pgModeler.app/Contents/Frameworks/libgssapi_krb5.2.2.dylib
    install_name_tool -change "@loader_path/../lib/libintl.8.dylib" "@executable_path/../Frameworks/libintl.8.dylib" /Applications/pgModeler.app/Contents/Frameworks/libkrb5.3.3.dylib
    install_name_tool -change "@loader_path/../lib/libintl.8.dylib" "@executable_path/../Frameworks/libintl.8.dylib" /Applications/pgModeler.app/Contents/Frameworks/libk5crypto.3.1.dylib
    install_name_tool -change "@loader_path/../lib/libintl.8.dylib" "@executable_path/../Frameworks/libintl.8.dylib" /Applications/pgModeler.app/Contents/Frameworks/libcom_err.3.0.dylib
    install_name_tool -change "@loader_path/../lib/libintl.8.dylib" "@executable_path/../Frameworks/libintl.8.dylib" /Applications/pgModeler.app/Contents/Frameworks/libkrb5support.1.1.dylib
    install_name_tool -change "@loader_path/../lib/libiconv.2.dylib" "@executable_path/../Frameworks/libiconv.2.dylib" /Applications/pgModeler.app/Contents/Frameworks/libintl.8.dylib
    install_name_tool -change "@loader_path/../lib/libk5crypto.3.1.dylib" "@executable_path/../Frameworks/libk5crypto.3.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libgssapi_krb5.2.2.dylib
    install_name_tool -change "@loader_path/../lib/libk5crypto.3.1.dylib" "@executable_path/../Frameworks/libk5crypto.3.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libkrb5.3.3.dylib
    install_name_tool -change "@loader_path/../lib/libkrb5support.1.1.dylib" "@executable_path/../Frameworks/libkrb5support.1.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libgssapi_krb5.2.2.dylib
    install_name_tool -change "@loader_path/../lib/libkrb5support.1.1.dylib" "@executable_path/../Frameworks/libkrb5support.1.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libkrb5.3.3.dylib
    install_name_tool -change "@loader_path/../lib/libkrb5support.1.1.dylib" "@executable_path/../Frameworks/libkrb5support.1.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libk5crypto.3.1.dylib
    install_name_tool -change "@loader_path/../lib/libkrb5support.1.1.dylib" "@executable_path/../Frameworks/libkrb5support.1.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libkrb5support.1.1.dylib
    install_name_tool -change "@loader_path/../lib/libkrb5support.1.1.dylib" "@executable_path/../Frameworks/libkrb5support.1.1.dylib" /Applications/pgModeler.app/Contents/Frameworks/libcom_err.3.0.dylib
    
    codesign --force --deep --sign - /Applications/pgModeler.app
    

  • Running pgModeler

    Finally, pgModeler can be started. Just open the installation folder and double click the application pgmodeler.exe (Windows), pgmodeler (Linux) or pgmodeler.app (macOs) and have fun.

    Enjoy!


  • Environment variables

    pgModeler uses eleven custom environment variables in order to keep track of its resource files, directories, and executables. You seldom need to use them but if you want to configure different locations of these resources you must specify them before running the tool. Each variable has a special meaning and they are described as follows:

    Variable Description
    PGMODELER_SCHEMAS_DIR Stores the path to the schemas folder. This folder contains all the files needed to generate SQL and XML code.
    PGMODELER_CONF_DIR Stores the path to the conf folder. This folder contains all the configuration files for the current user.
    PGMODELER_TMPL_CONF_DIR Stores the path to the template conf folder. This folder is contains all the template configuration files that are copied for all users.
    PGMODELER_LANG_DIR Stores the path to the lang folder. This folder contains all available UI translations.
    PGMODELER_PLUGINS_DIR Stores the path to the plugins folder. This folder contains all the available plug­ins.
    PGMODELER_TMP_DIR Stores the path to the tmp folder. This folder is used by pgModeler to write temporary models as well as log files for certain operations.
    PGMODELER_SAMPLES_DIR Stores the path to the samples folder. This folder contains the samples models.
    PGMODELER_CH_PATH Stores the path to the crash handler executable called pgmodeler-ch.
    PGMODELER_CLI_PATH Stores the path to the command line interface executable called pgmodeler-cli.
    PGMODELER_SE_PATH Stores the path to the schema file editor executable called pgmodeler-se.
    PGMODELER_PATH Stores the path to the main executable called pgmodeler.

  • Custom build parameters

    This optional section describes how the build process can be customized in such way that the files are generated in different directories other than the default ones. This way pgModeler introduces eleven custom parameters that can be passed to qmake in order to configure the custom output folders. The use of custom build parameters is a good mechanism for package maintainers (in case of Linux distros) to create custom releases that better suits each system's requirements. The details of these parameters and how they can be used is shown in the table below. Note that if you modify the value of any custom parameter you'll need to reflect these changes on the building steps above.

    Parameter Description
    PGM_PREFIX The path to the root directory where the compiled files will be placed.
    PGM_BINDIR The path to the folder where executables accessible by the user will reside.
    PGM_CONFDIR The path to the folder where the pgModeler's template configuration folder conf will be installed.
    PGM_DOCDIR The path to the folder where the documentation related files are placed.
    PGM_LANGDIR The path to the folder where the UI translation folder lang resides.
    PGM_SAMPLESDIR The path to the folder where the sample models folder samples resides.
    PGM_SCHEMASDIR The path to the folder where the object's schemas folder schemas resides.
    PGM_SHAREDIR The path to the folder where shared files and resources must be placed. Generally, this is the root path where folders like lang, samples and schemas will be placed.
    PGM_PRIVATEBINDIR The path to the folder where executables not directly accessible by the user will be placed (e.g. crash handler executable – pgmodeler-­ch).
    PGM_PRIVATELIBDIR The path to the folder where libraries not directly shared through the system will reside.
    PGM_PLUGINSDIR The path to the folder where third party plugins are installed.

    Now, to use one of these parameters run qmake as following:

    cmake -S . -DPGM_PREFIX=[PATH] -B ./cmake-build --fresh

    After running cmake command with the custom parameters a small summary is displayed so you can check if the configured variables really point out to the desired locations. From here, you can (re)build the application by following the building steps from previous sections so the changes in the custom parameters can take effect.

    [ pgModeler build paths ]
    * PGM_PREFIX        = /home/raphael/pgmodeler/build
    * PGM_BINDIR        = /home/raphael/pgmodeler/build/bin
    * PGM_PRIVATEBINDIR = /home/raphael/pgmodeler/build/bin
    * PGM_PRIVATELIBDIR = /home/raphael/pgmodeler/build/lib/pgmodeler 
    * PGM_PLUGINSDIR    = /home/raphael/pgmodeler/build/lib/pgmodeler/plugins
    * PGM_SHAREDIR      = /home/raphael/pgmodeler/build/share/pgmodeler
    * PGM_CONFDIR       = /home/raphael/pgmodeler/build/conf
    * PGM_DOCDIR        = /home/raphael/pgmodeler/build/share/pgmodeler
    * PGM_LANGDIR       = /home/raphael/pgmodeler/build/lang
    * PGM_SAMPLESDIR    = /home/raphael/pgmodeler/build/samples
    * PGM_SCHEMASDIR    = /home/raphael/pgmodeler/build/schemas
    
    [ Dependencies ]
    * C compiler         = /usr/bin/clang
    * C++ compiler       = /usr/bin/clang++
    * PostgreSQL headers = /usr/include/pgsql
    * PostgreSQL library = /usr/lib64/libpq.so
    * LibXml2 headers    = /usr/include/libxml2
    * LibXml2 library    = /usr/lib64/libxml2.so
    
    [ Extra build options ]
    * NO_CHECK_CURR_VER  = 
    * SNAPSHOT_BUILD     = 
    * APPIMAGE_BUILD     = 
    * DEMO_VERSION       = 
    * PLUS_VERSION       = 
    * NO_UPDATE_CHECK    = 
    * BUILD_PLUGINS      = ON
    * BUILD_PRIV_PLUGINS = 
    
    * To change a variable's value run cmake again from source root and setting the new value, e.g.:
      > cmake -S . -DPGM_PREFIX=/usr/local -B ./cmake-build --fresh
    
    * To proceed with build process run: 
      > cmake --build ./cmake-build --target all
    
    * To install the compiled files run:
      > cmake --install ./cmake-build
    				



    Got the software running? Awesome! How about showing the project some love? :)

    pgModeler is brought to you thanks to a great effort to create and distribute a quality product. This project is reaching out to levels of maturity never imagined. All this is the result of joint work between its author and the open source community. The software has a long way to go yet, and with your help, we'll keep maintaining a good job and bringing new improvements in each release. If you did like pgModeler and think it deserves a contribution, please make a donation via PayPal™, Stripe™ or Bitcoin. Note that donations don't grant access to binary packages.

    10.00 USD