How do you install the x86_64 version of a brew package on a M1 Mac?
Asked Answered
R

2

5

I'm working on an M1 processor and I'm running a setup script that needs access to the package libsodium which doesn't exist on my computer.

I run brew install libsodium which installs the package here /opt/homebrew/Cellar/libsodium with all my other packages installed with brew

Re-running the setup script I get this error saying that it's looking for libsodium here /usr/local/lib/sodium which it can't find and that it found libsodium here /opt/homebrew/lib/libsodium.dylib but can't open it due to an incompatible architecture (have 'arm64', need 'x86_64')

    LoadError: Could not open library 'sodium': dlopen(sodium, 0x0005): tried: 'sodium' (no such file), '/usr/local/lib/sodium' (no such file), '/usr/lib/sodium' (no such file), '/Users/peter.walker/projects/chopin/sodium' (no such file).
Could not open library '/opt/homebrew/lib/libsodium.dylib': dlopen(/opt/homebrew/lib/libsodium.dylib, 0x0005): tried: '/opt/homebrew/lib/libsodium.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')), '/opt/homebrew/Cellar/libsodium/1.0.18_1/lib/libsodium.23.dylib' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')).

How are you supposed to handle installing Intel only brew packages?

Reredos answered 13/7, 2022 at 17:29 Comment(0)
M
12

Here is the command for installing x86_64 version of a brew package.

arch -x86_64 /usr/local/bin/brew install package

You might have to install brew for x86_64.

Mittiemittimus answered 14/7, 2022 at 7:46 Comment(2)
Is /usr/local/bin/brew in reference to where homebrew is installed?Reredos
Yes, it is. /usr/local/bin/ is the reference to x86_64 homebrew. And brew is the executable.Mittiemittimus
R
0

Try bundle config set force_ruby_platform true, bundle install, then gem update --system if you're getting this error message from trying to run a Rails app on M1.

The question I originally asked was unrelated to the issue I was having.

Reredos answered 18/7, 2022 at 19:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.