Skip to content

Instantly share code, notes, and snippets.

@aseroff
Last active January 30, 2024 20:40
Show Gist options
  • Save aseroff/2b74bcaef64bd5b20f06b226ba0cf725 to your computer and use it in GitHub Desktop.
Save aseroff/2b74bcaef64bd5b20f06b226ba0cf725 to your computer and use it in GitHub Desktop.
The stupid hoops required to install mysql2 gem with brew-installed mysql
mysql_version=$(brew list --versions mysql | tr ' ' '\n' | tail -1)
mysql_path=$(brew --cellar mysql)/$mysql_version
gem install mysql2 -- \
--with-mysql-lib=$mysql_path/lib \
--with-mysql-dir=$mysql_path \
--with-mysql-config=$mysql_path/bin/mysql_config \
--with-mysql-include=$mysql_path/include \
--with-openssl-dir=/usr/local/Cellar/openssl@3/3.1.2
# or add to ./bundle/config
BUNDLE_BUILD__MYSQL2: "--with-mysql-lib=/usr/local/Cellar/mysql/8.2.0_1/lib"
BUNDLE_BUILD__MYSQL2: "--with-mysql-dir=/usr/local/Cellar/mysql/8.2.0_1/"
BUNDLE_BUILD__MYSQL2: "--with-mysql-config=/usr/local/Cellar/mysql/8.2.0_1/bin/mysql_config"
BUNDLE_BUILD__MYSQL2: "--with-mysql-include=/usr/local/Cellar/mysql/8.2.0_1/lib/include"
BUNDLE_BUILD__MYSQL2: "--with-openssl-dir=/usr/local/Cellar/openssl@3/3.2.0_1"
@aseroff
Copy link
Author

aseroff commented May 16, 2023

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