Skip to content

Instantly share code, notes, and snippets.

@thomascjohnson
Last active July 19, 2020 14:35
Show Gist options
  • Save thomascjohnson/6c9841229a2db8839afefa059aedc807 to your computer and use it in GitHub Desktop.
Save thomascjohnson/6c9841229a2db8839afefa059aedc807 to your computer and use it in GitHub Desktop.
Quick script for installing pgmodeler
#!/bin/bash
brew install qt5
brew install postgres
brew install postgis
brew install libxml2
INSTALLATION_ROOT=/Applications/pgModeler.app
BREW_PG=/Usr/local/Cellar/postgresql
BREW_XML=/Usr/local/Cellar/libxml2
PGSQL_ROOT=$BREW_PG/$(ls -it $BREW_PG | head -n 1)
PGSQL_LIB=$PGSQL_ROOT/lib/libpq.dylib
PGSQL_INC=$PGSQL_ROOT/include
XML_ROOT=$BREW_XML/$(ls -t $BREW_XML | head -n 1)
XML_INC=$XML_ROOT/include
XML_LIB=$XML_ROOT/lib/libxml2.dylib
BREW_QT=/Usr/local/Cellar/qt
QT_ROOT=$BREW_QT/$(ls -t $BREW_QT | head -n 1)
cd /tmp
git clone https://github.com/pgmodeler/pgmodeler
cd /tmp/pgmodeler
sed -i '' "s+/Library/PostgreSQL/12/lib/libpq.dylib$+$PGSQL_LIB+g" pgmodeler.pri
sed -i '' "s+/Library/PostgreSQL/12/include$+$PGSQL_INC+g" pgmodeler.pri
sed -i '' "s+/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/libxml2$+$XML_INC+g" pgmodeler.pri
sed -i '' "s+/usr/lib/libxml2.dylib+$XML_LIB+g" pgmodeler.pri
git clone https://github.com/GlobalParametrics/plugins.git
$QT_ROOT/bin/qmake -r CONFIG+=release pgmodeler.pro
make && make install
$QT_ROOT/bin/macdeployqt $INSTALLATION_ROOT $INSTALLATION_ROOT/Contents/MacOS/pgmodeler-ch $INSTALLATION_ROOT/Contents/MacOS/pgmodeler-cli
LIBPG=$(ls -t $PGSQL_ROOT/lib/libpq.*.dylib | head -n 1 | xargs basename)
cp $PGSQL_ROOT/lib/$LIBPG $PGSQL_ROOT/lib/libssl.1.* $PGSQL_ROOT/lib/libcrypto.1.* $INSTALLATION_ROOT/Contents/Frameworks
LIBCRYPTO=$(ls /Applications/pgModeler.app/Contents/Frameworks/libcrypto.*.dylib | head -n 1 | xargs basename)
LIBSSL=$(ls /Applications/pgModeler.app/Contents/Frameworks/libssl.*.dylib | head -n 1 | xargs basename)
install_name_tool -change "@loader_path/../lib/$LIBCRYPTO" "@loader_path/../Frameworks/$LIBCRYPTO" $INSTALLATION_ROOT/Contents/Frameworks/$LIBSSL
install_name_tool -change "@loader_path/../lib/$LIBCRYPTO" "@loader_path/../Frameworks/$LIBCRYPTO" $INSTALLATION_ROOT/Contents/Frameworks/$LIBPG
install_name_tool -change "@loader_path/../lib/$LIBSSL" "@loader_path/../Frameworks/$LIBSSL" $INSTALLATION_ROOT/Contents/Frameworks/$LIBPG
install_name_tool -change $LIBPG "@loader_path/../Frameworks/$LIBPG" $INSTALLATION_ROOT/Contents/Frameworks/libpgconnector.dylib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment