Install on Apple M3 Max #186

Closed
opened 2026-02-16 17:25:38 -05:00 by yindo · 25 comments
Owner

Originally created by @topdown on GitHub (Jun 20, 2025).

Originally assigned to: @thdxr on GitHub.

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
Originally created by @topdown on GitHub (Jun 20, 2025). Originally assigned to: @thdxr on GitHub. 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 ```
yindo closed this issue 2026-02-16 17:25:38 -05:00
Author
Owner

@chipit24 commented on GitHub (Jun 20, 2025):

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

@chipit24 commented on GitHub (Jun 20, 2025): I have an Apple M3 Max MacBook Pro and installed opencode via `npm i -g opencode-ai@latest` and it runs without issue.
Author
Owner

@topdown commented on GitHub (Jun 20, 2025):

hmmm. I did the same.
A couple times.

I will try again and do some debugging

@topdown commented on GitHub (Jun 20, 2025): hmmm. I did the same. A couple times. I will try again and do some debugging
Author
Owner

@thdxr commented on GitHub (Jun 20, 2025):

can you run which opencode and show me where it is

@thdxr commented on GitHub (Jun 20, 2025): can you run `which opencode` and show me where it is
Author
Owner

@topdown commented on GitHub (Jun 20, 2025):

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
@topdown commented on GitHub (Jun 20, 2025): ``` 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 ```
Author
Owner

@thdxr commented on GitHub (Jun 20, 2025):

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

@thdxr commented on GitHub (Jun 20, 2025): ok so i think that's the one that's brew installed? let me try to recreate i have a macbook air m3
Author
Owner

@topdown commented on GitHub (Jun 20, 2025):

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

@topdown commented on GitHub (Jun 20, 2025): 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`
Author
Owner

@chipit24 commented on GitHub (Jun 20, 2025):

@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
@chipit24 commented on GitHub (Jun 20, 2025): @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`](https://mise.jdx.dev) and `which opencode` prints this for me: ``` /Users/robertkomaromi/.local/share/mise/installs/node/22.16.0/bin/opencode ```
Author
Owner

@topdown commented on GitHub (Jun 21, 2025):

@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.

@topdown commented on GitHub (Jun 21, 2025): > [@topdown](https://github.com/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`](https://mise.jdx.dev) 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.
Author
Owner

@Lolleka commented on GitHub (Jul 5, 2025):

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

@Lolleka commented on GitHub (Jul 5, 2025): I have the exact same issue. Tried all install sources, but no dice.
Author
Owner

@sigginjals commented on GitHub (Jul 7, 2025):

Same problem here.

@sigginjals commented on GitHub (Jul 7, 2025): Same problem here.
Author
Owner

@topdown commented on GitHub (Jul 7, 2025):

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.

@topdown commented on GitHub (Jul 7, 2025): 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 <img width="511" height="161" alt="Image" src="https://github.com/user-attachments/assets/cd2dc0d3-126f-45c1-803a-d2105bb990e0" /> Typing /editor opened Cursor with a md file at some crazy path <img width="602" height="25" alt="Image" src="https://github.com/user-attachments/assets/de249142-c0ba-4a5d-bcb8-606bd9cea810" /> So basically there is nothing I can do with OpenCode, its basically useless on my machine currently.
Author
Owner

@niwoerner commented on GitHub (Jul 14, 2025):

Same issue here on the m1 max

@niwoerner commented on GitHub (Jul 14, 2025): Same issue here on the m1 max
Author
Owner

@sambradbury commented on GitHub (Jul 14, 2025):

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
@sambradbury commented on GitHub (Jul 14, 2025): 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 ```
Author
Owner

@thdxr commented on GitHub (Jul 15, 2025):

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

@thdxr commented on GitHub (Jul 15, 2025): trying to understand the issue - this is only with brew installed versions of opencode?
Author
Owner

@sambradbury commented on GitHub (Jul 15, 2025):

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.

@sambradbury commented on GitHub (Jul 15, 2025): > 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.
Author
Owner

@niwoerner commented on GitHub (Jul 16, 2025):

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
@niwoerner commented on GitHub (Jul 16, 2025): 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): ```sh 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 ```
Author
Owner

@topdown commented on GitHub (Jul 16, 2025):

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

No, both brew and npm fail to work.

@topdown commented on GitHub (Jul 16, 2025): > trying to understand the issue - this is only with brew installed versions of opencode? No, both brew and npm fail to work.
Author
Owner

@thdxr commented on GitHub (Jul 16, 2025):

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

@thdxr commented on GitHub (Jul 16, 2025): pretty confused by this - i'm not sure what is the common thread here that is causing it
Author
Owner

@thdxr commented on GitHub (Jul 16, 2025):

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

@thdxr commented on GitHub (Jul 16, 2025): i can't reproduce it either so i'm going to have to hope someone who can can get to the bottom of it
Author
Owner

@sambradbury commented on GitHub (Jul 16, 2025):

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
│  ...
└
@sambradbury commented on GitHub (Jul 16, 2025): I was able to resolve the problem by following the instructions [here](https://medium.com/@ravi.mba.techie/a-minimalist-guide-to-migrate-homebrew-from-intel-macs-to-apple-silicon-macs-in-a-simple-5-steps-3e545576dab5) 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 │ ... └ ```
Author
Owner

@1jss commented on GitHub (Jul 23, 2025):

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
@1jss commented on GitHub (Jul 23, 2025): 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](https://github.com/sst/opencode/issues/256#issuecomment-3077070880) 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 ```
Author
Owner

@jacquesbh commented on GitHub (Aug 10, 2025):

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.

@jacquesbh commented on GitHub (Aug 10, 2025): 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.
Author
Owner

@JonneDatanen commented on GitHub (Aug 19, 2025):

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

@JonneDatanen commented on GitHub (Aug 19, 2025): I have exactly the same issue on Intel Macbook Air running Linux. The exactly same configuration works perfectly fine on Lenovo PC.
Author
Owner

@jacquesbh commented on GitHub (Sep 17, 2025):

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

@jacquesbh commented on GitHub (Sep 17, 2025): I did update macOS, all homebrew packages and opencode obviously. And it works well.
Author
Owner

@topdown commented on GitHub (Oct 3, 2025):

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.
@topdown commented on GitHub (Oct 3, 2025): 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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#186