no-image

mach-o file, but is an incompatible architecture (have ‘x86_64’, need ‘arm64e’

Overview

M2 mac に移行した後、今まで動いていたアプリケーションで以下のようなエラーが出るようになった

xcrun: error: unable to load libxcrun (dlopen(/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib, 0x0005): tried: '/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e'))).

原因は 今まで使っていたコマンドラインが intel版のまま移行されてしまったため、これが動かないためにエラーになってしまっているようだ。

対処法としては以下の通り

sudo mv /Library/Developer/CommandLineTools /tmp/.

上記コマンドでとりあえず退避

その後、再度実行すると、自動で ComamndLinetTools をインストールしてくる

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.