Building Ruby gems with MacPorts Ruby

Andreas Yankopolus andreas at
Sun Jan 2 19:27:00 UTC 2022

It appears that the ruby31 port is missing something, as I can install ruby30, switch to it with sudo port select --set ruby ruby30, then install gems no problem.

> On Jan 2, 2022, at 1:48 PM, Andreas Yankopolus <ANDREAS at> wrote:
> All—
> I’ve installed Ruby with sudo port install ruby31 and want to install middleman <> with sudo gem install middleman. This gives an error that header files for building gems are not present in /opt/local/lib/ruby3.1/include:
> Building native extensions. This could take a while...
> ERROR:  Error installing middleman:
> 	ERROR: Failed to build gem native extension.
>     current directory: /opt/local/lib/ruby3.1/gems/3.1.0/gems/ffi-1.15.4/ext/ffi_c
> /opt/local/bin/ruby3.1 -I /opt/local/lib/ruby3.1/3.1.0 -r ./siteconf20220102-15848-cuiju7.rb extconf.rb
> mkmf.rb can't find header files for ruby at /opt/local/lib/ruby3.1/include/ruby.h
> You might have to install separate package for the ruby development
> environment, ruby-dev or ruby-devel for example.
> extconf failed, exit code 1
> Gem files will remain installed in /opt/local/lib/ruby3.1/gems/3.1.0/gems/ffi-1.15.4 for inspection.
> Results logged to /opt/local/lib/ruby3.1/gems/3.1.0/extensions/arm64-darwin-21/3.1.0/ffi-1.15.4/gem_make.out
> What MacPorts package(s) do I need for installing these headers? I’ve had no luck searching on <> for ruby.h
> Cheers,
> Andreas

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the macports-users mailing list