6 ms·
Ghostty compiled to WASM with xterm.js API compatibility
- someguy101010 10mo agonice one kyle! you could add https://github.com/wasmerio/webassembly.sh https://github.com/wasmerio/webassembly.sh and have a fully featured in browser shell with support for installing packages!
- kylecarbs 10mo agoI'll do this for a much improved demo! Currently you need the command-line to try it, which is an unfortunate UX.
- syrusakbary 10mo agoThis is awesome! I'm Syrus, from Wasmer. Would love to help you with this! We are releasing soon a new version of wasmer-js, so it should be very easy to use it with webassembly.sh (note webassembly.sh and wasmer.sh share the same code) https://github.com/wasmerio/wasmer-js/tree/main/examples/wasmer.sh https://github.com/wasmerio/wasmer-js/tree/main/examples/was...
- kylecarbs 10mo agoNeat. I'll take a look. Thanks Syrus!
- syrusakbary 10mo agoEverything went smooth (just added a new comment on top of this thread for visibility!), only nit is that `convertEol` didn't work, so I had to manually convert `\n` to `\r\n`.
- mitchellh 10mo agoHoly shit Kyle. I had no idea you were working on this. This is amazing. Your patch is also very instructive on what you need me to do for you to make this more reasonable. I'm guessing that performance of this relative to xterm right now isn't... the best, mainly because the way you're grabbing the viewport seems expensive. I'm curious though if you did any benchmarks? One thing you probably really want to expose is the new RenderState API: https://github.com/ghostty-org/ghostty/blob/main/src/terminal/render.zig https://github.com/ghostty-org/ghostty/blob/main/src/termina... You're doing per row line grabbing currently which is probably pretty slow. The RenderState API is stateful and produces the state necessary to create a high-performance, delta update renderer. It's what our production GPU renderers are now built on (but the API itself is compatible with any kind of renderer). It'd be better for you. After all that, I'm very curious even at this rudimentary level what the performance on various benchmarks look like compared to xterm.js. Excellent work!
- kylecarbs 10mo agoWe spent little time on performance so far, this is more of a POC that will hopefully become a drop-in replacement for xterm.js over time. I'll swap it over to the new RenderState API and post some benchmarks! Many kudos to y'all, we were shocked how simple it was to hack this together.
- VikingCoder 10mo agoSo, could someone now make a Visual Studio Code (and specifically code-server) that has ghostty-web as the Terminal?
- kylecarbs 10mo agoYup, that's the idea!
- westurner 10mo agoHow to compile the userspace, though? Have you seen container2wasm or ktock/vscode-container-wasm? container2wasm: https://github.com/container2wasm/container2wasm https://github.com/container2wasm/container2wasm ktock/vscode-container-wasm: https://github.com/ktock/vscode-container-wasm https://github.com/ktock/vscode-container-wasm ktock/vscode-container-wasm-gcc-example: https://github.com/ktock/vscode-container-wasm-gcc-example https://github.com/ktock/vscode-container-wasm-gcc-example From joelseverin/linux-wasm: https://github.com/joelseverin/linux-wasm https://github.com/joelseverin/linux-wasm : > Hint: Wasm lacks an MMU, meaning that Linux needs to be built in a NOMMU configuration. Wasm programs thus need to be built using -fPIC/-shared. Alternatively, existing Wasm programs can run together with a proxy that does syscalls towards the kernel. In such a case, each thread that wishes to independently execute syscalls should map to a thread in the proxy. The drawback of such an approach is that memory cannot be mapped and shared between processes. However, from a memory protection standpoint, this property could also be beneficial.
- westurner 10mo agoA bit OT here, but oh well Would hardened_malloc or llvm scudo be useful in a WASM runtime (given that WASM doesn't have an MMU)? https://www.google.com/search?q=would+hardened_malloc+be+useful+in+a+wasm+runtime https://www.google.com/search?q=would+hardened_malloc+be+use... Emscripten handles malloc and free with dlmalloc, emmalloc, mimalloc, emcc your_code.c -s 'MALLOC="emmalloc"' -o your_code.html how to add "hardened_malloc" memory allocator support to emscripten for WASM? https://www.google.com/search?q=how+to+add+%22hardened_malloc%22+memory+allocator+support+to+emscripten+for+WASM%3F https://www.google.com/search?q=how+to+add+%22hardened_mallo... "Import custom memory manager?" · Issue #24851 · emscripten-core/emscripten https://github.com/emscripten-core/emscripten/issues/24851 https://github.com/emscripten-core/emscripten/issues/24851 Just learned about Cage: Cage does Hardware-Accelerated Safe WebAssembly (WASM) with LLVM with support for ARM64 Memory Tagging Extension (MTE) and Pointer Authentication (PAC) memory safety features. "Cage: Hardware-Accelerated Safe WebAssembly" (2024) https://arxiv.org/abs/2408.11456v2 https://arxiv.org/abs/2408.11456v2
- indemnity 10mo agoOh damn, this is awesome. I wonder if https://github.com/zed-industries/zed/discussions/18129 https://github.com/zed-industries/zed/discussions/18129 is still accurate. Would love to be able to use Ghostty as my Zed terminal.
- kylecarbs 10mo agoThey could certainly compile Ghostty and link into it from Rust. I couldn't imagine it'd be that large of an undertaking.
- dfee 10mo agoi switched from alacritty -> ghostty, and occasionally use zed. i can't recall why i made the transition (maybe just to try it out, and it became default?). i can't think of any practical consequences of this transition. why do you care about whether zed uses alacritty or ghostty under the hood?
- indemnity 10mo agoKitty Graphics Protocol support and subtle font rendering differences between Ghostty and Alacritty that drive me nuts. I have reported font rendering issues to Alacritty in the past and let's just say the developer was not exactly receptive to fixing them since they occur on macOS and not his preferred OS of Linux.
- dcre 10mo agoJust want to second this. I find Zed nearly unusable due to weird rendering in the terminal.
- cirwin 10mo agoWe'd love to (and, tbh, likely will). Search had been a blocker, but that's coming soon; beyond that not sure that there's any reason other than inertia. Alacritty is totally fine, but excited for the Ghostty focus on performance (obviously), and the font rendering stuff looks excellent (though TBD how much of that we can "just use" vs needing to copy-pasta)
- ivanjermakov 10mo agoNo hosted demo?
- kylecarbs 10mo agoIt's tricky to do without a compute environment. We can easily make a browser shell that let's people run basic commands, but presumably most want to try `vim` and other commands they'd typically invoke.
- gregsadetsky 10mo agoIf you have a Dockerfile that bundles ghostty-web with a backend (even just `ttyd` or a simple socket server), I’d love to host the official demo for you. We can give it a dedicated isolated environment so people can run vim safely.
- kylecarbs 10mo agoThat would be great! `npx @ghostty-web/demo@next` starts an HTTP server on `localhost:8080`, so you could just wrap a basic Dockerfile with NPM installed (and maybe a variety of fun Linux tooling, ala vim). Feel free to shoot me an email: kyle@coder.com. I'll happily add it to the README.
- gregsadetsky 10mo agoJust emailed you! Demo: https://ghostty.ondis.co/ https://ghostty.ondis.co/
- kylecarbs 10mo agoAdded it to the README! Thanks again :)
- VikingCoder 10mo agoUm, maybe Zork? https://github.com/olson-dan/rustzork https://github.com/olson-dan/rustzork
- jumploops 10mo agoOh man this is awesome. Recently integrated xterm.js on a new project and was frustrated with the limitations. Great work!
- kylecarbs 10mo agoAwesome. If you happen to integrate it and find any bugs, please give us a shout!
- oersted 10mo agoDoes this version support custom GPU shaders? I have been looking for a command-line with cool-retro-term aesthetics that can run in the browser for a while.
- kylecarbs 10mo agoI'd have to let Mitchell answer this accurately. Considering the native Ghostty does, I _think_ the answer would be yes? I might tinker around with this and let you know.
- mitchellh 10mo agoIt's maybe possible. Custom shaders are OpenGL syntax so it'd require transforming them to something compatible with WebGL/WebGPU. In Ghostty GUI we use spire-cross and glslang to transpile shaders at runtime from OpenGL to Metal or OpenGL (with features our host supports). We'd have to look and see if these support WebGL/GPU. The next problem would be making all that fit into the wasm blob. Or, we may be able to skip most of this is the OpenGL syntax we use is already compatible. Then no transpiling necessary...
- VikingCoder 10mo agoSo now let's get ShaderGlass [1] and this to have a baby, so we can have cool-retro-term [2] in the browser. [1] https://github.com/mausimus/ShaderGlass https://github.com/mausimus/ShaderGlass [2] https://github.com/Swordfish90/cool-retro-term https://github.com/Swordfish90/cool-retro-term
- pmarreck 10mo agoomg! Seriously, wow. That was quick! Only just heard that Hashimoto libbed out his terminal the other day and remarked about how smart that was... And it made this possible
- asadm 10mo agocan you do a hosted demo with jslinux (or similar) as backend? https://bellard.org/jslinux/ https://bellard.org/jslinux/
- kylecarbs 10mo agoWill do this!
- ghthor 10mo agoI’ll add this as an option to my fork of gotty, currently uses xterm.js
- gregsadetsky 10mo agoHere's v86 running in your browser with ghostty-web: https://bow-wrinkle-13326.ondis.co/ https://bow-wrinkle-13326.ondis.co/ You can also play around with a real shared containerized machine here: https://ghostty.ondis.co/ https://ghostty.ondis.co/
- warunsl 10mo agoI have no understanding of any of this except that Ghostty is an alternative to iTerm2. Can someone do a ELI5 for the uninitiated?
- shevy-java 10mo agoI also have ton of questions. Hopefully the author can add more documentation to ghostty. Right now I don't fully understand the use cases or how people may benefit from ghostty.
- oulipo2 10mo agoThis runs in the browser, so it would allow you to connect to a server from your browser and render normal terminal commands in that environment For instance if you're a cloud provider, and you want people to be able to "drop in a shell" on a machine, but make that available through the web, you could use this
- DiabloD3 10mo agoThat actually pretty much is the ELI5. Its merely a different terminal that offers more features than iTerm2 and also runs on OSX. Unless you actually need/want those features (which, although I am a terminal aficionado, I must admit are niche as fuck), pick whichever terminal makes you happy. Features that are important to some people are performance, Unicode support, and OS support. The most decidedly non-ELI5 feature comparison: https://www.jeffquast.com/post/state-of-terminal-emulation-2025/ https://www.jeffquast.com/post/state-of-terminal-emulation-2... and https://ucs-detect.readthedocs.io/results.html https://ucs-detect.readthedocs.io/results.html
- bisby 10mo agoYou could argue whether or not it's a "feature", but one of the thing ghostty claims as an advantage is the out of the box configuration. With no config at all, ghostty looks nicer than my alacritty setup. The rendering is just real nice. I could probably get alacritty to look as nice or nicer, but ghostty just worked this way with no config needed. So you could consider aesthetics and rendering quality, and simplicity of setup both as features, which people may need/want (or not).
- jordemort 10mo agoHm, might try hacking this into https://tsl0922.github.io/ttyd/ https://tsl0922.github.io/ttyd/
- kylecarbs 10mo agoLet me know if you encounter any issues! I'm working on performance benchmarks now.
- sigmonsays 10mo agobut why?
- kylecarbs 10mo agoSee the comparison: https://github.com/coder/ghostty-web?tab=readme-ov-file#comparison-with-xtermjs https://github.com/coder/ghostty-web?tab=readme-ov-file#comp... Ghostty has much better VT100 compatibility. It should have much better performance as well once we optimize.
- ghthor 10mo agoAny chance that it can take advantage of webgpu, or is it already doing that from this wasm build?
- svat 10mo agoThe comparison has two points one of which says that for "Complex scripts (Devanagari, Arabic)", ghostty-web has " Proper grapheme handling". But when I tried something extremely simple at the https://ghostty-web.wasmer.app/ https://ghostty-web.wasmer.app/ or https://ghostty.ondis.co/ https://ghostty.ondis.co/ demos (just `echo "कवि"`), it failed pretty miserably (and in different ways in the two demos). So I'm not sure what to make of it. (Seems slightly better in the actual Ghostty app, but not in any usable way: here was my comparison last year https://shreevatsa.net/post/terminal-indic/ https://shreevatsa.net/post/terminal-indic/ and Ghostty is comparable to the other terminal apps, better than some, worse than some. Anyway the fact that it works in Ghostty but not in ghostty-web casts doubt on “Ghostty's emulator is the same battle-tested code that runs the native Ghostty app”. Do you understand what is going on?)
- kylecarbs 10mo agoI'll take a look - not sure what's going on. I'll remove it from the README for now since it's not working in the demos. Thank you for letting me know!
- sreya 10mo agoIt's very much the same emulator but we're exposing a subset of functionality via WASM, in this case it wasn't handling grapheme codepoints correctly. It should be fixed on main (or @next).
- deleted 10mo ago[deleted]
- vadepaysa 10mo agoThis is fantastic. Under MIT even! Thank You!
- shortlived 10mo agoDo we have Windows support yet?
- kylecarbs 10mo agoIt should work! Our demo may not (as I haven't tested it, so don't want to advertise it).
- syrusakbary 10mo agoI've set up an online demo using Wasmer for local execution, so everyone can try easily! (try typing `cowsay hello`): https://ghostty-web.wasmer.app/ https://ghostty-web.wasmer.app/ How to try it locally: npx @ghostty-web/demo@next # The preferred way # OR wasmer run wasmer/ghostty-web -> Go to http://localhost:8080/ Source code: https://github.com/wasmerio/webassembly.sh https://github.com/wasmerio/webassembly.sh (updated from xterm into ghostty-web without any issue!)
- kylecarbs 10mo agoThis is awesome, thank you!
- VikingCoder 10mo agoJust fyi, I get no output from "cowsay hello" or "ls", and I see a bunch of errors in the Chrome JS debugger.
- syrusakbary 10mo agoThanks for the feedback! I just pushed a fix, please let me know if you encounter any other issues
- antonvs 10mo agoFyi, that online version works for me in Chrome, but not in Firefox (v145.0.2)
- pkage 10mo agoDoes not appear to work under Firefox, getting a bunch of CORS-related errors (header ‘user-agent’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response) on the /graphql endpoint.
- rothific 10mo agoThis is super cool! I'm close to releasing a project to make Ink work in the browser for building cross-platform terminal apps. (Ink is what Claude Code / Gemeni CLI use for rendering.) Currently it uses Xterm.js - but I'll have to try swapping Xterm out for ghostty-web!
- deleted 10mo ago[deleted]
- rothific 10mo agoI got ghostty-web working with this and it is great. Unfortunately it seems I don't have enough karma to post a link to it. But it's ink-web on npm if you're interested! The nice thing about this is that you do not need an OS / backend of any kind - everything runs in the browser - similar to webcontainers but without even needing a container.
- to_be_coder 10mo ago[dead]
- clintonc 10mo agoCurious to know what makes this "a proper VT100 implementation in the browser, not a JavaScript approximation of one" -- isn't Ghostty also an approximation, just implemented in a different language? Seems unnecessarily pejorative to me.
- kylecarbs 10mo agoAgreed. I removed "not a JavaScript approximation of one" from the README.
- chjj 10mo agoI don't mean to derail discussion about a cool project, but it still seems to imply xterm.js is somehow "improper" emulation (though I might be misreading it). Terminal emulators are all approximations of terminals, regardless of the programming language.
- kylecarbs 10mo agoThey are approximations but Ghostty has intentional effort towards correctness, more than I've seen from other terminal emulators.
- badmonster 10mo agoFair clarification. Does Ghostty's WASM approach have performance advantages over pure xterm.js implementations?
- solotronics 10mo agoI always thought it would be interesting in backend systems to catch a certain exceptions and auto-generate a link to a shell. Given the proper authentication is implemented would this be a good tool to achieve that "remote debug" shell?
- riddley 10mo agoSomeone finally figured out how to make it work under Linux!
- hexasquid 10mo agoNot sure I understand :) it's certainly available in nixos https://github.com/NixOS/nixpkgs/blob/nixos-25.11/pkgs/by-name/gh/ghostty/package.nix#L166 https://github.com/NixOS/nixpkgs/blob/nixos-25.11/pkgs/by-na...
- riddley 10mo agoOh it's available, but it only works for about 5 minutes and then it becomes so slow that it's unusable. There was a very long issue about it that was closed with seemingly no effort on behalf of the maintainers.
- jxdxbx 10mo agoGhostty is so great. Cross-platform but native on Mac and Linux. Core written in a cool random language, showing that you can have well-behaved Mac apps that aren’t just pure Swift / Objective C. Same great design no doubt helps here.
- jtbaker 10mo agoThe only thing I want (on MacOS) is the ability to search for text within a winodw, like when I'm debugging a stack trace, and multi-tab support.
- qudat 10mo agoText search has been merged on main
- LVB 10mo agoCould you explain what you mean by multi-tab support? I use Ghostty daily with multiple tabs.
- jtbaker 10mo agoI wasn't clear, I mean split-pane side by side (or top-bottom etc.) tab views, like iTerm offers.
- deleted 10mo ago[deleted]
- dagi3d 10mo agochange update channel to tip and you'll have it
- qudat 10mo agolibghostty is stellar! I’m using it for my session persistence for terminal processes tool: https://github.com/neurosnap/zmx https://github.com/neurosnap/zmx When users reattach to their session we render the terminal state and output from ghostty. Super cool and works really well. It’s basically tmux-lite in 1k LoC
- gregsadetsky 10mo agoHey all, you can try ghostty-web here: https://ghostty.ondis.co/ https://ghostty.ondis.co/ Stellar work, Kyle! Cheers
- dwood_dev 10mo agoDoesn't trigger keyboard popup on my iPhone in Safari. :(
- gregsadetsky 10mo agoThis may be above my pay grade (does xterm support mobile input?) but I’ll take a look!
- rothific 10mo agoYep! It does
- gregsadetsky 10mo agoThanks for confirming! Made it work on my iPhone and opened a PR :-) https://github.com/coder/ghostty-web/pull/76 https://github.com/coder/ghostty-web/pull/76
- kylecarbs 10mo agoTaking a look now - thanks!
- gregsadetsky 10mo agoupdate: fixed, merged and deployed :-) cheers
- neomantra 10mo agoI have been looking for this for a while — thank you for making it! I’m gonna explore how I can deploy my BubbleTea TUI’s with it.
- quantummagic 10mo agoIs there any way for Ghostty to grab all keystrokes? It's a bit of a drag to type ctrl-w inside of Vim, and have the entire browser-tab close ;-)
- guns 10mo agoYou could use Firefox and then set the accelerator key to Super, changing all application bindings to use Super instead of Control. This is my setup and it’s great.
- quantummagic 10mo agoI'm curious how you set the accelerator key choice, to Super? Does that let you use function keys inside the Ghostty terminal too?
- guns 10mo agohttps://github.com/mozilla-firefox/firefox/blob/FIREFOX_143_0_RELEASE/modules/libpref/init/StaticPrefList.yaml#L17720 https://github.com/mozilla-firefox/firefox/blob/FIREFOX_143_... # Use 17 for Ctrl, 18 for Alt, 91 or 224 for Meta, 0 for none. - name: ui.key.accelKey type: uint32_t #ifdef XP_MACOSX value: 224 #else value: 17 #endif // user.js user_pref("ui.key.accelKey", 91);
- joshka 10mo agoNeat. Would be cute to see this in VSCode to replace the terminal there...
- aidenyb 10mo agoThis is great. I've been using code-server to embed VSCode into the browser and been missing the terminal functionality. Excited to try this out.
- tuananh 10mo agoI'm just here to say coder is great! We love it. Thanks @kylecarbs and the team.
- kylecarbs 10mo agoThanks for being a user :)
- nineteen999 10mo agoAlways love seeing new vt100 implementations! Here's my current pet one running inside Unreal5: https://imgur.com/a/2vsGS0G Vibe coding with Claude in a UE5 Editor tab is a lot of fun ... especially once you give it access to the Remote Control API in UE5, it can control an avatar, take screenshots. All very helpful for debugging 3d games: ### Photo Log | Filename | Description | |----------|-------------| | ClaudePOV_20251202_134349_2.png | First 720p test - VT100 terminal visible | | ClaudePOV_20251202_143259_4.png | Inside hyperspace tunnel - green rings | | ClaudePOV_20251202_143325_5.png | Tunnel with pink/purple shift | | ClaudePOV_20251202_143432_6.png | BX-2100 silhouette, purple nebula | | ClaudePOV_20251202_143655_7.png | BX-2100 close-up, cockpit visible | Love Claude. It can build me a Hyperspace GLSL shader in Unreal 5, but it can't get the column headers right in it's screenshot list.
- deleted 10mo ago[deleted]
- dygd 10mo agoCan you explain how Claude interacts with the UE Editor? Does it use the Remove Control API through MCP?
- nineteen999 10mo agoI haven't really looked at MCP because it sounds like it is little bit broken? The Remote Control API is just HTTP/JSON so Claude wrote some powershell scripts to query objects from the endpoint. We gave Claude a Character Actor in game with an AI controller attached, and it can call functions to the AIController - MovetoXYZ(), Teleport(), TakeScreenshot() etc
- dygd 10mo agoThank you, that's really cool!
- nineteen999 10mo ago
- westurner 10mo agoNot able to enter text on mobile From "WebAssembly (WASM) arch support for the Linux kernel" (2025) https://news.ycombinator.com/item?id=45784329 https://news.ycombinator.com/item?id=45784329 : > JupyterLite still lacks a Terminal e.g. with BusyBox Ash in WASM, with a file system integrated with the Jupyter-xeus kernel file system. > This [joelseverin/linux-wasm] appears to load much more quickly than other Linux and I think even just bash in WASM demos I've seen.
- deleted 10mo ago[deleted]
- emadda 10mo agoI built a macOS app that uses Ghostty and fzy to fuzzy search over Apple Note titles. It is working quite well for me. https://github.com/emadda/hot-notes/ https://github.com/emadda/hot-notes/
- royaltjames 10mo agoYo this is brilliant.
- xmorse 10mo agoI made something similar that lets you run TUI applications inside other terminals via ghostty-vt, to implement things like TMUX in opentui It will be used to render ANSI inside opencode https://github.com/remorses/ghostty-opentui https://github.com/remorses/ghostty-opentui
- royaltjames 10mo agoI love ghostty and I love this