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.6.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. 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.

    Finally, if you're running Windows you will need the MSYS2, a collection of ported GNU utilities that enables the building of applications which depend on traditional UNIX commands and tools. In this case we recommend the Git client, found here, since it bundles MSYS2 and also enables you to clone pgModeler's source code from its repository. In Linux the git command is available by installing base development tools and in macOS the command is part of Xcode (a dependency mentioned below). Optionally, you may use tarballs instead of cloning the source². See the download page for more details about retrieving the source code.


    1) 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 should install the 32 bit version of all mentioned requirements.

    2) Even using a source tarball in Windows system you still need to install Git client due to the required tools.

  • 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 libxml2­-devel package. 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 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/9.6/lib/libpq.dll
      !defined(PGSQL_INC, var): PGSQL_INC = C:/PostgreSQL/9.6/include
      !defined(XML_INC, var): XML_INC = C:/PostgreSQL/9.6/include
      !defined(XML_LIB, var): XML_LIB = C:/PostgreSQL/9.6/bin/libxml2.dll
      ...
    }
    
    macx {
      PGSQL_LIB = /Library/PostgreSQL/9.6/lib/libpq.dylib
      PGSQL_INC = /Library/PostgreSQL/9.6/include
      XML_INC = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.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 from system to 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 in Git bash application. In the steps below replace the variable $QTBIN by the full path to the bin folder of the Qt installation in your system. If you pefer, you can add that path into the PATH environment variable in order to avoid repeatidly type it. This latter procedure is different between the platforms and is not covered by this page.


  • GNU/Linux

    1: $QTBIN/qmake pgmodeler.pro
    2: make
    3: make install
    
    
    

  • Windows

    1: $QTBIN/qmake.exe pgmodeler.pro
    2: $QTBIN/mingw32-make.exe
    3: $QTBIN/mingw32-make.exe install
    4: cd build
    5: $QTBIN/windeployqt pgmodeler.exe
    

  • macOS

    1: $QTBIN/qmake pgmodeler.pro
    2: make
    3: make install
    4: cd build
    5: $QTBIN/macdeployqt pgmodeler.app
    

    The process takes some few minutes and if everything goes fine you should have a ready to run executable in the build folder in case of Linux and Windows systems. For macOS the default output is /Applications/pgmodeler.app.

  • 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 OS 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. 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 in pgmodeler.vars, open a terminal instance and set the execution permission for the startup script by running chmod +x start-pgmodeler.sh and then run it ./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.

    There's a campaign in progress to gather financial resources for a specific cause. Would you like to help with that instead of doing a simple donate?


    Sure, let me see!