Home > Net >  How do you install the x86_64 version of a brew package on a M1 Mac?
How do you install the x86_64 version of a brew package on a M1 Mac?

Time:07-15

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?

CodePudding user response:

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.

  • Related