Search code examples
macoshomebrewcpu-architecturenvm

Bad CPU type in executable mac Intel core


Trying to install a specific version of nvm

But I get

nvm install 16.14.2
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
-bash: /opt/homebrew/bin/awk: Bad CPU type in executable
A version number is required.

My mac has the 2.4 GHz 8-Core Intel Core i9

file /opt/homebrew/bin/awk
/opt/homebrew/bin/awk: Mach-O 64-bit executable arm64

and

uname -a
Darwin <mystuff> 21.4.0 Darwin Kernel Version 21.4.0: <timestamp>; root:xnu-8020.101.4~15/RELEASE_X86_64 x86_64

Don't know what to do to get this to work. Any suggestions?


Solution

  • Found out that my ARM default prefix is wrong: - /usr/local on macOS intel - /opt/homebrew on macOS ARM - /home/linuxbrew on Linux ------ In order to fix it I had to uninstall Homebrew, found here: github.com/homebrew/install#uninstall-homebrew And then I had to then reinstall it, found at same link. Reinstalling it changed the default prefix from the incorrect /opt/homebrew to the correct /usr/local prefix