claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] illegal hardware instruction, please compile without the AVX2 requirement

Open diwu-sf opened this issue 6 months ago • 12 comments

Environment

  • Platform (select one):
    • [X] Anthropic API
  • Claude CLI version: 1.0.81
  • Operating System: mac 12.7.6
  • Terminal: iterm2

Bug Description

Claude native install has CPU hardware instruction problem:

claude --version
[1]    36152 illegal hardware instruction

Macbook is Retina 15 early 2013, cpu is Intel (3635QM) This CPU does NOT have AVX2 / BMI2 / FMA support

Steps to Reproduce

  1. Use older intel macbook without AVX2 instructions
  2. Install claude code via npm
  3. Do native install, try to run, and hit error

Expected Behavior

It should not crash on unknown cpu instruction

Actual Behavior

Crashes due to unknown instruction

Additional Context

Claude code native build is not that CPU intensive, so I don't see why it would need to be compiled with AVX2 requirement. In Rust, please compile with target RUSTFLAGS="-C target-cpu=x86-64" and this should fix it by going back to the normal baseline x86-64 instructions

diwu-sf avatar Aug 15 '25 19:08 diwu-sf

@diwu-sf can you see if this repros in version 1.0.69 ?

ant-kurt avatar Aug 15 '25 20:08 ant-kurt

(base) ➜  Projects claude install 1.0.69

✔  Claude Code successfully installed!

  Version: 1.0.69

  Location: ~/.local/bin/claude


  Next: Run claude --help to get started
(base) ➜  Projects ~/.local/bin/claude --version
[1]    87076 illegal hardware instruction  ~/.local/bin/claude --version

similar problem, is the build machine running with target-cpu=native?

diwu-sf avatar Aug 15 '25 20:08 diwu-sf

This should be working better in upcoming release 1.0.84 - likely rolling out Monday

ant-kurt avatar Aug 15 '25 23:08 ant-kurt

@ant-kurt this is still happening with 1.0.84. For reference the NPM version works fine, even the ripgrep binary from the npm install works fine.

diwu-sf avatar Aug 19 '25 17:08 diwu-sf

Hmm - can you try running v1.0.84 with env var USE_BUILTIN_RIPGREP=0 to see if that isolates the problem?

ant-kurt avatar Aug 19 '25 17:08 ant-kurt

oo, same thing happening with me Apple M1 Pro Sonoma 14.7.6(23H626)

i got this illegal instruction when installing with native

curl -fsSL https://claude.ai/install.sh | bash
Setting up Claude Code...
bash: line 142:  1399 Illegal instruction: 4  "$binary_path" install ${TARGET:+"$TARGET"}

then i went to brew cask, and installment passed but i couldn't boot it after installment... here is the log

brew install --cask claude-code
==> Downloading https://formulae.brew.sh/api/cask.jws.json
==> Caveats
Claude Code's auto-updater installs updates to `~/.local/bin/claude` and
not to Homebrew's location. It is recommended to disable the auto-updater
with either `DISABLE_AUTOUPDATER=1` or
`claude config set -g autoUpdates false` and use
`brew upgrade --cask claude-code`.

==> Downloading https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-release
Already downloaded:
==> Installing Cask claude-code
==> Linking Binary 'claude' to '/usr/local/bin/claude'
🍺  claude-code was successfully installed!
==> No outdated dependents to upgrade!

claude 
Job 1, 'claude' terminated by signal SIGILL (Illegal instruction)

npm version worked fine with me before too.

kepoorz avatar Aug 20 '25 04:08 kepoorz

@ant-kurt version 1.0.86 native still has trouble on that intel macbook without the avx2

Env var USE_BUILTIN_RIPGREP=0 does not help

diwu-sf avatar Aug 21 '25 04:08 diwu-sf

I have the same issue with native install script - Mac Mini 4,1 - Linux Mint 22.2 Zara Tried setting USE_BUILTIN_RIPGREP=0, with no impact npm install succeeds, and claude code works properly

MysticTaCo avatar Nov 09 '25 16:11 MysticTaCo

same issue on mac pro m1

illegal hardware instruction claude

neok avatar Nov 10 '25 14:11 neok

Not exactly the same issue as the original post but I am getting Illegal instruction: 4 when I run the claude command after installing via Homebrew. I tried installing via curl and got bash: line 142: 2857 Illegal instruction: 4 "$binary_path" install ${TARGET:+"$TARGET"}. I am on a 2021 Macbook Pro with Apple M1 Max chip and Sonoma 14.6.1.

Update:

Somehow I was running an intel shell on my M1 mac. To fix this I ran chsh -s /bin/zsh. Then I reinstalled homebrew, ensuring it was the ARM version installed in /opt/homebrew. Then I reinstalled Claude and deleted the old Claude at /usr/local/bin/claude. This is not a bug with Claude, I'm just leaving this here in case someone else has a similar issue.

Calvin0125 avatar Nov 13 '25 15:11 Calvin0125

arch -arm64 brew install --cask claude-code

My problem has been solved

cx2768279 avatar Nov 19 '25 01:11 cx2768279

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 19 '25 10:12 github-actions[bot]