opencode.ai

I once briefly came across github fork for OPENCODE but it had no FreeBSD specific info (early stage fork attempt?) but I can't find it anymore (got deleted?).
Does anyone know of a way to get opencode running on FreeBSD natively without linuxlator or bhyve?
Thanks

open_code.png
 
LLM wizard is unfortunately high on mushrooms or something. Keeps lying, that it can be installed on any OS and confuses it repeatedly with the other opencode software.

So... download the source code and try to compile it and get it to run?

Completely lost why people don't do this any more. Literally -- we would receive and/or download the source code "just like this" to whatever platform we were using, make whatever software changes were required, get it to compile and run and .. then you are all good for like... forever !

Do you think we all sat around waiting for "someone else" to get source code running for us instead?

Or the AI to get updated to do it for us?
 
So... download the source code and try to compile it and get it to run?

Completely lost why people don't do this any more. Literally -- we would receive and/or download the source code "just like this" to whatever platform we were using, make whatever software changes were required, get it to compile and run and .. then you are all good for like... forever !

Do you think we all sat around waiting for "someone else" to get source code running for us instead?

Or the AI to get updated to do it for us?
Asking on a forum if someone already did it or knows about someone who did takes minutes.
I am old. My days are short.
 
Asking on a forum if someone already did it or knows about someone who did takes minutes. I am old. My days are short.
Asking on a forum if someone already did it or knows about someone who did takes minutes.
I am old. My days are short.
I'm about to try. I'll let you know.

EDIT1: I just found that I have about 400K left in my root drive. Gonna need to fix that when I can. I'll let you know when I can continue on. So far, I've installed ubuntu compatibility and am trying that rout. All of the standard install instructions failed with architecture complaints.
 
I once briefly came across github fork for OPENCODE but it had no FreeBSD specific info (early stage fork attempt?) but I can't find it anymore (got deleted?).
Does anyone know of a way to get opencode running on FreeBSD natively without linuxlator or bhyve?
Thanks
You're thinking of skywalk163. That project (to my knowledge) never worked. Looks like a raw fork. I briefly started working on it this morning. Not that easy since it seems to rely on bun, and there doesn't seem to be a way to make bun work on freebsd.
I tried the linux emulation way, but got prctl option 42 and 41 errors that seem emulator related...

I'll let you know if I get it working (i'll github it), but if you or anyone can make it work first I'd love to know.
 
Update: I've been busy at work and rebuilding the engine in my work truck, so I wasn't able to try again until today. I got the Debian bookworm compat layer up and working, and technically installed, but pic related is the result. I'll keep picking at it when I can, but this wasn't a very promising end state.
 

Attachments

  • opencodefail.jpg
    opencodefail.jpg
    189.6 KB · Views: 76
After trying to run pretty much every agent, the only one that worked (for me) out of the box was claude. I installed it through npm

pkg install nodejs npm
npm install -g @anthropic-ai/claude-code

Then I had to mess with the path and the config for the provider (I source from lm studio on my own network). Otherwise it wants you to login which I don't.

My goal was to bootstrap any agent to vibe-code the migration of hermes. Since my goal is done, I won't be working on the opencode problem, but if people need help setting up claude, well, try AI first, but I took notes so feel free to ask.
 
Opencode needs Bun and Bun does not support FreeBSD. There was preliminary support for FreeBSD being added to Bun back in November, but it wasn't functional and just messed up their CI so they ripped it out. I've tried to patch it back in but it has been an uphill battle.

Also Bun requires Bun to build itself, another annoying problem. And Bun relies on Zig, but not even a specific Zig release -- they rely on a custom Zig build instead of a release (Zig is already a moving target right now) which doesn't match the functionality of any existing Zig release. So they're essentially using a forked version of Zig.

It's a real mess. I put in several hours of work without much to show for it.

edit: I just found someone reported they got Bun to build on FreeBSD, so maybe there's a chance now...
 
OpenCode also has an interesting approach to security:

 
I can't find details about what it is. Any English txt file that covers that? For open source, they seem to love branding. No wikipedia entry? It can be used offline without any paid AI service? I would like that, a decentral distributed learning system.
 
I managed to get bun built but had to workaround some errors, likely due to changes since the script/patches were written: https://github.com/8ff/bun-freebsd/issues/1

something is still not quite right though. I was in the process of building opencode with this copy of bun and got a SIGILL. I noticed in the build output for some reason there was --march=haswell being used. Not entirely sure where this came from because I'm on an AMD Ryzen. My current guess is that there's a bug in their fork of Zig which has CPU detection but I should be able to turn off building for native CPU arch... will report back if I can solve this
 
With this degree of trouble, would it actually be less work than building a simple native program? We're just passing though json, right?

***

On a side note, I tried sidestepping the problem by installing vs code and using copilot through that. It also failed with its own set of problems.
 
With this degree of trouble, would it actually be less work than building a simple native program? We're just passing though json, right?

***

On a side note, I tried sidestepping the problem by installing vs code and using copilot through that. It also failed with its own set of problems.

You don't need opencode. You can just use a LLM in a web browser. Upload your code through the browser. clipboard gets code out.
 
That's not very useful, I want tool calls, LSP, and MCP integrations. That's way more powerful.

I need to get back and finish it, but I had a development method where I was working on a partially broken audio driver (snd_hda) in FreeBSD where the microphone is not functioning, but speakers are working.


Running a custom kernel with the audio driver being modular for ease of development, I setup a workflow where it did this:

1. compare the hardware configuration from the Linux driver to the FreeBSD driver, try to achieve the same result
2. build the kernel module
3. unload the old driver
4. load the new driver
5. play a tone. attempt to record audio from the microphone, I will speak / make noise to test, play back to me what it recorded
6. it also analyzes the raw PCM captured to see what its noise floor was, try to figure out if we're making progress
7. take notes on results of those changes, repeat again in a loop

It was doing one of the most annoying, tedious things of trying to fix a driver in an automated loop while it sat on the corner of my desk and I worked on other things. And I got very close! It was picking up some crosstalk so I was getting close.

copying and pasting from a browser is kinda useless for real work.


edit: I had no private information on this laptop, and I had a ZFS snapshot in case it broke things running with sudo/root access. Nothing to be concerned about, really.
 
There is now a lang/bun port that I was successfully able to compile on one machine, but not another (SIGILL... trying again with llvm compiled from ports as well.)

This version of bun seems to be leaning on linux compat instead of the rather large set of patches on some of the branches Feld and I have been trying out, so it does seem to work... more effectively.

However, bun x opencode-ai still fails because it cannot find a freebsd binary.

Upon cloning the repo, bun install does work. However, bun run dev . yields

Code:
bun run dev .
$ bun run --cwd packages/opencode --conditions=browser src/index.ts .
104 | export function create(tags?: Record<string, any>) {
105 |   tags = tags || {}
106 |
107 |   const service = tags["service"]
108 |   if (service && typeof service === "string") {
109 |     const cached = loggers.get(service)
                         ^
ReferenceError: Cannot access 'loggers' before initialization.
      at create (/home/john/source/opencode/packages/core/src/util/log.ts:109:20)
      at /home/john/source/opencode/packages/opencode/src/storage/db.ts:28:17

Bun v1.3.14-canary.1+000000000 (FreeBSD x64)
error: script "dev" exited with code 1

Upon reviewing those files, this to me looks like a bug in bun itself, yet again, as the reference certainly is initialized... though, I don't know how to diagnose.

edit: Possibly https://github.com/anomalyco/opencode/pull/22752.
 
It's a complete alternative, but I forked Hermes completely and got it to work on FreeBSD with only make, rust and py311 as dependency. If you also install py311-sqlite3, the agent gains long term memory capabilities.

The project's name is Autolycus (son of Hermes). https://github.com/waym0reom3ga/autolycus-agent . I'm a bit behind in the the commits from upstream but should cherry pick the good ones over the next month. The command is "hermes setup" then "hermes". I run it connecting to a local server that has lm-studio running on it. Works great, but maybe not the most safe. It's like hermes.

Eventually I plan on making it more distinct, but for now I'm just trying to stay up to date.
 
In lieu of OpenCode, I will say that emacs with gptel + gptel-agent works pretty well and can connect to basically any LLM API and handle tool calling, etc. It's going to be significantly more lightweight too. There are some things I like better about this as you are basically chatting in a dedicated buffer which you can completely control so you can go back and edit/fix/remove things from the history (context) before sending the next query. This is something that has always annoyed me with some other tools as they don't let you as easily remove mistakes like a bad paste from the session. You can cancel the query and sometimes edit the last prompt, but other times you can't go back and completely remove it.

So if emacs is your thing I think it's worth checking out.
 
Back
Top