Skip to content
Cra

For developers

Build from source

Cra is a Swift package around Chromium Embedded Framework. One script does the whole build.

Requirements

  • macOS 14 or later on Apple silicon. The fetch script pins the arm64 CEF build; Intel is on the roadmap.
  • Xcode 16 or later, for the Swift 5.10 toolchain and the macOS 14 SDK.
  • CMake, for the CEF C++ wrapper: brew install cmake.
  • About 1 GB of disk for the CEF distribution and build products.

Build and run

git clone https://github.com/VictorKildahl/cra.git
cd cra
scripts/build.sh      # first run fetches CEF (about 130 MB) and builds its wrapper
scripts/run.sh        # builds if needed, then opens build/Cra.app
scripts/dev.sh        # dev loop: rebuilds and relaunches on save

scripts/build.sh debug makes a debug build. scripts/run.sh --rebuild forces a rebuild before launching. scripts/dev.sh keeps a debug CraDev.app running and rebuilds it in a few seconds whenever a source file changes.

What the build script does

  1. Runs scripts/fetch-cef.sh, which downloads the pinned CEF binary distribution into vendor/cef and builds libcef_dll_wrapper with CMake. Both steps are skipped when already done.
  2. Runs swift build for the three targets: Cra (the app), CraCEF (the Objective-C++ bridge) and CraHelper (the Chromium subprocess).
  3. Stages Cra.app with the framework and five helper apps, one per Chromium process type: default, Alerts, GPU, Plugin and Renderer.
  4. Ad-hoc signs everything, innermost first, then syncs the bundle into build/Cra.app so LaunchServices keeps treating it as the same app.

Environment variables

VariableDefaultPurpose
CRA_VERSION0.1.0Marketing version written into Info.plist
CRA_BUILDtimestampBuild number written into Info.plist
CEF_VERSIONpinned in the scriptWhich CEF distribution to fetch
CEF_ARCHmacosarm64CEF architecture to fetch

Layout

Sources/CraThe app: model, store, sidebar, command bar, windows, split view, import, settings
Sources/CraCEFObjective-C++ bridge between Swift and CEF
Sources/CraHelperChromium subprocess executable
docs/arc-reverse-engineering.mdWhat was learned from Arc’s data files and how
brand/Logo assets
resources/blocklistThe ad and tracker domain list, with its licence notices
vendor/cefCEF distribution, fetched, not committed

Scripting the running app

Cra registers the cra:// scheme, which is handy for testing without touching the keyboard:

open "cra://action/newTab"              # any action id from the shortcuts page
open "cra://commandbar?query=github"    # open the command bar with text
open "cra://open?url=https://example.com&background=1"
open "cra://open?url=https://example.com&little=1"   # in a Little Window
open "cra://import?source=arc&archive=1&settings=1"
open "cra://dismiss"                    # close sheets, command bar, find bar

Data

Everything lives in ~/Library/Application Support/Cra: the sidebar and archive as JSON, keybindings.json, cached favicons, chromium.log, and a Chromium profile folder. Delete it to start over. See privacy for the full list.