# 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
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
```sh
/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
```sh
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