Skip to content

Instantly share code, notes, and snippets.

@treble37
Forked from jdforsythe/mac-build-pgmodeler.md
Created February 7, 2019 03:35
Show Gist options
  • Save treble37/32383e92680df8b3546720d387d61ed9 to your computer and use it in GitHub Desktop.
Save treble37/32383e92680df8b3546720d387d61ed9 to your computer and use it in GitHub Desktop.
Build pgmodeler on Mac with Homebrew-installed pg and openssl

Building pgmodeler for Mac

Check requirements at https://pgmodeler.io/installation.

You will need Qt 5.9.x installed, full XCode installed, and homebrew installation of postgres and openssl.

The example below is v10.5 of PG and v5.9.6 of Qt, modify accordingly. Also, replace {{USERNAME}} with you Mac username.

The installation is the same as the instructions at the link above. There are a few path differences due to homebrew installation locations.

The specific instructions that are different are listed below under the original section names from the installation page.

Tweaking the build script

pgmodeler.pri changes should be:

diff --git a/pgmodeler.pri b/pgmodeler.pri
index d74b69a9..f49ec495 100644
--- a/pgmodeler.pri
+++ b/pgmodeler.pri
@@ -146,8 +146,8 @@ unix:!macx {
 }

 macx {
-  PGSQL_LIB = /Library/PostgreSQL/10/lib/libpq.dylib
-  PGSQL_INC = /Library/PostgreSQL/10/include
+  PGSQL_LIB = /usr/local/Cellar/postgresql/10.5/lib/libpq.dylib
+  PGSQL_INC = /usr/local/Cellar/postgresql/10.5/include
   XML_INC = /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2
   XML_LIB = /usr/lib/libxml2.dylib
   INCLUDEPATH += $$PGSQL_INC $$XML_INC

Building the software

/Users/{{USERNAME}}/Qt/5.9.6/clang_64/bin/qmake -r pgmodeler.pro
make
make install
/Users/{{USERNAME}}/Qt/5.9.6/clang_64/bin/macdeployqt /Applications/pgmodeler.app -executable=/Applications/pgmodeler.app/Contents/MacOS/pgmodeler-ch -executable=/Applications/pgmodeler.app/Contents/MacOS/pgmodeler-cli

Resolving dependencies

The libssl.1.* and libcrypto.1.* are found in the openssl install, not in the pg install

cp /usr/local/Cellar/postgresql/10.5/lib/libpq.5.dylib / /Applications/pgmodeler.app/Contents/Frameworks/
cp /usr/local/Cellar/openssl/1.0.2p/lib/libssl.1.* /Applications/pgmodeler.app/Contents/Frameworks/
cp /usr/local/Cellar/openssl/1.0.2p/lib/libcrypto.1.* /Applications/pgmodeler.app/Contents/Frameworks/
install_name_tool -change "@loader_path/../lib/libcrypto.1.0.0.dylib" "@loader_path/../Frameworks/libcrypto.1.0.0.dylib" /Applications/pgmodeler.app/Contents/Frameworks/libssl.1.0.0.dylib
install_name_tool -change "@loader_path/../lib/libcrypto.1.0.0.dylib" "@loader_path/../Frameworks/libcrypto.1.0.0.dylib" /Applications/pgmodeler.app/Contents/Frameworks/libpq.5.dylib
install_name_tool -change "@loader_path/../lib/libssl.1.0.0.dylib" "@loader_path/../Frameworks/libssl.1.0.0.dylib" /Applications/pgmodeler.app/Contents/Frameworks/libpq.5.dylib
install_name_tool -change libpq.5.dylib "@loader_path/../Frameworks/libpq.5.dylib" /Applications/pgmodeler.app/Contents/Frameworks/libpgconnector.dylib

You should then be able to open pgmodeler from Launchpad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment