2.9 KiB
Bun Server Support
VibeTunnel now includes support for running with Bun, a high-performance JavaScript runtime with built-in native module support.
Architecture Considerations
Important: Bun does not support universal binaries. The Bun executable is architecture-specific and will be built for the native architecture during compilation. Despite this limitation, VibeTunnel still creates a universal binary for the main application, with the Bun executable being selected at runtime based on the current architecture.
Features
- High-performance JavaScript/TypeScript execution
- Built-in native module support (pty.node, spawn-helper)
- Integrated
fwdcommand for terminal forwarding - Smaller binary size compared to Node.js
Building with Bun Support
Automatic Build (Recommended)
The Bun executable is automatically built during the main build process. The build script:
- Detects the native architecture
- Builds the Bun executable for that architecture
- Embeds it into the universal app bundle
Note: Each build contains only the Bun executable for the build machine's architecture. For a true universal distribution, separate builds on Intel and Apple Silicon machines would need to be combined.
Manual Build
If you need to build the Bun executable manually:
cd web
node build-native.js
This creates:
native/vibetunnel- The Bun executablenative/pty.node- Native PTY modulenative/spawn-helper- Helper binary for spawning processes
Verification
To verify Bun support is properly built:
# Check if files exist
ls -la web/native/
# Test the executable
web/native/vibetunnel --version
CLI Usage
When using the Bun server, the vt command automatically prepends fwd:
# With Go server:
vt mycommand # → vibetunnel mycommand
# With Bun server:
vt mycommand # → vibetunnel fwd mycommand
Switching Between Servers
You can switch between Go and Bun servers in Settings → Debug → Server Type.
When switching, you may need to reinstall the CLI tools to update the vt wrapper script.
Troubleshooting
"Bun server is not available"
This error means the Bun executable or native modules are missing. Solutions:
- Ensure the build script runs: Check Xcode build logs for "Build Bun Executable"
- Build manually:
cd web && node build-native.js - Verify files: Check
VibeTunnel.app/Contents/Resources/for:- vibetunnel (60MB executable)
- pty.node
- spawn-helper
CLI not working after switching
After switching server types, reinstall the CLI tools:
- Settings → Advanced → Reinstall CLI Tools
- Enter admin password when prompted
- The installer will create the appropriate
vtscript/symlink
Development
The Bun server code is in:
mac/VibeTunnel/Core/Services/BunServer.swift- Swift integrationweb/src/server/- JavaScript server implementationweb/build-native.js- Build script for creating the Bun executable