Skip to content

fix(macos): keep AppleDouble files and Python bytecode out of the app bundle - #173

Merged
mcoliver merged 2 commits into
mainfrom
fix/macos-appledouble
Oct 26, 2026
Merged

mcoliver merged 2 commits into
mainfrom
fix/macos-appledouble

Conversation

@mcoliver

@mcoliver mcoliver commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #172.

AppleDouble ._* files

codesign stores signatures for non-Mach-O files under Contents/PlugIns and Contents/MacOS in extended attributes, and ditto -c -k writes those into the zip as inline ._name entries. Any extractor other than Finder or ditto, unzip for example, turns them into real files, and UTV tried to load each ._*.gto.

  • The zips in dev-build.yml, release.yml and branch-build.yml now use ditto -c -k --sequesterRsrc, which stores the attributes under __MACOSX/ instead. Finder, ditto -x and Homebrew still restore them.
  • NodeManager, profiles, brush tips and TwkUtil::findInPath skip ._* files. findInPath covers the image, movie, output, audio and CMS plugins and LUTs. PackageManager already skipped them. This covers older zips and SMB shares, which create these files too.

Checked against the signed dev build:

._ files inside UTV.app codesign --verify --deep --strict
Current zip, unzip 375 fails
--sequesterRsrc zip, unzip 0 (__MACOSX/ sits beside the app) n/a
--sequesterRsrc zip, ditto -x -k 0 passes

Python bytecode inside the bundle

On first launch Python wrote __pycache__ into Contents/PlugIns/Python, Contents/lib/python3.x/site-packages and other bundle folders. That breaks the code seal: a sealed resource is missing or invalid. On Windows and Linux, installs in Program Files or /opt aren't writable, so modules were recompiled on every launch.

PYTHONPYCACHEPREFIX now points to:

  • ~/Library/Caches/UTV/pycache on macOS
  • the generic cache location elsewhere: ~/.cache/UTV/pycache on Linux, %LOCALAPPDATA%\cache\UTV\pycache on Windows

A value the user has already set is left alone.

…oads (#172)

codesign stores the signature of every non-Mach-O file under Contents/PlugIns
and Contents/MacOS in extended attributes. `ditto -c -k` writes those into the
zip as inline `._name` entries, which `unzip` (and any non-Apple extractor)
turns into real files next to the originals. UTV then tried to load them, so
startup logged "failed to load definition file" for each `._*.gto`.

- Zip with `ditto -c -k --sequesterRsrc`, which stores the attributes under
  `__MACOSX/` instead. Finder, `ditto -x` and Homebrew still restore them, so
  the signature verifies; `unzip` leaves them outside UTV.app.
- Skip `._*` files in NodeManager, profiles, brush tips and
  TwkUtil::findInPath (format, output, audio and CMS plugins, LUTs), so
  existing zips and SMB shares, which also create these files, stay quiet.

Checked on a signed dev build: the current zip has 375 `._` entries inside
UTV.app; the sequestered zip has none after `unzip`, and after `ditto -x`
`codesign --verify --deep --strict` passes.

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
Python wrote __pycache__ next to the bundled modules on first launch. On
macOS that adds files under UTV.app/Contents, which breaks the bundle's code
signature (`codesign --verify` reports "a sealed resource is missing or
invalid"). On Windows and Linux the install directory is usually read-only,
so modules were recompiled on every launch.

Set PYTHONPYCACHEPREFIX to ~/Library/Caches/UTV/pycache on macOS and to the
generic cache location (~/.cache, %LOCALAPPDATA%) elsewhere, unless the user
has already set it.

Signed-off-by: Michael Oliver <mcoliver@gmail.com>
@mcoliver
mcoliver force-pushed the fix/macos-appledouble branch from f25d974 to 61141c4 Compare October 26, 2026 19:58
@mcoliver
mcoliver merged commit 61141c4 into main Oct 26, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS zips carry ._ AppleDouble entries; extracting with unzip makes UTV log node definition errors

1 participant