BitChat Build Dependencies: Complete Swift Package Manager Guide
To build BitChat, you need Swift 5.9, Xcode (or swift build), iOS 16/macOS 13 SDKs, and the just task runner for convenience scripts. BitChat is a Swift-based iOS/macOS application that uses SwiftPM for dependency management with local packages for Tor networking, logging, and foundation utilities, plus one external package for cryptographic primitives.
BitChat is a privacy-focused messaging application built by permissionlesstech/bitchat. Understanding the complete build dependency stack is essential for contributors, security auditors, and anyone compiling the application from source. This guide breaks down every requirement based on the actual source code in the repository.
Core Build Toolchain
Swift 5.9 and Platform Requirements
The Package.swift manifest declares swift-tools-version:5.9 as its minimum toolchain. This version requirement appears at the top of Package.swift lines 1-2:
// swift-tools-version:5.9
import PackageDescription
The platforms array in Package.swift lines 9-11 specifies:
- iOS 16 — minimum deployment target for mobile builds
- macOS 13 — minimum deployment target for desktop builds
These platform constraints ensure access to modern Swift concurrency features and system APIs used throughout the codebase.
Build System Options
BitChat supports two primary build workflows as documented in the README section "Option 1: Using Xcode" (lines 8-13):
- Xcode — Open
bitchat.xcodeprojfor IDE-based development - Command-line SwiftPM — Use
swift buildandswift testfor automation
The bitchat.xcodeproj file ships in the repository root, providing a preconfigured Xcode project structure.
Task Runner: just
The README section "Option 2: Using just" (lines 47-53) documents an optional but recommended dependency: the just command runner.
Install via Homebrew:
brew install just
Common just commands defined in the justfile:
just check— run validation checksjust run— launch the macOS buildjust test— execute the test suite
The justfile lives at repository root and provides shortcuts that wrap underlying swift commands.
Swift Package Dependencies
BitChat declares four dependencies in Package.swift lines 18-23. These break into local packages (shipped in-repo) and one external package (fetched from GitHub).
Local Packages in localPackages/
| Package | Path | Purpose |
|---|---|---|
| Arti | localPackages/Arti |
Tor anonymity network implementation |
| BitFoundation | localPackages/BitFoundation |
Core utilities for the Bit ecosystem |
| BitLogger | localPackages/BitLogger |
Structured logging framework |
These packages are referenced in Package.swift using .package(path: ...) syntax, indicating they are vendored within the repository rather than fetched remotely.
External Cryptographic Dependency
| Package | Source | Version | Purpose |
|---|---|---|---|
| swift-secp256k1 | https://github.com/21-DOT-DEV/swift-secp256k1 |
exact 0.21.1 | secp256k1 elliptic curve bindings for Nostr key operations |
This is the only remote dependency. It provides cryptographic primitives critical for BitChat's Nostr protocol integration.
Target Dependencies
The executable target in Package.swift lines 27-32 imports specific products from these packages:
dependencies: [
.product(name: "P256K", package: "swift-secp256k1"),
"BitFoundation",
"BitLogger",
.product(name: "Tor", package: "Arti"),
]
P256K— secp256k1 bindings from the external packageTor— Tor client from the local Arti packageBitFoundationandBitLogger— local utility libraries
Build Resources
Package.swift line 44 declares localization resources:
resources: [
.process("Localizable.xcstrings")
]
The Localizable.xcstrings file must be present at build time for proper string localization.
Complete Build Walkthrough
Fresh Clone to Running Build
# 1️⃣ Clone the repository
git clone https://github.com/permissionlesstech/bitchat.git
cd bitchat
# 2️⃣ Install optional task runner
brew install just
# 3️⃣ Verify Swift toolchain
swift --version # expect Swift 5.9.x
# 4️⃣ Build with SwiftPM (fetches swift-secp256k1 automatically)
swift build
# 5️⃣ Run test suite to validate all dependencies
swift test
# 6️⃣ Or use just shortcuts
just check
just run
Xcode Build (Without Code Signing)
# Open project
open bitchat.xcodeproj
# Command-line build for macOS Debug
xcodebuild -project bitchat.xcodeproj \
-scheme "bitchat (macOS)" \
-configuration Debug \
CODE_SIGNING_ALLOWED=NO \
build
Key Source Files for Build Configuration
| File | Location | Purpose |
|---|---|---|
Package.swift |
Repository root | SwiftPM manifest with all dependencies and platform declarations |
README.md |
Repository root | Setup instructions for both Xcode and just workflows |
bitchat.xcodeproj/ |
Repository root | Xcode project configuration |
localPackages/Arti/ |
localPackages/ |
Local Tor implementation |
localPackages/BitFoundation/ |
localPackages/ |
Core utility library |
localPackages/BitLogger/ |
localPackages/ |
Logging framework |
justfile |
Repository root | Task runner shortcuts |
Summary
- Swift 5.9 is mandatory, declared in
Package.swiftline 1 - iOS 16 / macOS 13 are minimum platform targets, declared lines 9-11
justis optional but recommended for script automation- Three local packages (
Arti,BitFoundation,BitLogger) ship inlocalPackages/ - One external package (
swift-secp256k10.21.1) provides cryptographic primitives - SwiftPM automatically fetches the external dependency; local packages resolve via path references
Frequently Asked Questions
What Swift version does BitChat require?
BitChat requires Swift 5.9 as declared by swift-tools-version:5.9 in Package.swift. This minimum version ensures compatibility with the concurrency features and APIs used in the codebase. Run swift --version to verify your toolchain meets this requirement.
Can I build BitChat without Xcode?
Yes, use swift build and swift test directly. The project fully supports SwiftPM command-line builds. The just task runner provides convenience shortcuts (just check, just run, just test) that wrap these commands. Xcode is only required if you prefer IDE-based development or iOS Simulator testing.
Where are BitChat's dependencies defined?
All dependencies are declared in /Package.swift. Lines 18-23 specify the four packages: three local path-based packages in localPackages/, and one external GitHub dependency (swift-secp256k1). Lines 27-32 declare which specific products from these packages are imported by the executable target.
Is the Tor implementation a remote dependency?
No, Arti (the Tor implementation) is a local package located at localPackages/Arti. This vendored approach gives the BitChat team direct control over the Tor client code. The only remote dependency fetched from GitHub is swift-secp256k1 for elliptic curve cryptography.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →