Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
45fcf4b
feat(swift): dependency-free Swift port, scaffold and core model
Akhrameev Nov 18, 2026
e5f59ff
feat(swift): read-only commands (list, profiles, status, verify, doct…
Akhrameev Nov 18, 2026
733b4b4
fix(swift): parseBytes no longer traps on out-of-range sizes
Akhrameev Nov 18, 2026
4daf6eb
feat(swift): slimming (on, off, on --no-reboot, boot, shutdown) and a…
Akhrameev Nov 18, 2026
5b08730
fix(swift): keep non-boolean entries when writing disabled.plist; lin…
Akhrameev Nov 18, 2026
5575bc6
fix(swift): harden disabled.plist parsing, cap retry sleeps, tighten …
Akhrameev Nov 18, 2026
770a8be
feat(swift): live enable/disable with --save
Akhrameev Nov 18, 2026
5de620f
feat(swift): watch (kqueue device-set watcher, pre-boot seeding, --js…
Akhrameev Nov 18, 2026
ebe1330
feat(swift): rename, erase, delete
Akhrameev Nov 18, 2026
9817e78
feat(swift): top (live fleet monitor, drill-down, one-shot and --json)
Akhrameev Nov 18, 2026
01f9a69
feat(swift): size and the disk-* commands; stricter cleanup containment
Akhrameev Nov 18, 2026
fc7dc25
feat(swift): profile wizard (checklist builder with raw-mode terminal…
Akhrameev Nov 18, 2026
61c337b
feat(swift): clone and repair-clone; every Go command is now ported
Akhrameev Nov 18, 2026
4385a69
fix(swift): validate watch UDIDs, reject overflowing timeouts; add co…
Akhrameev Nov 18, 2026
a0af02f
docs, ci: present the repo as an independent Swift port of simslim
Akhrameev Nov 18, 2026
7d1db8b
test: add a Go-vs-Swift parity check script
Akhrameev Nov 18, 2026
2c2a6b4
test: parity script runs on/off without --json, masks live sizes, lis…
Akhrameev Nov 18, 2026
f4ef963
fix(swift): annotate parseTopMemory test dictionary as Int64
Akhrameev Nov 18, 2026
cb552dd
fix(swift): bring --help text to full parity with the Go CLI
Akhrameev Nov 18, 2026
76eb3f6
test: harden parity.sh against disabled.plist's async settling
Akhrameev Nov 18, 2026
f3d6da0
chore: add VS Code launch configs for the Swift debug/release build
Akhrameev Nov 18, 2026
514a8d8
docs: update README with latest parity results and tidy library note
Akhrameev Nov 19, 2026
fa2f3c0
test: harden parity.sh per review; scope README parity claim; allow h…
Akhrameev Nov 19, 2026
f676970
docs: add Go-availability check step and a CONTRIBUTING.md pointing t…
Akhrameev Nov 19, 2026
bb1d7c7
build: bundle the Swift CLI in the app; Go no longer needed for `make…
Akhrameev Nov 19, 2026
2683c59
docs: app now bundles the Swift CLI; Go only as opt-in fallback
Akhrameev Nov 19, 2026
0134301
docs: describe the check/app-check split after the app cutover
Akhrameev Nov 19, 2026
13c8655
docs: add a checklist for removing the Go stack
Akhrameev Nov 19, 2026
e97e553
remove: drop the Go reference implementation
Akhrameev Nov 19, 2026
d114baa
fix: parity.sh robustness, version stamping, and doc corrections afte…
Akhrameev Nov 19, 2026
e73d32a
build: make format cover swift/ as well as gui/
Akhrameev Nov 19, 2026
39d49bc
docs: explain the prebuilt binary and Gatekeeper quarantine
Akhrameev Nov 19, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,21 @@ permissions:
contents: read

jobs:
check:
swift:
runs-on: macos-26
env:
DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Check
run: make check
- name: Lint
run: make swift-lint
- name: Test
run: make swift-test
- name: Dependency audit
run: make verify-deps

- name: App sources
run: make app-check
- name: Build app
run: VERSION=0.0.0 BUILD_NUMBER="$GITHUB_RUN_NUMBER" make app
- name: Verify app
Expand Down
67 changes: 20 additions & 47 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,72 +1,45 @@
name: release

# Publishes the Swift CLI built with the Xcode toolchain alone. This fork does not
# publish the Go build or a Homebrew bottle: those belong to upstream
# (github.com/mobai-app/simslim) and its tap.

on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: Existing release tag to add a Homebrew bottle to
required: true
type: string

env:
SIMSLIM_RELEASE_TAG: ${{ inputs.tag || github.ref_name }}

permissions:
contents: write

env:
DEVELOPER_DIR: /Applications/Xcode_26.6.app/Contents/Developer
SIMSLIM_RELEASE_TAG: ${{ github.ref_name }}

jobs:
release:
runs-on: macos-15
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Test
run: |
cd swift
swift test
- name: Build
if: github.event_name == 'push'
run: |
SIMSLIM_VERSION="${SIMSLIM_RELEASE_TAG#v}"
go test ./...
go build -ldflags "-X main.version=${SIMSLIM_VERSION}" -o simslim ./cmd/simslim
printf '// Copyright (c) 2026 Pavel Akhrameev (Swift port). MIT License; see LICENSE.\n\npublic let simslimVersion = "%s"\n' \
"${SIMSLIM_VERSION}" > swift/Sources/SimSlimKit/Version.swift
(cd swift && swift build -c release)
cp swift/.build/release/simslim simslim
codesign --force --sign - simslim
test "$(./simslim --version)" = "simslim ${SIMSLIM_VERSION}"
tar -czf "simslim-${SIMSLIM_RELEASE_TAG}-macos-arm64.tar.gz" simslim
shasum -a 256 "simslim-${SIMSLIM_RELEASE_TAG}-macos-arm64.tar.gz"
- name: Build Homebrew bottle
run: |
SIMSLIM_SOURCE_URL="https://github.com/${GITHUB_REPOSITORY}/archive/refs/tags/${SIMSLIM_RELEASE_TAG}.tar.gz"
SIMSLIM_SOURCE_TARBALL="${RUNNER_TEMP}/simslim-source.tar.gz"
SIMSLIM_BUILD_TAP="mobai-app/simslim-release"

curl --fail --location --retry 3 "${SIMSLIM_SOURCE_URL}" --output "${SIMSLIM_SOURCE_TARBALL}"
SIMSLIM_SOURCE_SHA256="$(shasum -a 256 "${SIMSLIM_SOURCE_TARBALL}" | cut -d ' ' -f 1)"

brew tap-new --no-git "${SIMSLIM_BUILD_TAP}"
SIMSLIM_FORMULA="$(brew --repository "${SIMSLIM_BUILD_TAP}")/Formula/simslim.rb"
mkdir -p "$(dirname "${SIMSLIM_FORMULA}")"
sed \
-e "s|@SOURCE_URL@|${SIMSLIM_SOURCE_URL}|g" \
-e "s|@SOURCE_SHA256@|${SIMSLIM_SOURCE_SHA256}|g" \
packaging/homebrew/simslim.rb.in > "${SIMSLIM_FORMULA}"

brew install --build-bottle "${SIMSLIM_BUILD_TAP}/simslim"
brew test "${SIMSLIM_BUILD_TAP}/simslim"
brew bottle \
--json \
--no-rebuild \
--root-url "https://github.com/${GITHUB_REPOSITORY}/releases/download/${SIMSLIM_RELEASE_TAG}" \
"${SIMSLIM_BUILD_TAP}/simslim"

# brew uses a double dash locally; custom HTTP bottle URLs use one.
for SIMSLIM_BOTTLE in simslim--*.bottle*.tar.gz; do
mv "${SIMSLIM_BOTTLE}" "${SIMSLIM_BOTTLE/--/-}"
done
shasum -a 256 "simslim-${SIMSLIM_RELEASE_TAG}-macos-arm64.tar.gz" | tee "simslim-${SIMSLIM_RELEASE_TAG}-macos-arm64.tar.gz.sha256"
- name: Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.SIMSLIM_RELEASE_TAG }}
generate_release_notes: true
files: |
simslim-*-macos-arm64.tar.gz
simslim-*.bottle*.tar.gz
simslim-*.sha256
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@
*.tar.gz
.DS_Store
/build/
/swift/.build/
.vscode/
190 changes: 99 additions & 91 deletions CLAUDE.md

Large diffs are not rendered by default.

24 changes: 24 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Contributing

## Before you commit

```sh
make format # swift-format over gui/ and swift/ (rewrites files)
make app-check # gui swift-format lint --strict, build-app.sh syntax, Info.plist lint
make swift-lint swift-test verify-deps
```

CI runs the app-check, Swift lint, test and deps-audit steps in one job (not `make format`, which rewrites files). None of them need a Go toolchain — the Go reference implementation was
removed; see [docs/remove-go.md](docs/remove-go.md). The only thing that still wants Go is
`scripts/parity.sh`, a regression check against the last Go build (tag `go-reference-final`); see
[docs/parity-check.md#prerequisite-check-go-toolchain](docs/parity-check.md#prerequisite-check-go-toolchain)
for what to run instead when Go isn't available. Never install Go just to satisfy a check; its absence is a
valid environment.

## Changing the mutating core

Changing the slim engine (`Slim.swift`), `Live.swift`, `DisabledStore.swift`, `ProfileSave.swift`, or any
destructive command deserves extra care and, ideally, a parity run against the Go reference; see
[docs/parity-check.md](docs/parity-check.md).

See [CLAUDE.md](CLAUDE.md) for the full architecture notes and safety invariants.
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
MIT License

Copyright (c) 2026 Interlap
Copyright (c) 2026 Pavel Akhrameev (Swift port)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
.PHONY: app cli check format test

VERSION ?= $(shell git describe --tags --always --dirty)

cli:
go build -ldflags "-X main.version=$(VERSION)" -o simslim ./cmd/simslim
.PHONY: app app-check format swift-lint swift-test verify-deps

app:
./scripts/build-app.sh

test:
go test ./...

check: test
go vet ./...
# App sources and build script gate.
app-check:
xcrun swift-format lint --strict --recursive gui
zsh -n scripts/build-app.sh
plutil -lint gui/Info.plist

format:
gofmt -w *.go
xcrun swift-format format --in-place --recursive gui
xcrun swift-format format --in-place --recursive gui swift/Sources swift/Tests

swift-lint:
xcrun swift-format lint --strict --recursive swift/Sources swift/Tests

swift-test:
cd swift && swift test

# Dependency audit of the Swift port (system modules only, no network, no third-party libs).
verify-deps:
./scripts/verify-deps.sh
121 changes: 68 additions & 53 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,29 @@
# simslim

> **This repository is an independent Swift port of [MobAI's simslim](https://github.com/mobai-app/simslim).
> It is not the official project and is not meant to be merged upstream.**
>
> Many thanks to the original authors at [MobAI](https://mobai.run) (Interlap) for simslim itself: the
> daemon allowlist, the offline `disabled.plist` fast path, the measurements, and the design this port follows.
>
> **Why a port.** To use fewer technologies for the same result. The original CLI is written in Go; the CLI
> in [`swift/`](swift) builds with the Xcode toolchain alone, which any Mac that runs the Simulator already has.
> It has no Go toolchain, no third-party packages and no network access, and
> [`scripts/verify-deps.sh`](scripts/verify-deps.sh) checks that.
>
> **Status.** The port is complete: every command, the `--json` contract, and the safety invariants carry
> over, the macOS app bundles the Swift CLI, and the Go tree has been removed from this repository (see
> [docs/remove-go.md](docs/remove-go.md)). [`scripts/parity.sh`](scripts/parity.sh) remains as a
> regression check against the last Go build, tagged `go-reference-final`: it runs the same commands
> through both CLIs on real simulators and diffs the output. A full run (read-only, `--mutating` on a
> scratch simulator, and `--watch`) found no behavioral differences on the paths it covers. That is not a
> proof of full parity: live measurements are compared by shape, and the known, deliberate differences
> (including a run-order effect in `watch`) are listed in [docs/parity-check.md](docs/parity-check.md).
>
> **Upstream.** The Homebrew tap `mobai-app/tap` and `go install github.com/mobai-app/simslim` install
> upstream's Go version, not this port. Report problems with this Swift build here and problems with the Go
> version upstream.

Run a lot more iOS, Apple TV (tvOS), Apple Watch (watchOS), and Apple Vision Pro (visionOS) simulators on one Mac by turning off the background daemons a simulator doesn't need.

A freshly booted iOS simulator starts around 180 background services: Siri, Spotlight indexing, photo analysis, News, wallpaper posters, iCloud sync, and so on. None of it matters when you're using the simulator for development, testing, or CI. simslim switches those services off, which cuts each simulator's memory roughly 4x. On the same laptop you go from a handful of simulators to a screenful.
Expand Down Expand Up @@ -29,15 +53,46 @@ shared mappings once for every process that maps them.
## Install

```sh
brew install mobai-app/tap/simslim
git clone https://github.com/Akhrameev/simslim && cd simslim/swift
swift build -c release
.build/release/simslim --version
```

### Prebuilt binary

Tagged releases attach `simslim-<tag>-macos-arm64.tar.gz` (Apple Silicon only) and its `.sha256`
on the [Releases page](https://github.com/Akhrameev/simslim/releases). The binary is ad-hoc
codesigned, **not** signed with an Apple Developer ID and **not notarized**. A file downloaded
through a browser carries the quarantine flag, and Gatekeeper then refuses to run it. Either
fetch it with `curl`, which does not set the flag:

```sh
curl -fsSLO https://github.com/Akhrameev/simslim/releases/download/<tag>/simslim-<tag>-macos-arm64.tar.gz
tar -xzf simslim-<tag>-macos-arm64.tar.gz
./simslim --version
```

or
or clear the flag after a browser download:

```sh
go install github.com/mobai-app/simslim/cmd/simslim@latest
xattr -d com.apple.quarantine simslim
```

Verify the download against the `.sha256` file with `shasum -a 256 -c`. Building from source
(above) avoids the issue entirely.

Upstream's original Go build is installed separately, not by this repository:
`brew install mobai-app/tap/simslim` or `go install github.com/mobai-app/simslim/cmd/simslim@latest`.

### About this build

It covers every command: `list`, `profiles`, `status`, `verify`, `doctor`,
`measure`, `on`, `off`, `boot`, `shutdown`, `enable`, `disable`, `watch`,
`rename`, `erase`, `delete`, `top`, `size`, `profile`, `clone`, `repair-clone`,
and the `disk-*` commands. `scripts/verify-deps.sh` checks that the Swift code imports only
Apple system modules, uses no network API, and links
only system libraries.

macOS only, and you need Xcode with an iOS, tvOS, watchOS, or visionOS Simulator
runtime, since simslim drives simulators through `xcrun simctl`.

Expand Down Expand Up @@ -74,7 +129,7 @@ The SwiftUI app bundles the CLI and adds:
- Read-only disk analysis plus confirmed cleanup of allowlisted data.
- Clone, rename, erase, delete, and Finder shortcuts.

Build it locally with Go and Xcode:
Build it locally with Xcode alone (the app bundles the Swift CLI; no Go needed):

```sh
make app
Expand Down Expand Up @@ -404,56 +459,16 @@ Documents, app data, and user media. Those durable rows are never eligible for
cleanup. See the [disk cleanup safety model](docs/disk-cleanup.md) for recovery
behavior, safeguards, and Xcode 26.6 validation results.

## Use as a Go library

The repo root is an importable package with no external dependencies, so you can
drive simulators from your own tooling instead of shelling out to the CLI:

```sh
go get github.com/mobai-app/simslim
```
## Use as a library

```go
package main

import (
"context"
"fmt"

"github.com/mobai-app/simslim"
)

func main() {
ctx := context.Background()

devices, err := simslim.ListDevices(ctx)
if err != nil {
panic(err)
}

// Slim every booted simulator, keeping Siri and search enabled.
profile, err := simslim.BuildProfile("", "siri,search", "")
if err != nil {
panic(err)
}
for _, d := range devices {
if d.State != "Booted" {
continue
}
changed, err := simslim.EnableSlim(ctx, d.Set, d.UDID, profile, func(msg string) {
fmt.Println(d.UDID, msg)
})
fmt.Println(d.UDID, "changed:", changed, "err:", err)
}
}
```
`SimSlimKit` (`swift/Sources/SimSlimKit`) is the importable library behind the CLI, with no external
dependencies, so you can drive simulators from your own Swift tooling instead of shelling out to the CLI —
see [CLAUDE.md](CLAUDE.md#architecture) for its shape. It is not published as a package product and has no
stable, versioned API; today it is an internal target of this repository's package (`swift/Package.swift`),
not something other packages can depend on.

The package never writes to stdout — it returns values and reports progress
through the `simslim.Reporter` callback you pass in. `simslim.Categories`,
`simslim.Features`, and `simslim.SlimmableSet()` expose the same allowlist the
CLI uses; `simslim.EnableServices`, `simslim.DisableServices`, and
`simslim.SaveServices` back `enable`, `disable`, and `--save`. macOS only,
since everything runs through `xcrun simctl`.
Upstream's original Go package (`go get github.com/mobai-app/simslim`) offers the same capability for the
Go build; see [its repository](https://github.com/mobai-app/simslim) for that API.

## How it works

Expand Down Expand Up @@ -524,4 +539,4 @@ Built for [MobAI](https://mobai.run) to run more simulators on one machine.

## License

MIT, copyright Interlap.
MIT. Copyright Interlap (original simslim) and Pavel Akhrameev (Swift port). See [LICENSE](LICENSE).
Loading