Skip to content

Install on Apple M3 Max #256

Description

@topdown

I tried both npm and brew.

After installing, in a fresh terminal I run opencode and I get

jeffrey@Jeffreys-MBP ~ % opencode
zsh: illegal hardware instruction  opencode

Activity

  1. chipit24 commented on Jun 20, 2025

    @chipit24

    I have an Apple M3 Max MacBook Pro and installed opencode via npm i -g opencode-ai@latest and it runs without issue.

  2. topdown commented on Jun 20, 2025

    @topdown
    Author

    hmmm. I did the same.
    A couple times.

    I will try again and do some debugging

  3. self-assigned this
    on Jun 20, 2025
  4. thdxr commented on Jun 20, 2025

    @thdxr
    Member

    can you run which opencode and show me where it is

  5. topdown commented on Jun 20, 2025

    @topdown
    Author
    which opencode
    /usr/local/bin/opencode  
    

    Then when I run opencode I get nothing returned in my terminal emulator app

    In mac terminal I get

    ~ % opencode
    zsh: illegal hardware instruction  opencode
    

    Bash session

    $ opencode
    Illegal instruction: 4
    
  6. thdxr commented on Jun 20, 2025

    @thdxr
    Member

    ok so i think that's the one that's brew installed? let me try to recreate i have a macbook air m3

  7. topdown commented on Jun 20, 2025

    @topdown
    Author

    No. I used npm npm i -g opencode-ai@latest

    But I have tried both with the same results.

    I just checked claude code and it runs from claude: aliased to /Users/jeffrey/.claude/local/claude

    Digging deeper I find that its real path is
    /usr/local/lib/node_modules/opencode-ai/bin/opencode

  8. chipit24 commented on Jun 20, 2025

    @chipit24

    @topdown Did you potentially have https://github.com/opencode-ai/opencode installed from before? It's got the same name, though I couldn't get their tool to work properly 😅 Before trying the Better™ opencode, I made sure to remove that one (brew uninstall opencode-ai/tap/opencode).

    FWIW, I use mise and which opencode prints this for me:

    /Users/robertkomaromi/.local/share/mise/installs/node/22.16.0/bin/opencode
    
  9. topdown commented on Jun 21, 2025

    @topdown
    Author

    @topdown Did you potentially have https://github.com/opencode-ai/opencode installed from before? It's got the same name, though I couldn't get their tool to work properly 😅 Before trying the Better™ opencode, I made sure to remove that one (brew uninstall opencode-ai/tap/opencode).

    FWIW, I use mise and which opencode prints this for me:

    /Users/robertkomaromi/.local/share/mise/installs/node/22.16.0/bin/opencode
    

    No. I have a clean system.
    I checked for both that one and this one in Brew and NPM
    Both clean.

  10. Lolleka commented on Jul 5, 2025

    @Lolleka

    I have the exact same issue. Tried all install sources, but no dice.

  11. sigginjals commented on Jul 7, 2025

    @sigginjals

    Same problem here.

  12. topdown commented on Jul 7, 2025

    @topdown
    Author

    Ok, so I forked it.
    Tried to install dependencies, got lame errors, so as a guess I updated bun.
    Then the dependencies are installed.

    The first startup took forever, to the point I thought it failed to do anything.
    It asked me for a provider key, I picked Google, gave it my key

    Then it installed Go, and a bunch of Go dependencies.

    Finally I see the OpenCode screen. But, init does nothing, I do not see any way to switch providers, and sending a message gives me an error

    Image

    Typing /editor opened Cursor with a md file at some crazy path

    Image

    So basically there is nothing I can do with OpenCode, its basically useless on my machine currently.

  13. niwoerner commented on Jul 14, 2025

    @niwoerner

    Same issue here on the m1 max

  14. sambradbury commented on Jul 15, 2025

    @sambradbury

    Similar issue on M4 Max when trying to install with brew

     ~/ brew install sst/tap/opencode
    Warning: sst/tap/opencode 0.3.5 is already installed and up-to-date.
    To reinstall 0.3.5, run:
      brew reinstall opencode
     ~/ which opencode
    /usr/local/bin/opencode
     ~/ opencode auth login
    ============================================================
    Bun v1.2.17 (282dda62) macOS x64
    macOS v15.2
    CPU: sse42 popcnt
    Args:
    Features: no_avx2 no_avx
    

    The app just hangs and doesn't do anything when I try to run the auth login command. Trying to install with npm yields the same result.

     ~/ npm i -g opencode-ai@latest
    
    added 2 packages in 2s
     ~/ opencode auth login
    ============================================================
    Bun v1.2.17 (282dda62) macOS x64
    macOS v15.2
    CPU: sse42 popcnt
    Args:
    Features: no_avx2 no_avx
    
  15. thdxr commented on Jul 15, 2025

    @thdxr
    Member

    trying to understand the issue - this is only with brew installed versions of opencode?

  16. sambradbury commented on Jul 15, 2025

    @sambradbury

    trying to understand the issue - this is only with brew installed versions of opencode?

    I had the same experience with both the brew installed and npm installed versions. I'm on Sequoia 15.2 for reference.

  17. niwoerner commented on Jul 16, 2025

    @niwoerner

    I was also facing this issue when installing via brew and npm.

    Installing the binary directly worked for me. The following steps installed it successfully (Apple m1 max):

    curl -LO https://github.com/sst/opencode/releases/download/v0.3.13/opencode-darwin-arm64.zip
    unzip opencode-darwin-arm64.zip
    chmod +x opencode
    sudo mv ./opencode /usr/local/bin/opencode
  18. topdown commented on Jul 16, 2025

    @topdown
    Author

    trying to understand the issue - this is only with brew installed versions of opencode?

    No, both brew and npm fail to work.

  19. thdxr commented on Jul 16, 2025

    @thdxr
    Member

    pretty confused by this - i'm not sure what is the common thread here that is causing it

  20. thdxr commented on Jul 16, 2025

    @thdxr
    Member

    i can't reproduce it either so i'm going to have to hope someone who can can get to the bottom of it

  21. sambradbury commented on Jul 16, 2025

    @sambradbury

    I was able to resolve the problem by following the instructions here for migrating homebrew from intel to apple architecture.

    After updating my path things work as expected. I'm assuming something similar is going on with npm installs.

     ~/ which opencode
    /opt/homebrew/bin/opencode
     ~/ opencode auth login
    
    ┌  Add credential
    │
    ◆  Select provider
    │  ● Anthropic (recommended)
    │  ○ GitHub Copilot
    │  ○ OpenAI
    │  ○ Google
    │  ○ Amazon Bedrock
    │  ○ Azure
    │  ○ DeepSeek
    │  ...
    └
    
  22. 1jss commented on Jul 23, 2025

    @1jss

    I have the same issue on intel mac when installing via npm.

    % npm i -g opencode-ai@latest 
    added 2 packages in 9s
    % which opencode
    /Users/myname/.nvm/versions/node/v22.17.1/bin/opencode
    % opencode
    zsh: illegal hardware instruction  opencode
    

    I first thought my environment was bad, but have since installed other things via npm that work as intended.

    I also tried downloading the binary and installing it manually as niwoerner suggested but with the same result. I made sure no other opencode was found on the system before installing it and that which found it correctly.

    % which opencode
    opencode not found
    % sudo mv ./opencode /usr/local/bin/opencode
    Password:
    % which opencode                            
    /usr/local/bin/opencode
    % opencode                                  
    zsh: illegal hardware instruction  opencode
    
  23. jacquesbh commented on Aug 10, 2025

    @jacquesbh

    Hi!

    I had all those issues, with npm and brew.

    I finally decided to remove all the installed versions I had (so npm and brew…) and to use bun install -g opencode-ai.

    Now it works well :)

    Edit:
    Impossible to run it using tmux. Also I get a very very very slow bun installation process for llms setup.

  24. JonneDatanen commented on Aug 19, 2025

    @JonneDatanen

    I have exactly the same issue on Intel Macbook Air running Linux. The exactly same configuration works perfectly fine on Lenovo PC.

  25. jacquesbh commented on Sep 17, 2025

    @jacquesbh

    I did update macOS, all homebrew packages and opencode obviously. And it works well.

  26. topdown commented on Oct 3, 2025

    @topdown
    Author

    For me it was a HomeBrew issue, which the intel version was installed instead of the ARM version for silicon.
    I just fixed the HomeBrew installation and OpenCode finally installed and works.

    NOTE: this issue affects both installation types, HomeBrew and NPM.

    1. Make sure your NPM and Node are ARM if you are on an Apple Silicon Mac.
    2. Make sure Homebrew is the ARM version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions