This page gives some basic instructions on how build from source, install and run pgModeler in all supported platforms. If you stumble in any problem just ask for help at Github issues page by posting as many as possible details about it. Finally, it is strongly recommended to use the most recent pgModeler's source code in order to take advantage of bug fixes and new features.

  • Common requirements

    In all platforms the first requirement is the Qt framework in the LTS (Long Term Support) modality, so make sure to download the release 5.9.x that fits your platform. If you like to live on the edge, you can try to compile pgModeler using the most recent version of Qt but bear in mind that in most cases the compilation can fail due to incompatibilities between the tool's source code and the framework in its newer version.

    Second, you will need a PostgreSQL installation and for practical purposes in Windows or macOS the installers provided by EnterpriseDB are strongly recommended since they bundle all the needed headers and libraries. For Linux systems it is recommended to use the PostgreSQL packaged by your distro. In this case make sure to install all the packages including the development ones (commonly named as postgresql-devel and/or libpq) since the build process will lookup for the headers and libraries through the pkg-config command. In this document we are using the PostgreSQL 10.1 so be in mind that the location of headers and libraries in the settings below may vary depending on the version of the database system you've chosen.

    If you're running Windows you will need the Git client, found here, which enables you to clone pgModeler's source code from its repository. Make sure to install it so it can be used from the Window's console.

    Finally, on Linux system the git command is available by installing base development tools. On macOS the command is part of Xcode (a dependency mentioned below). Optionally, you may use tarballs instead of cloning pgModeler's source code. See the download page for more details about retrieving the source code.


    Important notes

    1) Some Linux distros already deliver Qt framework runtime libraries and development packages but in some cases the system installs Qt4 and Qt5 causing incompatibilities during the execution of compilation steps so in order to make this step-by-step as simple as possible use the recommended Qt package downloaded from the project's site.

    2) In Windows system pgModeler is build using MingW compiler, thus only the 32 bit version of the Qt framework is compatible. If your system is 64 bit you must install the 32 bit version of all mentioned requirements.

  • Platform specific requirements

    GCC or Clang compiler: pgModeler is coded in it's most using the C++ language but in new modules C++11 is being used so this is why GNU Compiler Collection or LLVM Compiler Infrastructure is needed. Make sure to have installed at least GCC 4.8+ or LLVM 3.4+ to enable the full support to C++11.

    XML2 library: generally the runtime files are already installed but the needed header files 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. In order to check if the library is correctly installed run the command (1) 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 must check the installation.

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


    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 in order to check if everything is okay run the command (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

    GCC compiler: it is strongly recommended to use the MingW compiler (a port of GCC) that comes bundled with Qt framework installer since no additional configuration steps for it are needed. Custom installation of the compiler in this platform is discoraged since may cause the Qt framework to not locate it correctly during pre-compilation steps.

    XML2 library: in this platform the library is completely absent and the user must install it manually. Fortunately, there is a quick and easy way to install libxml2. If you have installed the recommended PostgreSQL distribution no more settings need to be done since this library and its headers are bundled together with the PostgreSQL installer.

    Xcode: is the development toolkit for macOS and the minimum requirement is the version 4.4 but it's recommended to use the latest version available because, depending on the Qt version, the compilation will fail mainly due to incomplete language support.

    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 below).

  • Tweaking the building script

    If you are compiling pgModeler in Windows or macOS there is a preliminary step before run the main compilation command. You need to configure the location of the dependency headers and libraries by editing the file pgmodeler.pri. Assuming that you've already got the source code open the mentioned file in your favorite text editor and locate the following lines:

    windows {
      !defined(PGSQL_LIB, var): PGSQL_LIB = C:/PostgreSQL/10.1/lib/libpq.dll
      !defined(PGSQL_INC, var): PGSQL_INC = C:/PostgreSQL/10.1/include
      !defined(XML_INC, var): XML_INC = C:/PostgreSQL/10.1/include
      !defined(XML_LIB, var): XML_LIB = C:/PostgreSQL/10.1/bin/libxml2.dll
      ...
    }
    
    macx {
      PGSQL_LIB = /Library/PostgreSQL/10/lib/libpq.dylib
      PGSQL_INC = /Library/PostgreSQL/10/include
      XML_INC = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
      XML_LIB = /usr/lib/libxml2.dylib
      ...
    }

    Make sure to edit only the section corresponding to your platform. You need to change the values of the variables PGSQL_LIB, PGSQL_INC, XML_INC and XML_LIB. These variables tell the compiler where to find the headers and libraries for libxml2 as well libpq. Update the values according to the location of the files or folders in your system.

  • Building

    We are now able to proceed with the compilation process. This step differs a bit in each operating system and it is described below. All the commands must be executed inside the console and from the root of source code folder. In Windows system remember to run the commands from the Qt's built-in shell commonly named Qt 5.9.x for Desktop (MinGW 5.x 32 bit) under start menu.

    In the following procedures, in order to shorten the commands, we are assuming that $QT_ROOT is the full path to the Qt installation which varies from system to system. In Linux the path ends with gcc_64, in Windows it ends with mingw53_32 and in macOS the path ends with clang_64. The variable $PGMODELER_SOURCE is the root of pgModeler's source code folder and $PGMODELER_ROOT is the root of pgModeler's installation folder. In macOS the installation root is the path to the bundle created after running make install command: /Applications/pgmodeler.app.


    1: $QT_ROOT/bin/qmake -r PREFIX=$PGMODELER_ROOT BINDIR=$PGMODELER_ROOT \
                             PRIVATEBINDIR=$PGMODELER_ROOT PRIVATELIBDIR=$PGMODELER_ROOT/lib pgmodeler.pro
    2: make
    3: make install
    
    1: $QT_ROOT\bin\qmake.exe -r PREFIX=$PGMODELER_ROOT pgmodeler.pro
    2: $QT_ROOT\bin\mingw32-make.exe
    3: $QT_ROOT\bin\mingw32-make.exe install
    4: cd $PGMODELER_ROOT
    5: $QT_ROOT\bin\windeployqt pgmodeler.exe -executable=pgmodeler-cli.exe -executable=pgmodeler-ch.exe
    
    1: $QT_ROOT/bin/qmake -r pgmodeler.pro
    2: make
    3: make install
    4: $QT_ROOT/bin/macdeployqt $PGMODELER_ROOT \
                                -executable=$PGMODELER_ROOT/Contents/MacOS/pgmodeler-ch \
                                -executable=$PGMODELER_ROOT/Contents/MacOS/pgmodeler-cli
    

  • Resolving dependencies

    After successfully compile the source code and install the binaries we need to copy some dependencies into the pgModeler's installation folder as well run some commands in order to make the binaries locate them properly. In the steps below replace the $PGSQL_ROOT by the full path to PostgreSQL's installation folder.


    1: cd $QT_ROOT/lib
    2: cp libQt5DBus.so.5 libQt5PrintSupport.so.5 libQt5Widgets.so.5 libQt5Network.so.5 libQt5Gui.so.5 \
          libQt5Core.so.5 libQt5XcbQpa.so.5 libQt5Svg.so.5 libicui18n.so.5* libicuuc.so.5* libicudata.so.5* $PGMODELER_ROOT/lib
    3: cd $QT_ROOT/plugins
    4: mkdir $PGMODELER_ROOT/lib/qtplugins
    5: mkdir $PGMODELER_ROOT/lib/qtplugins/imageformats
    6: mkdir $PGMODELER_ROOT/lib/qtplugins/printsupport
    6: mkdir $PGMODELER_ROOT/lib/qtplugins/platforms
    7: cp -r imageformats/libqgif.so imageformats/libqico.so imageformats/libqjpeg.so imageformats/libqsvg.so \
             imageformats/libqtga.so imageformats/libqtiff.so imageformats/libqwbmp.so $PGMODELER_ROOT/lib/qtplugins/imageformats
    8: cp -r printsupport/libcupsprintersupport.so $PGMODELER_ROOT/lib/qtplugins/printsupport
    9: cp -r platforms/libqxcb.so $PGMODELER_ROOT/lib/qtplugins/platforms
    10: echo -e "[Paths]\nPrefix=.\nPlugins=lib/qtplugins\nLibraries=lib" > $PGMODELER_ROOT/qt.conf
    11: cp $PGMODELER_SOURCE/start-pgmodeler.sh $PGMODELER_SOURCE/pgmodeler.vars $PGMODELER_ROOT
    12: chmod +x $PGMODELER_ROOT/start-pgmodeler.sh
    
    1: cd $QT_ROOT\bin
    2: copy /y Qt5Core.dll Qt5Gui.dll Qt5Network.dll Qt5PrintSupport.dll Qt5Svg.dll Qt5Widgets.dll \
               libgcc_s_dw2-1.dll libstdc++-6.dll libwinpthread-1.dll $PGMODELER_ROOT
    3: cd $PGSQL_ROOT\bin
    4: copy /y libiconv-2.dll libintl-8.dll zlib1.dll libxml2.dll libpq.dll libeay32.dll ssleay32.dll $PGMODELER_ROOT
    5: echo -e "[Paths] Prefix=. Plugins=lib/qtplugins Libraries=." > $PGMODELER_ROOT/qt.conf
    
    1: cp $PGSQL_ROOT/lib/libpq.5.dylib $PGSQL_ROOT/lib/libssl.1.* \
          $PGSQL_ROOT/lib/libcrypto.1.* $PGMODELER_ROOT/Contents/Frameworks
    2: install_name_tool -change "@loader_path/../lib/libcrypto.1.0.0.dylib" "@loader_path/../Frameworks/libcrypto.1.0.0.dylib" $PGMODELER_ROOT/Contents/Frameworks/libssl.1.0.0.dylib
    3: install_name_tool -change "@loader_path/../lib/libcrypto.1.0.0.dylib" "@loader_path/../Frameworks/libcrypto.1.0.0.dylib" $PGMODELER_ROOT/Contents/Frameworks/libpq.5.dylib
    4: install_name_tool -change "@loader_path/../lib/libssl.1.0.0.dylib" "@loader_path/../Frameworks/libssl.1.0.0.dylib" $PGMODELER_ROOT/Contents/Frameworks/libpq.5.dylib
    5: install_name_tool -change libpq.5.dylib "@loader_path/../Frameworks/libpq.5.dylib" $PGMODELER_ROOT/Contents/Frameworks/libpgconnector.dylib
    

  • Custom parameters

    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 which 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 the needs and requirements of each system. The details of these parameters and how they can be used is shown in the table below. If you won't build pgModeler with custom parameters you can skip this section. 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
    PREFIX The path to the root directory where the compiled files will be placed.
    BINDIR The path to the folder where executables accessible by the user will reside.
    CONFDIR The path to the folder where the pgModeler's template configuration folder conf will be installed.
    DOCDIR The path to the folder where the documentation related files are placed.
    LANGDIR The path to the folder where the UI translation folder lang resides.
    SAMPLESDIR The path to the folder where the sample models folder samples resides.
    SCHEMASDIR The path to the folder where the object's schemas folder schemas resides.
    SHAREDIR The path to the folder where shared files and resources must be placed. Generally, this is the root path where folders like langsamples and schemas will be placed.
    PRIVATEBINDIR The path to the folder where executables not directly accessible by the user will be placed (e.g. crash handler executable – pgmodeler­ch).
    PRIVATELIBDIR The path to the folder where libraries not directly shared through the system will reside.
    PLUGINSDIR The path to the folder where third party plug­ins are installed.

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

    $QT_ROOT/bin/qmake pgmodeler.pro PREFIX=[PATH] BINDIR=[PATH] CONFDIR=[PATH]

    After running qmake 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 details **
    
    PREFIX = /home/raphael/pgmodeler/build 
    BINDIR = /home/raphael/pgmodeler/build 
    PRIVATEBINDIR = /home/raphael/pgmodeler/build 
    PRIVATELIBDIR = /home/raphael/pgmodeler/build 
    PLUGINSDIR = /home/raphael/pgmodeler/build/plugins 
    SHAREDIR = /home/raphael/pgmodeler/build 
    CONFDIR = /home/raphael/pgmodeler/build/conf 
    DOCDIR = /home/raphael/pgmodeler/build 
    LANGDIR = /home/raphael/pgmodeler/build/lang 
    SAMPLESDIR = /home/raphael/pgmodeler/build/samples 
    SCHEMASDIR = /home/raphael/pgmodeler/build/schemas 
    
    * To change a variable value run qmake again setting the desired value e.g.:
    > qmake PREFIX+=/usr/local -­r pgmodeler.pro 
    
    * Proceed with build process by running: 
    > make && make install

  • Running

    Finally, pgModeler can be started. In Windows or macOS there are no additional settings, just double click the application and have fun. Now for Linux we need to change a few environment variables to make the tool run properly. As a facility there are two scripts that may be used to tweak environment variables without affect the whole system settings.

    The first file is the pgmodeler.vars which contains template configuration for the variables referenced by pgModeler during runtime. Open the file in your favorite text editor and change the variables' values according to the location of the referenced files or folders in your system. If you followed this document correctly there's no need to edit it. The second file is a startup script called start-pgmodeler.sh that just loads the environment variables and calls the main executable. Once all the settings are done open a terminal instance and run the startup script $PGMODELER_ROOT/start-pgmodeler.sh.

    Enjoy!


    Did these steps helped you to put the software to run? That's great! Now, how about give a little help to the project?

    pgModeler is brought to you thanks to a great effort to create and distribute a quality product. This project is reaching out levels of maturity never imagined. All this is the result of a 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 the good job and bringing new improvements in each release. If you did like pgModeler and thinks it deserves a contribution please make a donation via PayPal™. Note that donations don't grant access to binary packages.

    10.00 USD