From 5c0a3279adfa402544f0714bfd6bd12382defebb Mon Sep 17 00:00:00 2001 From: Ole Michaelis Date: Fri, 12 Feb 2021 18:20:14 +0100 Subject: [PATCH] dynlib support for homebrew 3 on Apple Silicon M1 As the homebrew team discussed in https://github.com/Homebrew/brew/issues/9177 the new library path for homebrew on apple silicon is `/opt/homebrew/lib`. Alongside the PR to support MacPorts https://github.com/ffi/ffi/pull/638 this commits adds support for the new homebrew path. --- lib/ffi/library.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ffi/library.rb b/lib/ffi/library.rb index c6f965445..1f8602b95 100644 --- a/lib/ffi/library.rb +++ b/lib/ffi/library.rb @@ -126,7 +126,7 @@ def ffi_lib(*names) else # TODO better library lookup logic unless libname.start_with?("/") || FFI::Platform.windows? - path = ['/usr/lib/','/usr/local/lib/','/opt/local/lib/'].find do |pth| + path = ['/usr/lib/','/usr/local/lib/','/opt/local/lib/', '/opt/homebrew/lib/'].find do |pth| File.exist?(pth + libname) end if path