Skip to content

Instantly share code, notes, and snippets.

@SunDi3yansyah
Last active March 31, 2022 05:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SunDi3yansyah/c84e87165260a3ef81e0bfa4c5989514 to your computer and use it in GitHub Desktop.
Save SunDi3yansyah/c84e87165260a3ef81e0bfa4c5989514 to your computer and use it in GitHub Desktop.
Mac, Ruby building native extensions (gem install `gemname`)

Mysql / MariaDB:

gem install mysql2 -- --with-mysql-config=/usr/local/Cellar/mariadb/10.4.11/bin/mysql_config

PostgreSQL:

If you want to avoid using MacPorts, you can download the Postgres App and place it into the Application directory.

Then, specify the location of newly downloaded pg_config:

gem install pg -- --with-pg-config=/Applications/Postgres.app/Contents/Versions/latest/bin/pg_config

If you run in to missing headers problem, try specifying the include directory of the app:

gem install pg -- --with-pg-include='/Applications/Postgres.app/Contents/Versions/latest/include/'

libxml2

brew install libxml2
brew link --force libxml2
gem install libxml-ruby -- --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xml2-dir=/usr/local/opt/libxml2 --with-xml2-lib=/usr/local/opt/libxml2/lib --with-xml2-include=/usr/local/opt/libxml2/include

Ref:

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