MacSurf: NetSurf for Mac OS 9
MacSurf: NetSurf for Mac OS 9
The modern web, on a 25-year-old Mac. MacSurf is a web browser for Classic Mac OS 9 PowerPC. CSS3, ES5 JavaScript, PNGs with alpha — running on a beige G3. 在 25 年前的 Mac 上运行现代网页。MacSurf 是一款专为经典 Mac OS 9 PowerPC 系统打造的网页浏览器。它支持 CSS3、ES5 JavaScript 和带 Alpha 通道的 PNG 图片,且能在米色 G3 电脑上流畅运行。
Warning: MacSurf is early alpha. It runs, it renders, it talks TLS 1.2 natively to real HTTPS sites (as of May 2026), and it executes JavaScript on a 233 MHz G3. That doesn’t mean it’s ready for daily driving — most of the modern web still won’t work in it. Heavy SPAs, modern CSS features we haven’t shipped, missing form interactions, slow JS on real hardware. Plenty is rough. But it’s ready for people to try. 警告: MacSurf 目前处于早期 Alpha 阶段。它能运行、能渲染、能通过原生方式与真实的 HTTPS 网站进行 TLS 1.2 通信(截至 2026 年 5 月),并能在 233 MHz 的 G3 处理器上执行 JavaScript。但这并不意味着它已经可以作为日常主力浏览器使用——大多数现代网页在其中仍无法正常工作。复杂的单页应用(SPA)、尚未实现的新版 CSS 特性、缺失的表单交互以及在真实硬件上缓慢的 JS 执行速度,这些地方都还很粗糙。但它已经准备好供大家尝试了。
If you’ve got a Power Mac G3 or G4 sitting around, please load it and see what breaks. Bug reports and screenshots from real hardware are exactly what this project needs. Contributors welcome too — there’s a lot of CSS, DOM, and JS surface left to fill in, and the code is plain C89 (the same C you’d have written in 1999). See docs/status.md for the current punch list.
如果你手头有闲置的 Power Mac G3 或 G4,请安装并测试它,看看哪里会出错。来自真实硬件的错误报告和截图正是本项目所需要的。同时也欢迎贡献者加入——还有大量的 CSS、DOM 和 JS 功能等待完善,而且代码是纯粹的 C89(和你 1999 年编写的 C 代码一样)。请查看 docs/status.md 获取当前的待办事项列表。
What you can expect: hand-built pages, retro-style sites, a respectable chunk of CSS Grid, native HTTPS with the full Mozilla CA bundle, and the strange thrill of running ES5 JavaScript on a PowerPC. 你可以期待: 手工构建的页面、复古风格的网站、相当一部分 CSS Grid 支持、带有完整 Mozilla CA 证书包的原生 HTTPS,以及在 PowerPC 上运行 ES5 JavaScript 的奇妙快感。
What you shouldn’t expect yet: smooth browsing on arbitrary modern sites, video, audio, WebGL, service workers, anything heavy on React. 你暂时不应期待: 在任意现代网站上流畅浏览、视频、音频、WebGL、Service Workers,以及任何重度依赖 React 的内容。
First numbered release was 0.1a1 in May 2026. Latest is v0.7 — Cleanup: twelve issues closed in a single sprint — cross-element var(), CSS Grid V2 alignment, image-purge on nav, standard-syntax gradients. Full notes in docs/release-notes/MacSurf-0.7.md.
第一个编号版本是 2026 年 5 月发布的 0.1a1。最新版本为 v0.7 —— 清理版:在一次冲刺开发中关闭了 12 个问题,包括跨元素 var()、CSS Grid V2 对齐、导航时清理图片缓存以及标准语法渐变。完整说明请见 docs/release-notes/MacSurf-0.7.md。
Why this exists
为什么会有这个项目
The web outgrew Classic Mac OS twenty years ago. Modern HTTPS finished it off around 2016. Pull a G3 or G4 out of the closet today and it can barely reach a single live website. MacSurf is an attempt to fix that on the machine itself — no screenshot proxy, no remote terminal trick. A native browser, built with the tools that were already on the platform: CodeWarrior, Carbon, QuickDraw, Open Transport. Real CSS3 layouts and real JavaScript, running inside the 64 MB memory floor of a 1999 iMac. 互联网在二十年前就已经超越了经典 Mac OS 的能力范围。现代 HTTPS 标准在 2016 年左右彻底终结了它的上网能力。今天,如果你从柜子里翻出一台 G3 或 G4,它几乎无法访问任何一个现存的网站。MacSurf 试图在机器本身上解决这个问题——没有截图代理,也没有远程终端的把戏。这是一个原生浏览器,使用该平台原有的工具构建:CodeWarrior、Carbon、QuickDraw 和 Open Transport。它能在 1999 年 iMac 的 64 MB 内存限制内,运行真实的 CSS3 布局和真实的 JavaScript。
Since late May 2026 it speaks TLS 1.2 directly to the modern web through macTLS, a BearSSL-based stack that ships inside the browser binary with 121 trust anchors from the Mozilla CA bundle. No proxy needed anymore. As far as we can tell, this is the first serious NetSurf port to Classic Mac OS, and the first browser ever shipped on Mac OS 9 with native CSS Grid, CSS custom properties, and ES5 JavaScript. 自 2026 年 5 月下旬起,它通过 macTLS 直接与现代网络进行 TLS 1.2 通信。macTLS 是一个基于 BearSSL 的协议栈,内置于浏览器二进制文件中,并包含了来自 Mozilla CA 证书包的 121 个信任锚点。不再需要代理。据我们所知,这是第一个针对经典 Mac OS 的严肃 NetSurf 移植版,也是 Mac OS 9 上第一个支持原生 CSS Grid、CSS 自定义属性和 ES5 JavaScript 的浏览器。
The progression
进化历程
Each shot below is a real milestone, captured on a Power Macintosh G3 running Mac OS 9. The fix-number annotations match this repo’s commit history. 下方的每一张截图都是一个真实的里程碑,均在运行 Mac OS 9 的 Power Macintosh G3 上捕获。修复编号注释与本仓库的提交历史相对应。
- v0.2: JavaScript on Mac OS 9 — First real-world JS-bearing page. Duktape 2.7.0 ES5 evaluating live: Math.sqrt, JSON, ES5 array methods. v0.2:Mac OS 9 上的 JavaScript —— 第一个包含真实 JS 的页面。Duktape 2.7.0 ES5 实时评估:Math.sqrt、JSON、ES5 数组方法。
- fixes73: CSS transforms — Native transform: rotate() / scale() / translate(). Integer Q15 sin/cos table, no FPU dependency, arbitrary angles on QuickDraw. fixes73:CSS 变换 —— 原生 transform: rotate() / scale() / translate()。使用整数 Q15 正弦/余弦表,无 FPU 依赖,在 QuickDraw 上实现任意角度旋转。
- fixes74d: radial gradients — 2-stop radial gradients via concentric PaintOval stack. 16 levels smeared on decode. Shape + position keywords parsed. fixes74d:径向渐变 —— 通过同心 PaintOval 堆栈实现双色径向渐变。解码时进行 16 级平滑处理。支持解析形状和位置关键字。
- fixes77: CSS animations — Linear ping-pong animation player on top of fixes73 rotation. Wiggle, swing, and full 0°→359° spin. fixes77:CSS 动画 —— 在 fixes73 旋转功能之上实现的线性往复动画播放器。支持摆动、摇摆和完整的 0°→359° 旋转。
- fixes79b: PNG transparency — QuickTime Graphics Importer feeding the NetSurf image content handler. PNG + GIF + BMP, all with real transparency. fixes79b:PNG 透明度 —— 通过 QuickTime 图形导入器为 NetSurf 图片内容处理器提供支持。PNG、GIF 和 BMP 均支持真实的透明度。
- fixes136: word-break / overflow-wrap — word-break: break-all, keep-all, white-space: nowrap, legacy word-wrap: break-word. URL-style aggressive wrapping. fixes136:换行处理 —— 支持 word-break: break-all, keep-all, white-space: nowrap 以及传统的 word-wrap: break-word。支持 URL 样式的强制换行。
- fixes147: stacking contexts — CSS 2.1 painting order. Opacity, transforms, and explicit z-index all create new stacking contexts, properly painted on real hardware. fixes147:堆叠上下文 —— CSS 2.1 绘制顺序。透明度、变换和显式的 z-index 都会创建新的堆叠上下文,并在真实硬件上正确绘制。
- fixes151: CSS Grid column placement — grid-column: span N, 1 / -1 full-row hero, positional start / end, span + auto-wrap. Real Grid layout on OS 9. fixes151:CSS Grid 列定位 —— 支持 grid-column: span N、1 / -1 全行显示、位置起始/结束、span + 自动换行。在 OS 9 上实现真正的网格布局。
The pieces
组成部分
- browser/ (C, C89, CW8): NetSurf fork with a macos9 frontend. Carbon for the UI, QuickDraw for drawing, Open Transport for networking, Duktape for JS. browser/ (C, C89, CW8):NetSurf 分支,带有 macos9 前端。使用 Carbon 处理 UI,QuickDraw 处理绘图,Open Transport 处理网络,Duktape 处理 JS。
- proxy/ (Go, stdlib only): The old TLS-stripping HTTP proxy. Largely retired now that macTLS works natively, but still useful as a fallback or on machines without CarbonLib. Mac sends plain HTTP, proxy fetches via HTTPS, returns plain HTTP. proxy/ (Go, 仅标准库):旧的 TLS 解密 HTTP 代理。随着 macTLS 的原生支持,它已基本退役,但在作为备用方案或在没有 CarbonLib 的机器上仍然有用。Mac 发送普通 HTTP,代理通过 HTTPS 获取内容,并返回普通 HTTP。
- macTLS (sibling repo, C, CW8): Native TLS 1.2 library for OS 9 — modern HTTPS straight from the Mac, no proxy required. BearSSL underneath, 121 trust anchors baked in. macTLS (兄弟仓库, C, CW8):OS 9 的原生 TLS 1.2 库 —— 直接从 Mac 进行现代 HTTPS 通信,无需代理。底层使用 BearSSL,内置 121 个信任锚点。
What works today
当前功能支持
- Rendering pipeline: Full NetSurf fetch → parse → cascade → layout → plot. Native libcss with var() resolution. QuickDraw plotters with an offscreen GWorld back-buffer. 渲染管线: 完整的 NetSurf 获取 → 解析 → 层叠 → 布局 → 绘制。带有 var() 解析的原生 libcss。使用离屏 GWorld 后备缓冲区的 QuickDraw 绘图器。
- CSS: ~150 properties, Custom properties/var(), Flex (justify-content, align-content, order), Grid V1, gap, border-radius, box-shadow, opacity, gradients, text-shadow, ellipsis, transform, z-index, counters, viewport units, aspect-ratio. CSS: 约 150 个属性,支持自定义属性/var()、Flex (justify-content, align-content, order)、Grid V1、gap、圆角、阴影、透明度、渐变、文字阴影、省略号、变换、z-index、计数器、视口单位、宽高比。
- JavaScript: Duktape 2.7.0, full ES5 (Closures, prototypes, regex, JSON, Promises polyfill, recursion). JavaScript: Duktape 2.7.0,完整 ES5(闭包、原型、正则、JSON、Promise polyfill、递归)。
- Images: PNG (alpha), GIF (transparency), JPEG, BMP, TIFF. 图片: PNG (Alpha 通道), GIF (透明度), JPEG, BMP, TIFF。
- Networking: Open Transport TCP, HTTP/1.1 + chunked + keep-alive + 3xx follow, HTTPS via macTLS. 网络: Open Transport TCP,HTTP/1.1 + 分块传输 + 长连接 + 3xx 跳转,通过 macTLS 进行 HTTPS 通信。
- Browser chrome: Address bar, back/forward/reload/home, status bar, multi-window, smooth scroll, keyboard scrolling. 浏览器界面: 地址栏、前进/后退/刷新/主页、状态栏、多窗口、平滑滚动、键盘滚动。
Download
下载
Latest is MacSurf v0.7 — Cleanup (May 2026): a correctness and cleanup sprint that closed twelve issues in a single day. Earlier releases on the releases page include v0.6.2 “Speed-Run” (cold mactrove.com from 30+ seconds down to ~2–3) and the first numbered release. 最新版本为 MacSurf v0.7 — Cleanup (2026 年 5 月):这是一次正确性和清理冲刺,在一天内关闭了 12 个问题。发布页面上的早期版本包括 v0.6.2 “Speed-Run”(将 mactrove.com 的冷启动时间从 30 多秒缩短至约 2-3 秒)以及第一个编号版本。