# Install mysql2 gem on macOS using MAMP as mySQL server

**Published:** August 19, 2017
**Tags:** Web Development, Database

**Summary:** Fix the mysql2 gem compile error on macOS when using MAMP by pointing gem install at the right mysql_config path.


---

When installing `mysql2` gem on a system using [MAMP](https://www.mamp.info/en/) as mySQL server, you may end up with a compilation error because of incorrect mysql path.

To deal with this problem, instead of `gem install mysql2`, try to specify mysql configuration directory:

```bash
gem install mysql2 -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config
```

