markdown 使用Homebrew安装的pg和openssl在Mac上构建pgmodeler

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown 使用Homebrew安装的pg和openssl在Mac上构建pgmodeler相关的知识,希望对你有一定的参考价值。

# 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

以上是关于markdown 使用Homebrew安装的pg和openssl在Mac上构建pgmodeler的主要内容,如果未能解决你的问题,请参考以下文章

markdown 使用Homebrew安装Apache 2.4和PHP 7.1

markdown 使用Homebrew在Sierra上安装MySQL

markdown 使用Homebrew在macOS上安装MySQL 5.7

markdown 通过Homebrew安装NVM,Node.js,Yarn

安装django

markdown 如果你已经在Mac OS X或Linuxbrew上通过Homebrew安装了Node,那么如何修复npm的说明