Glib-2.0.0 not found on M1 mac

hi… I’m trying to use the image_processing gem to get an avatar thumbnail. however, rails cant find glib-2.0.0. I’m on an M1 macbook. it should be looking in /opt/local/lib, but instead is looking in /usr/local/lib. can anyone help me out?

function in app/models/user.rb:

def avatar_thumbnail
  if avatar.attached?
    avatar.variant(resize: "150x150!").processed
  else
    "/default_avatar.jpg"
  end
end

error:

LoadError in HomeController#index Could not open library ‘glib-2.0.0’: dlopen(glib-2.0.0, 0x0005): tried: ‘glib-2.0.0’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OSglib-2.0.0’ (no such file), ‘/usr/lib/glib-2.0.0’ (no such file, not in dyld cache), ‘glib-2.0.0’ (no such file), ‘/usr/local/lib/glib-2.0.0’ (no such file), ‘/usr/lib/glib-2.0.0’ (no such file, not in dyld cache). Could not open library ‘/usr/local/lib/libglib-2.0.0.dylib’: dlopen(/usr/local/lib/libglib-2.0.0.dylib, 0x0005): tried: ‘/usr/local/lib/libglib-2.0.0.dylib’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/usr/local/lib/libglib-2.0.0.dylib’ (no such file), ‘/usr/local/lib/libglib-2.0.0.dylib’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/usr/local/Cellar/glib/2.76.2/lib/libglib-2.0.0.dylib’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)), ‘/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/glib/2.76.2/lib/libglib-2.0.0.dylib’ (no such file), ‘/usr/local/Cellar/glib/2.76.2/lib/libglib-2.0.0.dylib’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’))

can’t you put an alias into usr/local/lib pointing to where glib lives?

the problem with that is that /usr/local/lib/libglib-2.0.0.dylib already does exist:

I have two versions of homebrew installed – one for arm64 and one for x86_64… which is why it gives this part of the error:

/usr/local/lib/libglib-2.0.0.dylib’ (mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64’)

I don’t want to flat out uninstall it, which would break other programs…

Is there a different way?

Did you find a solution?

Uninstall the x86-64 one and it should work?