Field notes · XCODE / CHATGPT

A Mac App Loses Folder Access After Relaunch: Investigate with Relayard

Trace a sandboxed Mac app from folder selection to bookmark persistence, restored access and background work. A bounded Relayard investigation with a copyable brief and relaunch acceptance checks.

A saved path is not a restored authorization. Trace the selected URL through storage, bookmark resolution and the actual file operation before changing permissions. This is an illustrative, source-backed practical walkthrough, not a recorded repair or a tested patch.

1. Make the process boundary visible

Consider a sandboxed macOS document-indexing app. A person selects a folder, the app lists its documents, and a later launch shows the same folder name but cannot read it. This is a hypothetical working scenario. The successful first read narrows the investigation; it does not prove that every later failure is a bookmark bug.

Use a disposable folder with a known text file. Record the app build, macOS version, launched app identity and whether the operation is read-only. Select the folder, read the file, quit the app completely, reopen that same build, and retry without selecting the folder again. Keep the error domain and code, with private paths redacted.

Then reselect the same folder as a comparison. If access returns, persistence or restoration becomes a useful hypothesis. If it still fails, investigate the file, volume and underlying error as well. A display label surviving relaunch only proves that some UI data survived.

2. Ask Relayard to follow the URL, not rewrite the scanner

In an authorized project session, confirm the selected Xcode project and the read capabilities currently available through Relayard. Locate the folder picker callback, stored folder record, startup restoration and indexing entry point. Ask for file and symbol references linking those stages. Relayard connects the conversation to that implementation; it does not itself grant the app file-system permission.

A focused source inspection
BoundaryQuestion
Selection → storageIs the app retaining bookmark data or just a path string?
Storage → restorationWhich record is read at launch, and are resolution failures visible?
Restoration → operationIs the resolved URL passed into the actual reader?
Operation → completionCan access end before asynchronous file work finishes?

Read the target’s existing sandbox configuration alongside this path. Keep the first pass read-only. A list of concrete implementation gaps is more reviewable than a replacement storage layer or a speculative entitlement change.

3. Separate persistence, resolution and active access

Apple documents security-scoped bookmarks as the mechanism for retaining sandboxed file access across launches. For this macOS scenario, inspect creation with the security-scope option, durable storage and resolution of that stored data. A stale resolved bookmark needs renewal in storage. [1] These are checkpoints to compare with the project, not proof of its current defect.

Bookmark resolution can throw; it also reports whether the bookmark is stale. [3] Keep “no saved record,” “resolution failed,” “resolved but stale” and “file operation failed” distinguishable in diagnostics. Do not turn every state into an empty document list.

For a URL restored from an explicit security-scoped bookmark, inspect the access lifetime around the real operation. Successful starts must be balanced with stops after use. [2] A synchronous wrapper that starts access, launches a task and immediately returns can release access before that task reads anything. That is an inspection hypothesis, not a claim about this app.

4. Propose the smallest repair supported by evidence

If the code only stores a path, propose a bookmark-based restoration change that preserves existing records and offers reselection for entries that cannot be restored. If the bookmark already exists, inspect the resolved URL and access lifetime before changing storage. If a helper process performs the read, treat its access as a separate boundary rather than assuming the main app’s URL is sufficient.

Prefer an explicit “Choose folder again” recovery state to silent failure. Cancelling that picker should leave the existing record intact. Do not disable App Sandbox, reset system privacy settings, change signing identities or request broad disk access simply to make the reproduction disappear.

Before an authorized edit, review affected files and the proposed behavior. Afterward, inspect the focused diff and read the native build result for that revision. A successful Relayard request is not a substitute for the underlying build or runtime outcome.

5. A copyable task brief

Supply observations and a harmless fixture. Begin with source inspection, then authorize the specific patch once its scope is clear.

TRY THIS IN CHATGPT
Use Relayard to inspect a sandboxed macOS app that loses folder access after relaunch.
Build/macOS/app identity: [values]. Operation: [read-only or required write].
Reproduction: select [harmless fixture], read, quit fully, reopen the same build, read again.
Expected/observed: [values]. Redacted error domain/code: [values].
First confirm the selected project and available read tools. Do not edit yet.
Trace picker callback → stored record → bookmark resolution → actual file reader.
Inspect stale handling, the resolved URL, access start/stop and asynchronous lifetime.
Distinguish evidence from hypotheses; identify the next check for each candidate cause.
Do not disable sandboxing, alter signing, reset privacy or scan unrelated user folders.
Propose a narrow patch preserving existing records and cancellation behavior.
After an authorized change, report revision, native build result, relaunch checks and gaps.

6. Verify a new process, not a refreshed screen

Proposed checks — no results claimed
CheckExpected evidence
Select → read → quit → reopen → readSame build reads the known file without another selection.
Repeated reads and asynchronous completionAccess remains active for the work and is released afterward.
Unavailable folder or invalid saved recordAn actionable recovery state; no false empty-success result.
Reselect, then cancel a later selectionRecovery works; cancellation preserves the current record.
Read-only taskNo unintended writes or broader permission changes.

Record the revision, app identity, fixture and observed outcome for each applicable check. Add stale-bookmark renewal when your test setup can exercise it; do not assume moving a folder always produces that flag. If runtime tools are unavailable, hand over these exact steps and mark them pending.

This publication changed and checked only the website. No Mac app, bookmark, permission or Xcode project was operated on for the article. The actual root cause, patch and relaunch result remain unverified until a developer applies this method to an authorized project.

Common questions

Does connecting Relayard restore file permissions?

No. It enables an authorized project workflow using the tools actually available. The app still needs correct file-access handling and user-granted access.

Is every permission error a stale bookmark?

No. Use the underlying error and the selected-versus-restored comparison. Missing files, unavailable volumes and other access restrictions require separate investigation.

Sources and next steps

Published October 21, 2026. Apple documentation was checked on that date, including its Markdown content. The scenario, investigation table, task brief and acceptance plan are editorial guidance. No fresh project repair record was used; no live Mac/Xcode operation, patch, screenshot or passing runtime test is claimed.

  1. Apple: Accessing files from the macOS App Sandbox
  2. Apple: startAccessingSecurityScopedResource()
  3. Apple: Resolving URL bookmark data