This guide covers building Gõ Nhanh from source for different platforms and configurations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/khaphanspace/gonhanh.org/llms.txt
Use this file to discover all available pages before exploring further.
Quick Build
For most development work, use the standard build command:- Formats code
- Builds Rust core as universal binary (arm64 + x86_64)
- Builds macOS app with Xcode
- Auto-opens the app
Building Components
Rust Core Library
The core input method engine is built as a static library that can be linked from any platform.Build for macOS (universal binary)
aarch64-apple-darwin(Apple Silicon)x86_64-apple-darwin(Intel)
platforms/macos/libgonhanh_core.aThe core library has zero external dependencies in production. This keeps the binary small and self-contained.
macOS Application
The macOS app is built using Xcode with SwiftUI:Build Output
The built application is located at:Xcode Configuration
The build uses these Xcode settings:- Configuration: Release
- Architectures: arm64, x86_64 (universal)
- Deployment Target: macOS 13.0+
- Signing: Ad-hoc for development
Linux Build
Linux support is currently in beta.
Build Configurations
Development Build
Standard build with ad-hoc signing:- Ad-hoc code signing (runs on your machine only)
- Debug symbols included
- Fast iteration
Release Build with Signing
For distribution with Developer ID:- Developer ID Application certificate in Keychain
- Or set
APPLE_SIGNING_IDENTITYenvironment variable
Notarized Build
For public distribution on macOS:Get an App-Specific Password
- Go to appleid.apple.com
- Sign in with your Apple ID
- Generate an app-specific password
Custom Version Build
Build with a specific version number:- Testing update mechanisms
- Pre-release builds
- Custom distributions
Build Scripts
Understanding the build scripts:Core Build Script
Location:scripts/build/core.sh
macOS Build Script
Location:scripts/build/macos.sh
Key features:
- Version management (git tags or custom)
- Code signing (ad-hoc, Developer ID, or notarized)
- Xcode integration
- Automatic permission handling
Cargo Configuration
The Rust core uses optimized release settings:Installation
Install to /Applications
After building, install the app:- Removes old login items pointing to build directory
- Kills any running instances
- Copies the app to
/Applications/ - Launches the installed app
Create DMG Installer
Create a distributable DMG:- GoNhanh.app
- Custom background
- Shortcut to Applications folder
- License information
Troubleshooting
Common Build Issues
"Library not found: libgonhanh_core.a"
"Library not found: libgonhanh_core.a"
The Rust core hasn’t been built yet.Solution:
"Failed to find Xcode"
"Failed to find Xcode"
Xcode Command Line Tools aren’t installed.Solution:
"Rust target not found"
"Rust target not found"
Required compilation targets aren’t installed.Solution:
"Permission denied" on scripts
"Permission denied" on scripts
Build scripts aren’t executable.Solution:
All tests pass locally but fail on CI
All tests pass locally but fail on CI
Rust version mismatch.Solution:
Check your Rust version:Update if needed:
Runtime Issues
IME not typing anything
IME not typing anything
Missing Accessibility permission.Solution:
- Go to System Settings → Privacy & Security → Accessibility
- Add GoNhanh to the list
- Enable the toggle
Keyboard hook crashes app
Keyboard hook crashes app
Outdated Xcode tools.Solution:
Settings not saving
Settings not saving
Preferences file corruption.Solution:Then restart the app.
Clean Build
Start fresh by removing all build artifacts:- Rust target directory (
core/target/) - macOS build directory (
platforms/macos/build/) - Linux build directory (
platforms/linux/build/) - App preferences
- Login items pointing to build directory
Advanced: Manual Xcode Build
For debugging or custom configurations:Configure build scheme
- Product → Scheme → Edit Scheme
- Select Release configuration
- Set architectures to arm64 + x86_64
Next Steps
Contributing
Learn about the contribution process
Code Standards
Follow our coding conventions and best practices