From 6d863cb6a19a96a5e169395ae4deb967c4d95020 Mon Sep 17 00:00:00 2001 From: ngyl88 Date: Sat, 4 Sep 2021 18:31:18 +0800 Subject: [PATCH] update README for MacOS installation with linker failure --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 257746d0..7751073f 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,14 @@ the library file `libmysqlclient.so` but is missing the header file `mysql.h` ### Mac OS X +``` sh + brew install openssl + gem install mysql2 -- --with-opt-dir="$(brew --prefix openssl)" +``` + +You may hit this issue `ld: library not found for -lssl`, because [MacOS is pointing to +LibreSSL instead of OpenSSL](https://stackoverflow.com/questions/62195898/openssl-still-pointing-to-libressl-2-8-3). + You may use MacPorts, Homebrew, or a native MySQL installer package. The most common paths will be automatically searched. If you want to select a specific MySQL directory, use the `--with-mysql-dir` or `--with-mysql-config` options above. @@ -96,6 +104,14 @@ MySQL directory, use the `--with-mysql-dir` or `--with-mysql-config` options abo If you have not done so already, you will need to install the XCode select tools by running `xcode-select --install`. +If you are using `bundle install` to manage dependencies in project, you might need to set +`bundle config`. +``` sh + brew install openssl + bundle config --local build.mysql2 --with-opt-dir="$(brew --prefix openssl)" + bundle install +``` + ### Windows Make sure that you have Ruby and the DevKit compilers installed. We recommend