---
title: "Upgrading CEF and profiles"
description: "How CEF updates arrive, CI and releases, and what an upgrade does to existing profiles."
---

```sh
Scripts/update-cef.py --check   # report whether a newer stable CEF exists
Scripts/update-cef.py           # update the working tree to it
```

## Upgrading profiles from CEF 156

Chromium 158 uses a different encryption key for custom macOS data directories,
including CefSwift's per-app default. Plan for users to sign in to sites again
after upgrading an existing profile. Chromium discards unreadable cookies on
first use. Other data encrypted with the old key, such as saved passwords,
may also be unreadable. CefSwift keeps Chromium's new key protection enabled.

In an upgrade test with ad hoc signing, persistent cookies were lost across all
three profiles. Browsing history and local storage survived. Team-signed keychain
profiles were outside that test. [Chromium's key selection](https://chromium.googlesource.com/chromium/src/+/refs/tags/158.0.8127.89/chrome/browser/browser_process_impl.cc)


## CEF updates

`.github/workflows/cef-update.yml` (CEF Update) runs every Monday and
Thursday at 06:17 UTC and keeps the pinned CEF on the newest stable release.

1. `Scripts/update-cef.py` reads the CEF build index and picks the newest
   stable release that ships the minimal and standard distributions for both
   macOS architectures. A newer release that is out for one architecture
   only is logged and waited for.
2. If that release is newer than `CEF_VERSION.json`, the script downloads the
   arm64 minimal distribution into `.cef/downloads` (resuming a partial
   download, verifying size and SHA-1, and starting over once if a resumed
   download does not verify). It stages the new headers in `.cef/update`,
   regenerates the C bridge there, and only then moves the headers and
   generated files into `Sources/CCef` and rewrites `CEF_VERSION.json`. A
   failure at any step leaves the tree unchanged, and a second run does
   nothing.
3. The workflow commits the change to the `cef-update` branch, opens a pull
   request or refreshes the open one, saves the download to the Actions
   cache for CI, starts CI on the branch, and enables auto-merge. An open
   pull request that already pins the same CEF and `CEF_API_VERSION` is left
   alone, so fixes pushed to it survive later runs.
4. When there is nothing to update and a `cef-update` pull request is still
   open, the workflow closes it as obsolete and deletes the branch.

The pull request lists CEF, Chromium and `CEF_API_VERSION` before and after,
and the C functions added, removed or changed. It merges only when CI
passes. The squash commit on `main` is:

```
Update CEF to <new version>

From <old version>.

Co-authored-by: <CEF_UPDATE_COAUTHOR>
```

The `Co-authored-by:` line is present only when a co-author is configured
(see [Attribution](/ship/upgrading#attribution)).

### Failure reports

- **CI fails on an update branch.** CI for `cef-update` and `cef-api-update`
  is started with the workflow token, which notifies nobody. When it fails,
  CI's `report` job comments on the open pull request with a link to the
  run, whose summary lists the SelfTest `FAIL` lines. Auto-merge keeps
  waiting. Push a fix to the branch; later update runs leave it alone until
  a newer CEF is released.
- **The update run fails.** For example, the release's headers do not
  support the pinned API version. The workflow comments on the open issue titled
  **CEF update failed**, or opens it. Close the issue once a run succeeds; it
  is not closed automatically.

### Attribution

Update commits are authored by `github-actions[bot]`. To credit a person
as well, set the repository variable `CEF_UPDATE_COAUTHOR` to
`Name <email>`, using an address GitHub associates with the account, such
as its `noreply` address; the commits then carry a `Co-authored-by:`
trailer. Without the variable, `Rajaniraiyn/CefSwift` credits its
maintainer and any other repository, a fork included, adds no trailer.

### One-time repository setup

- Settings → General: enable **Allow auto-merge**.
- Protect `main` with the `ci` job as a required status check. Without it,
  auto-merge would merge before CI has run.
- Settings → Actions → General: allow GitHub Actions to create pull
  requests.
- Optional: set the `CEF_UPDATE_COAUTHOR` variable to credit a co-author.

## Moving `CEF_API_VERSION`

The pin in `Sources/CCef/include/ccef_config.h` selects a versioned CEF ABI.
Newer versioned CEF APIs stay hidden until the pin moves. Swift also imports
unversioned headers such as Chromium's command IDs, which can change with
the CEF release. Moving the API pin is a separate, reviewed change:

- Run **CEF Update** by hand with `api_version` set to `latest` (the newest
  version in the vendored `cef_api_versions.h`) or a number such as `15700`.
  It works on the headers already vendored and opens a `cef-api-update` pull
  request that does not merge itself.
- Or run `Scripts/update-cef.py --api-version latest` locally.

If a new CEF release drops the pinned API version, the scheduled run fails
and says so. Move both at once with
`Scripts/update-cef.py --to latest --api-version latest`, then adapt the
Swift code.

After the move, look for what the new version adds and changes:
`grep -rn 'CEF_API_ADDED(<version>)\|CEF_API_REMOVED(<version>)'
Sources/CCef/include/include` lists every gated member, enum value and
function. Members appended to a struct (CEF versions append, never
reorder) compile in and stay null until CefSwift sets them; new enum values
need a case wherever Swift maps the enum; removed members fail the build
where Swift uses them.

The move from 15600 to 15800 (2026-11-29, CEF 158.0.6) added three bound
functions (`cef_keyboard_input_event_from_mac_event`, its `_ex` variant and
`cef_windows_key_code_from_dom_code_and_key`), the portable input members
of `cef_browser_host_t` and `cef_client_t.get_input_handler`, and enum
values such as `TS_EVICTED_FOR_MEMORY`. It removed nothing CefSwift used
and needed no change to existing code: the new values got their mappings
and the input events their API ([API coverage](https://github.com/Rajaniraiyn/CefSwift/blob/main/docs/api-coverage.md#portable-input-api-version-15800)).

## Running the scripts

```sh
Scripts/update-cef.py --check                        # report whether a newer stable exists
Scripts/update-cef.py                                # update the working tree
Scripts/update-cef.py --to <version>                 # vendor that stable release (also repairs a tree)
Scripts/update-cef.py --api-version latest           # move only the API pin, on the vendored headers
Scripts/update-cef.py --to latest --api-version latest
Scripts/update-cef.py --index index.json             # use a saved copy of the CDN index
Scripts/update-cef.py --self-test                    # offline checks of the script
Scripts/generate-bindings.py                         # regenerate the C bridge
Scripts/generate-bindings.py --check                 # fail if the bridge is out of date
Scripts/generate-bindings.py --check --framework <path to Chromium Embedded Framework.framework>
```

`--check` only reports and cannot be combined with `--to` or
`--api-version`. The update script writes its results (`updated`, `cef_old`,
`cef_new`, `api_old`, `api_new`, `subject`) to `$GITHUB_OUTPUT`, or to
standard output outside Actions, and the commit message and pull-request
description to `.cef/update/`.

## CI

`.github/workflows/ci.yml` runs on pull requests and pushes to `main`, and
when dispatched. A newer push cancels a run still in progress on the same
pull request, or on `main`, where the latest commit's run covers the ones
before it. Pull requests merge on their own green run without having to be
up to date, so the run on `main` is the check after the merge.

A pull request runs what its change can affect; `main` runs everything.
A pull request has at most five macOS jobs at a time, the limit of a free
account.

- `changes` (Ubuntu) runs `Scripts/select-tests.py`:
  - `--check`: every SelfTest group has an entry in
    `Scripts/test-impact.json` and every glob there matches a file, so the
    mapping cannot rot silently.
  - It selects, from the files changed (on a pull request, against its
    base; on `main`, since the last commit `main` passed CI at): whether
    any code changed (`*.md` outside the targets, `docs/`, `www/` and
    `LICENSE` are documentation), whether the sanitizers are needed, and
    which SelfTest groups to run, and whether the Swift samples of a
    documentation change changed (its `swift` code blocks, not the prose
    around them). A group runs when a changed file is one of its checks,
    or a library file that declares a public name its
    checks (or the SelfTest helpers they call) mention; a file it cannot
    trace (a core type such as `CefPage`, the C bridge, the helpers, the
    bundler, the harness, CI) runs every group. The smoke groups in
    `test-impact.json` always run. `--explain <file>` says what a file
    selects and why.
  - It splits the groups between up to four runners, about 2.5 minutes
    of groups each, longest first, by the group timings of the last run
    on `main` (`Scripts/selftest-timings.json` until there is one).
- `unit`, with the runner's Xcode toolchain:
  1. The update script's self-test.
  2. The CEF distribution (minimal, arm64), cached extracted; on a miss,
     the cached archive and `cef download`.
  3. `Scripts/generate-bindings.py --check --framework …`: the generated
     bridge must match the headers, and the framework must export every
     function it binds.
  4. `swift build --build-tests`, then check that the built code's
     deployment target is macOS 14.
  5. `swift test`, with `CEF_FRAMEWORK_PATH` set, so the loader tests run;
     `swift test --package-path Examples`, the Browser example's unit
     tests.
  6. `Scripts/check-doc-samples.py`: every Swift sample in the README and
     the docs compiles.
  7. On `main` only: `swift test` with the Command Line Tools, and the
     package and its tests compiled for x86_64 on the same arm64 runner,
     checked to be x86_64 for macOS 14. CefKit loads the CEF framework at
     run time and the plugin builds the helper only when it bundles, so
     compiling needs no `macosx64` CEF archive.
- `sanitizers`, when the library or its tests changed: the unit tests
  under the Thread Sanitizer and the Address Sanitizer, each in a scratch
  path of its own.
- `bundle`, with the Command Line Tools alone (`xcodebuild` must not be
  reachable): SelfTest built in release and bundled, and `cef doctor` on
  it; on `main`, or for a change to those examples, Gallery, Minimal and
  Browser too, and `cef doctor` on Minimal. The bundles are handed to the
  `selftest` jobs as an artifact (a tar, which keeps the framework's
  links and the signatures), so a run compiles once however many parts
  it has.
- `selftest`, one to four jobs, each running the bundle `bundle` made:
  the job's groups run with `SELFTEST_ONLY`, `SELFTEST_ISOLATED=1` (each
  group in a process of its own), `SELFTEST_STRICT=1` (a skip for a
  reason of the environment fails) and `SELFTEST_JSON`, with no build
  directory, as on another Mac. `SELFTEST_EXPECTED_SKIPS` names the
  checks a hosted runner cannot run, being a virtual machine: frame rates that follow a display's
  refresh, and FairPlay playback; those are verified on a Mac only. The
  `FAIL` and `SKIP` lines go to the run summary; on failure, the log, the
  results and the crash reports are uploaded as
  `selftest-diagnostics-<part>`. On `main`, or for a change to those
  examples, part 1 also runs `Gallery -smoke`, which opens each demo in
  turn, and measures the idle footprint of Minimal and Browser with
  `Scripts/measure-footprint.py` (bounds about 1.5 times what an Apple M3
  measures, so only a gross regression fails).
- `docs`, for a change of documentation only that changes a Swift sample
  in `README.md`, `docs/`, `www/pages/` or `skills/`: the samples still
  compile, from the cached build. Each sample's file is named by its
  content and rewritten only when it changes, so only the changed samples
  recompile.
- `ci` (Ubuntu), the required check: passes when every job above passed,
  or was skipped as not needed. It runs even when they failed or were
  cancelled, so it never reports as skipped.
- `timings` (Ubuntu, `main`): merges the SelfTest jobs' results into the
  group timings the next runs split by, kept in the Actions cache.
- `xcode`, on `main` and dispatched runs, after `unit`: runs
  `Scripts/check-xcode-example.sh`, the Xcode example (`Examples/Xcode`)
  built with `xcodebuild`, Debug and Release, archived and exported, each
  build launched with `-smoke YES`, and `cef doctor` on the exported app.
  It is not a required check: release tags and CEF updates wait for `ci`
  only.
- `templates`, on `main` and dispatched runs, after `unit`: generates each
  `cefswift new` template (`Templates/`) against the checkout, runs the
  browser template's unit tests, bundles each, runs `cef doctor` and
  launches it, then builds and launches the browser template's Xcode
  project. It catches a Browser example change that breaks the browser
  template, which copies its code. Not a required check.
- `report` (Ubuntu): when `ci` or `xcode` fails on `main`, the run summary
  names the commits since `main` was last green; when `ci` fails for a CEF
  update pull request, a comment on it says so.

Builds are incremental. `.build`, `Examples/.build` and the sanitizers'
scratch paths are cached per toolchain, saved from `main` and restored on
every branch (the newest entry for that toolchain). Each cache holds the
commit it was built from (`.cache-source-commit`), and
`Scripts/restore-mtimes.py` gives unchanged files a fixed old time and the
files that differ from that commit the current time, so only those
recompile. Commit times would not do: a pull request's files keep their own
commits' times, which can be older than the cached build. A cache without a
marker, or with a commit the checkout lacks, rebuilds everything. Every job
that builds checks that the build left the working tree clean.

What CI verifies, and what it does not:

- Compiling against the macOS 14 deployment target means the compiler
  rejects any newer API used without an availability check. Nothing runs
  on macOS 14, since GitHub no longer offers a macOS 14 runner: CefKit's
  macOS 14 executor path is compiled but not exercised, and the unit
  tests and SelfTest run on macOS 15 only.
- Everything compiles for Intel, on `main`, and nothing runs there. Running on Intel
  needs an Intel runner (`macos-15-intel`) and a SelfTest run there, on a
  schedule rather than per pull request, given what those runners cost.
  An arm64 runner can bundle for Intel (`cef bundle --architectures
  x86_64`) but not run the result.
- The toolchains the runner image has: its selected Xcode and its Command
  Line Tools (the same Swift release on hosted runners), and its newest
  Xcode for `xcode`. CI does not build with the oldest Swift 6 toolchain
  the package claims.

## Releases

Pushing a `v*` tag creates a GitHub release with generated notes
(`.github/workflows/release.yml`). SwiftPM resolves the tag itself, so there
are no assets to build.

The release is made only for a commit CI passed: before it creates the
release, the workflow reads the tagged commit's check runs and requires
the latest `ci` run to have succeeded (on `main` it includes the Intel
build), waiting up to 75 minutes for runs still in progress. A commit
pushed to `main` has that run unless a newer push cancelled it. For
another commit, run CI on the tag first
(`gh workflow run ci.yml --ref v0.1.0`), then re-run the release workflow.
