"ERROR: sql.h not found" when installing ruby-odbc gem with Apple M1 homebrew

Viewed 349

Context: on Apple M1, homebrew's location is /opt/homebrew' (not the usual /usr/local`)

macOS Intel: /usr/local
macOS ARM: /opt/homebrew

When I install ruby-odbc gem I'm getting the error ERROR: sql.h not found

If I pass in commandline arguments, I can get it to install... gem install ruby-odbc -- --with-odbc-dir=/opt/homebrew/Cellar/unixodbc/2.3.9_1/

However, we are using bundler. I don't remember the best way to put this into a Gemfile and I'm convinced there must be a better way to solve this.

How do I tell gem, bundler, or my macOS that it should look in /opt/homebrew when compiling ruby-odbc?

I see that ruby-odbc uses mkmf.rb's have_header in core ruby. Perhaps a newer ruby would work too?

1 Answers

bundle config set build.ruby-odbc --with-odbc-dir=/opt/homebrew/Cellar/unixodbc/2.3.9_1

Related