mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-25 06:05:20 +00:00
running on macos
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
# BitChat macOS Build
|
||||
|
||||
This Justfile provides easy commands to build and run BitChat natively on macOS while preserving the original project configuration.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# Build and run the app
|
||||
just run
|
||||
|
||||
# Or see all available commands
|
||||
just
|
||||
```
|
||||
|
||||
## Commands
|
||||
|
||||
- `just run` - Build and run the macOS app
|
||||
- `just build` - Build the macOS app only
|
||||
- `just clean` - Clean build artifacts and restore original files
|
||||
- `just check` - Check prerequisites (XcodeGen, Xcode, etc.)
|
||||
- `just info` - Show app information and requirements
|
||||
|
||||
## How It Works
|
||||
|
||||
The Justfile temporarily modifies `project.yml` to:
|
||||
- Use your local development team ID (replaces `L3N5LHJD5Y`)
|
||||
- Change bundle identifier to avoid conflicts (`chat.bitchat` → `com.local.bitchat`)
|
||||
- Disable code signing for local development (`Automatic` → `Manual`)
|
||||
- Exclude iOS-specific files from macOS build (`LaunchScreen.storyboard`)
|
||||
|
||||
**Original files are always preserved** - modifications are only applied during builds and automatically cleaned up. The project files remain exactly as they are on the main branch.
|
||||
|
||||
## Requirements
|
||||
|
||||
- macOS 13.0+ (Ventura)
|
||||
- Xcode (from App Store)
|
||||
- XcodeGen (`brew install xcodegen`)
|
||||
- Bluetooth LE capable Mac
|
||||
- Physical device (Bluetooth doesn't work in simulator)
|
||||
|
||||
## App Features
|
||||
|
||||
- **Native macOS SwiftUI app** - not a Catalyst port
|
||||
- **Bluetooth LE mesh networking** - no internet required
|
||||
- **End-to-end encryption** - X25519 + AES-256-GCM
|
||||
- **Store-and-forward messaging** - works with offline peers
|
||||
- **Channel-based group chats** - IRC-style commands
|
||||
- **Private messaging** with delivery receipts
|
||||
- **Emergency wipe** - triple-tap logo to clear all data
|
||||
|
||||
## Usage
|
||||
|
||||
Once running:
|
||||
- Set your nickname and start discovering nearby peers
|
||||
- Use `/join #channel` for group chats
|
||||
- Use `/msg @user` for private messages
|
||||
- Use `/who` to see connected peers
|
||||
- Triple-tap the logo for emergency data wipe
|
||||
|
||||
The app creates a decentralized mesh network over Bluetooth LE that can span significant distances through multi-hop message relay.
|
||||
@@ -0,0 +1,132 @@
|
||||
# BitChat macOS Build Justfile
|
||||
# Handles temporary modifications needed to build and run on macOS
|
||||
|
||||
# Default recipe - shows available commands
|
||||
default:
|
||||
@echo "BitChat macOS Build Commands:"
|
||||
@echo " just run - Build and run the macOS app"
|
||||
@echo " just build - Build the macOS app only"
|
||||
@echo " just clean - Clean build artifacts and restore original files"
|
||||
@echo " just check - Check prerequisites"
|
||||
@echo ""
|
||||
@echo "Original files are preserved - modifications are temporary for builds only"
|
||||
|
||||
# Check prerequisites
|
||||
check:
|
||||
@echo "Checking prerequisites..."
|
||||
@command -v xcodegen >/dev/null 2>&1 || (echo "❌ XcodeGen not found. Install with: brew install xcodegen" && exit 1)
|
||||
@command -v xcodebuild >/dev/null 2>&1 || (echo "❌ Xcode not found. Install Xcode from App Store" && exit 1)
|
||||
@security find-identity -v -p codesigning | grep -q "Developer ID" || (echo "⚠️ No Developer ID found - code signing may fail" && exit 0)
|
||||
@echo "✅ All prerequisites met"
|
||||
|
||||
# Backup original files
|
||||
backup:
|
||||
@echo "Backing up original project configuration..."
|
||||
@cp project.yml project.yml.backup 2>/dev/null || true
|
||||
|
||||
# Restore original files
|
||||
restore:
|
||||
@echo "Restoring original project configuration..."
|
||||
@if [ -f project.yml.backup ]; then mv project.yml.backup project.yml; fi
|
||||
|
||||
# Apply macOS-specific modifications
|
||||
patch-for-macos: backup
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
echo "Applying macOS-specific patches..."
|
||||
# Get current development team
|
||||
DEV_TEAM=$(security find-identity -v -p codesigning | grep "Developer ID" | head -1 | sed 's/.*(\(.*\)).*/\1/' || echo "")
|
||||
if [ -z "$DEV_TEAM" ]; then
|
||||
echo "⚠️ No Developer ID found, using your team ID"
|
||||
DEV_TEAM="W2L75AE9HQ"
|
||||
fi
|
||||
echo "Using development team: $DEV_TEAM"
|
||||
# Replace original development team with current one
|
||||
sed -i '' "s/L3N5LHJD5Y/$DEV_TEAM/g" project.yml
|
||||
# Change bundle ID to avoid conflicts
|
||||
sed -i '' 's/chat\.bitchat/com.local.bitchat/g' project.yml
|
||||
# Disable code signing for development
|
||||
sed -i '' 's/CODE_SIGN_STYLE: Automatic/CODE_SIGN_STYLE: Manual/g' project.yml
|
||||
# Add no-signing flags after each CODE_SIGN_STYLE: Manual line
|
||||
sed -i '' '/CODE_SIGN_STYLE: Manual/a\
|
||||
CODE_SIGNING_REQUIRED: NO\
|
||||
CODE_SIGNING_ALLOWED: NO' project.yml
|
||||
# Fix macOS target to exclude LaunchScreen.storyboard
|
||||
sed -i '' '/bitchat_macOS:/,/resources:/ {
|
||||
s|sources: *$|sources:\
|
||||
- path: bitchat\
|
||||
excludes:\
|
||||
- "LaunchScreen.storyboard"|
|
||||
}' project.yml
|
||||
|
||||
# Generate Xcode project with patches
|
||||
generate: patch-for-macos
|
||||
@echo "Generating Xcode project..."
|
||||
@xcodegen generate
|
||||
|
||||
# Build the macOS app
|
||||
build: check generate
|
||||
@echo "Building BitChat for macOS..."
|
||||
@xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug build
|
||||
|
||||
# Run the macOS app
|
||||
run: build
|
||||
@echo "Launching BitChat..."
|
||||
@APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \
|
||||
if [ -n "$$APP_PATH" ]; then \
|
||||
echo "Found app at: $$APP_PATH"; \
|
||||
open "$$APP_PATH"; \
|
||||
else \
|
||||
echo "❌ Could not find built app"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
# Clean build artifacts and restore original files
|
||||
clean: restore
|
||||
@echo "Cleaning build artifacts..."
|
||||
@rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true
|
||||
@rm -rf bitchat.xcodeproj 2>/dev/null || true
|
||||
@echo "✅ Cleaned and restored original files"
|
||||
|
||||
# Quick run without cleaning (for development)
|
||||
dev-run: check
|
||||
@echo "Quick development build..."
|
||||
@if [ ! -f project.yml.backup ]; then just patch-for-macos; fi
|
||||
@xcodegen generate
|
||||
@xcodebuild -project bitchat.xcodeproj -scheme "bitchat (macOS)" -configuration Debug build
|
||||
@APP_PATH=$$(find ~/Library/Developer/Xcode/DerivedData -name "bitchat.app" -path "*/Debug/*" | head -1); \
|
||||
if [ -n "$$APP_PATH" ]; then \
|
||||
open "$$APP_PATH"; \
|
||||
else \
|
||||
echo "❌ Could not find built app"; \
|
||||
fi
|
||||
|
||||
# Show app info
|
||||
info:
|
||||
@echo "BitChat - Decentralized Mesh Messaging"
|
||||
@echo "======================================"
|
||||
@echo "• Native macOS SwiftUI app"
|
||||
@echo "• Bluetooth LE mesh networking"
|
||||
@echo "• End-to-end encryption"
|
||||
@echo "• No internet required"
|
||||
@echo "• Works offline with nearby devices"
|
||||
@echo ""
|
||||
@echo "Requirements:"
|
||||
@echo "• macOS 13.0+ (Ventura)"
|
||||
@echo "• Bluetooth LE capable Mac"
|
||||
@echo "• Physical device (no simulator support)"
|
||||
@echo ""
|
||||
@echo "Usage:"
|
||||
@echo "• Set nickname and start chatting"
|
||||
@echo "• Use /join #channel for group chats"
|
||||
@echo "• Use /msg @user for private messages"
|
||||
@echo "• Triple-tap logo for emergency wipe"
|
||||
|
||||
# Force clean everything (nuclear option)
|
||||
nuke:
|
||||
@echo "🧨 Nuclear clean - removing all build artifacts and backups..."
|
||||
@rm -rf ~/Library/Developer/Xcode/DerivedData/bitchat-* 2>/dev/null || true
|
||||
@rm -rf bitchat.xcodeproj 2>/dev/null || true
|
||||
@rm -f project.yml.backup 2>/dev/null || true
|
||||
@git checkout -- project.yml 2>/dev/null || echo "⚠️ Not a git repo or no changes to restore"
|
||||
@echo "✅ Nuclear clean complete"
|
||||
+19
-21
@@ -1,6 +1,6 @@
|
||||
name: bitchat
|
||||
options:
|
||||
bundleIdPrefix: com.local.bitchat
|
||||
bundleIdPrefix: chat.bitchat
|
||||
deploymentTarget:
|
||||
iOS: 16.0
|
||||
macOS: 13.0
|
||||
@@ -43,17 +43,17 @@ targets:
|
||||
- CFBundleURLSchemes:
|
||||
- bitchat
|
||||
settings:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat
|
||||
PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat
|
||||
PRODUCT_NAME: bitchat
|
||||
INFOPLIST_FILE: bitchat/Info.plist
|
||||
ENABLE_PREVIEWS: YES
|
||||
SWIFT_VERSION: 5.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET: 16.0
|
||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD: YES
|
||||
CODE_SIGN_STYLE: Manual
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
CODE_SIGNING_REQUIRED: YES
|
||||
CODE_SIGNING_ALLOWED: YES
|
||||
DEVELOPMENT_TEAM: W2L75AE9HQ
|
||||
DEVELOPMENT_TEAM: L3N5LHJD5Y
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
|
||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES
|
||||
CODE_SIGN_ENTITLEMENTS: bitchat/bitchat.entitlements
|
||||
@@ -65,9 +65,7 @@ targets:
|
||||
type: application
|
||||
platform: macOS
|
||||
sources:
|
||||
- path: bitchat
|
||||
excludes:
|
||||
- "LaunchScreen.storyboard"
|
||||
- bitchat
|
||||
resources:
|
||||
- bitchat/Assets.xcassets
|
||||
info:
|
||||
@@ -83,16 +81,16 @@ targets:
|
||||
- CFBundleURLSchemes:
|
||||
- bitchat
|
||||
settings:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat
|
||||
PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat
|
||||
PRODUCT_NAME: bitchat
|
||||
INFOPLIST_FILE: bitchat/Info.plist
|
||||
ENABLE_PREVIEWS: YES
|
||||
SWIFT_VERSION: 5.0
|
||||
MACOSX_DEPLOYMENT_TARGET: 13.0
|
||||
CODE_SIGN_STYLE: Manual
|
||||
CODE_SIGNING_REQUIRED: NO
|
||||
CODE_SIGNING_ALLOWED: NO
|
||||
DEVELOPMENT_TEAM: W2L75AE9HQ
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
CODE_SIGNING_REQUIRED: YES
|
||||
CODE_SIGNING_ALLOWED: YES
|
||||
DEVELOPMENT_TEAM: L3N5LHJD5Y
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME: AppIcon
|
||||
ASSETCATALOG_COMPILER_INCLUDE_ALL_APPICON_ASSETS: YES
|
||||
CODE_SIGN_ENTITLEMENTS: bitchat/bitchat.entitlements
|
||||
@@ -117,14 +115,14 @@ targets:
|
||||
NSExtensionActivationSupportsWebURLWithMaxCount: 1
|
||||
NSExtensionActivationSupportsImageWithMaxCount: 1
|
||||
settings:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.ShareExtension
|
||||
PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.ShareExtension
|
||||
INFOPLIST_FILE: bitchatShareExtension/Info.plist
|
||||
SWIFT_VERSION: 5.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET: 16.0
|
||||
CODE_SIGN_STYLE: Manual
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
CODE_SIGNING_REQUIRED: YES
|
||||
CODE_SIGNING_ALLOWED: YES
|
||||
DEVELOPMENT_TEAM: W2L75AE9HQ
|
||||
DEVELOPMENT_TEAM: L3N5LHJD5Y
|
||||
CODE_SIGN_ENTITLEMENTS: bitchatShareExtension/bitchatShareExtension.entitlements
|
||||
CODE_SIGN_ALLOW_ENTITLEMENTS_MODIFICATION: YES
|
||||
|
||||
@@ -136,16 +134,16 @@ targets:
|
||||
dependencies:
|
||||
- target: bitchat_iOS
|
||||
settings:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.tests
|
||||
PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.tests
|
||||
INFOPLIST_FILE: bitchatTests/Info.plist
|
||||
SWIFT_VERSION: 5.0
|
||||
IPHONEOS_DEPLOYMENT_TARGET: 16.0
|
||||
TEST_HOST: $(BUILT_PRODUCTS_DIR)/bitchat.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/bitchat
|
||||
BUNDLE_LOADER: $(TEST_HOST)
|
||||
CODE_SIGN_STYLE: Manual
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
CODE_SIGNING_REQUIRED: YES
|
||||
CODE_SIGNING_ALLOWED: YES
|
||||
DEVELOPMENT_TEAM: W2L75AE9HQ
|
||||
DEVELOPMENT_TEAM: L3N5LHJD5Y
|
||||
|
||||
bitchatTests_macOS:
|
||||
type: bundle.unit-test
|
||||
@@ -155,16 +153,16 @@ targets:
|
||||
dependencies:
|
||||
- target: bitchat_macOS
|
||||
settings:
|
||||
PRODUCT_BUNDLE_IDENTIFIER: com.local.bitchat.tests
|
||||
PRODUCT_BUNDLE_IDENTIFIER: chat.bitchat.tests
|
||||
INFOPLIST_FILE: bitchatTests/Info.plist
|
||||
SWIFT_VERSION: 5.0
|
||||
MACOSX_DEPLOYMENT_TARGET: 13.0
|
||||
TEST_HOST: $(BUILT_PRODUCTS_DIR)/bitchat.app/Contents/MacOS/bitchat
|
||||
BUNDLE_LOADER: $(TEST_HOST)
|
||||
CODE_SIGN_STYLE: Manual
|
||||
CODE_SIGN_STYLE: Automatic
|
||||
CODE_SIGNING_REQUIRED: YES
|
||||
CODE_SIGNING_ALLOWED: YES
|
||||
DEVELOPMENT_TEAM: W2L75AE9HQ
|
||||
DEVELOPMENT_TEAM: L3N5LHJD5Y
|
||||
|
||||
schemes:
|
||||
bitchat (iOS):
|
||||
|
||||
Reference in New Issue
Block a user