Home > Blockchain >  Could not open library 'vips.42'; Library not loaded: '@@HOMEBREW_PREFIX@@/opt/libpng
Could not open library 'vips.42'; Library not loaded: '@@HOMEBREW_PREFIX@@/opt/libpng

Time:08-24

Everything was running fine locally in my Rails 7 application on Apple M1 macOS Monterey, until I did brew update. Now I am running into issues with vips. I've seen another thread saying I need to run brew install vips, but I am still getting this error:

Could not open library 'vips.42': dlopen(vips.42, 0x0005): tried: 'vips.42' (no such file), 
'/usr/local/lib/vips.42' (no such file), 
'/usr/lib/vips.42' (no such file)

When I run vips -v I get this error:

dyld[18235]: Library not loaded: '@@HOMEBREW_PREFIX@@/opt/libpng/lib/libpng16.16.dylib'
Referenced from: '/opt/homebrew/Cellar/freetype/2.12.1/lib/libfreetype.6.dylib'
Reason: tried: '/usr/local/lib/libpng16.16.dylib' (no such file), '/usr/lib/libpng16.16.dylib' (no such file)

Thanks in advance for any help.

CodePudding user response:

On m1, homebrew puts binaries in /opt/homebrew/lib and older versions of the ffi gem don't look there. If you update to ff 1.15.3 it will.

See:

https://github.com/libvips/ruby-vips/issues/284#issuecomment-1192157228

CodePudding user response:

Thank you, jcupitt for pointing me in the right direction. What worked for me was symlinking with the following command:

sudo ln -s /opt/homebrew/lib /usr/local/lib
  • Related