Skip to content

Instantly share code, notes, and snippets.

@davidlowry
Created December 7, 2023 17:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidlowry/53812a983392b7d8dc8453ba317ac80d to your computer and use it in GitHub Desktop.
Save davidlowry/53812a983392b7d8dc8453ba317ac80d to your computer and use it in GitHub Desktop.
Installing MySQL gem for Rails bundler on Mac Silicon
# Install rails, mysql, etc by homebrew using this guide https://gorails.com/setup/macos/10.14-mojave - but if you require mysql and can't upgrade to Trilogy, this is required (and not in the guide at time of writing)
# With credit to Chris Oliver @excid3 at Go Rails
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
@davidlowry
Copy link
Author

Confirmed working Ruby 2.7.8, Rails 5.2?

  • Ruby 3.06, Rails 6.0

@davidlowry
Copy link
Author

  • Ruby 3.2.2 + Rails 6.1.7

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