There are other ways to address this with prefix paths etc. however I'm compiling Ruby via bosh create-env
and there
is limited flexibility since the packaging script for the CPI dictates all of this.
Given that the vSphere CPI currently requires Ruby 2.6.5 which requires OpenSSL 1.x, the best option on Mac is brew install OpenSSL 1.1.latest as the LibreSSL version that ships with Mac doesn't have the proper headers to compile Ruby. These instructions install OpenSSL via Homebrew then symlink it to the locations that the CPI packaging script expects.
The final step is to copy the OpenSSL packaging configs to the location expected otherwise Ruby compiles fine but doesn't properly include OpenSSL so when you try to install Ruby Gems it fails with a LoadError. These could probably be symlinked instead of copied.
I also had a few env vars set which I'm fairly certain aren't used, but just in case:
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"