Skip to content

Building from source

Guilherme Selig edited this page Oct 21, 2026 · 1 revision

Building from source

Requirements

  • Apple Silicon, macOS 15 or later.
  • Rust stable. The crate uses edition 2024. Dependencies: libc and serde_json only.
  • For the app: Xcode 27. Older Xcode versions fail to compile it (CI builds the app on Xcode 27 only); the built app runs on macOS 15+.
  • For Passwordless Root: an Apple Development signing identity in your keychain. A free Personal Team certificate works: Xcode > Settings > Accounts > Manage Certificates > + > Apple Development.

The deployment target is macOS 15.0 (.cargo/config.toml sets MACOSX_DEPLOYMENT_TARGET). CI checks it with vtool -show-build.

The CLI

git clone https://github.com/guiselig/sdtally.git
cd sdtally
cargo build --release
./target/release/sdtally --help

Binaries:

Binary Purpose
target/release/sdtally The CLI
target/release/sdc-coleta Research collector: writes an anonymized JSON report (--saida report.json). Not needed by the app

If the repository is in iCloud Drive, put the build output elsewhere:

export CARGO_TARGET_DIR=/tmp/sdtally-target

The app

app/montar.sh            # build, assemble and sign; prints the path of SDTally.app
app/montar.sh --abrir    # same, then open it

What app/montar.sh does:

  1. Builds sdtally (release) with Cargo and the app and helper with swift build -c release.
  2. Compiles the icon (app/SDTally.icon) with actool into Assets.car plus a fallback .icns.
  3. Assembles SDTally.app:
    • Contents/MacOS/SDTally (the app) and Contents/MacOS/SDTallyHelper (the root helper),
    • Contents/Helpers/sdtally (the CLI),
    • Contents/Library/LaunchDaemons/io.github.guiselig.sdtally.helper.plist,
    • translations (*.lproj) and the icon in Contents/Resources,
    • Info.plist with the version from Cargo.toml and the current commit.
  4. Signs from the inside out with the hardened runtime and fixed identifiers (io.github.guiselig.sdtally.cli for the CLI, io.github.guiselig.sdtally.helper for the helper), then verifies with codesign --verify --strict --deep.
Variable Effect Default
SDTALLY_BUILD Output folder ~/Library/Caches/sdtally-build
SDTALLY_ASSINATURA Signing identity (name or SHA-1) First "Apple Development" identity found
CARGO_TARGET_DIR Cargo output $SDTALLY_BUILD/target

Without an Apple Development identity the script signs ad hoc and prints a warning. The app runs, but:

  • Passwordless Root cannot register (the helper requires a Team ID on both sides),
  • Full Disk Access is lost on every rebuild, because macOS ties it to the signature.

Tests

cargo test --release
cargo clippy --release --all-targets -- -D warnings
swift test --package-path app
sh scripts/g9.sh
Suite What it covers
cargo test unit tests Parsers (including a 100,000-buffer test of the getattrlistbulk parser), rules, redaction, translations
tests/fixture_apfs.rs Creates an APFS disk image with hdiutil (no root) containing a regular file, full and partial clones, a sparse file, a hard link, a compressed file and large xattrs, and checks the account against the image's used space
tests/relatorio.rs, tests/golden/ Report shape and text output in Portuguese and English
tests/categorias.rs Reproduced Settings categories against a scrubbed real measurement
tests/nunca_apaga.rs No delete or trash APIs in production code
tests/g9.rs No scareware words in user-facing Rust text
tests/mcp.rs, tests/redigir.rs MCP protocol and redaction
tests/dryrun.rs Every recommended command has a read-only dry-run form and a documented source
swift test --package-path app App logic with synthetic fixtures (app/Tests/SDTallyTests/Fixtures)
scripts/g9.sh The anti-scareware check over Rust and Swift sources

Continuous integration

.github/workflows/ci.yml runs on every push to main, on pull requests, and on demand, using GitHub's standard macOS runners:

Job Runs on What it does
teste macOS 15, 26, 27 cargo test, release build, checks minos 15.0, creates a local snapshot holding about 200 MB, runs sudo sdtally --json and checks that the account closes, runs sdc-coleta
grep Ubuntu Fails on network APIs; runs scripts/g9.sh
app macOS 15, 26, 27 swift test, builds the raw binaries, renders screenshots from synthetic fixtures, runs app/montar.sh to prove the app assembles
fontes macOS 15, 26, 27, manual only Research job comparing data sources against System Settings; never fails the build

Running the app without a bundle

swift build --package-path app produces a raw app binary. Outside a .app, developer hooks are enabled through SDTALLY_* environment variables (for example pointing at a specific sdtally binary or fixture files, or rendering a section to PNG). They are documented at the top of app/Sources/SDTally/Foto.swift and are ignored inside the bundle.

Clone this wiki locally