Skip to content

fix(馃悰): Don't require libs/macos to run pod install - #4005

Open
Spencer-Yoder wants to merge 5 commits into
Shopify:mainfrom
Spencer-Yoder:fix/podspec-optional-macos-libs
Open

fix(馃悰): Don't require libs/macos to run pod install#4005
Spencer-Yoder wants to merge 5 commits into
Shopify:mainfrom
Spencer-Yoder:fix/podspec-optional-macos-libs

Conversation

@Spencer-Yoder

Copy link
Copy Markdown

The podspec raises if libs/macos is missing, even when only iOS is being built. tvOS already handles its own absence gracefully a few lines below, so the two platforms behave inconsistently for the same condition.

This matters for iOS-only apps. The react-native-skia-apple-* binaries are declared as hard dependencies, so every consumer downloads all of them. An iOS-only app can never use the macOS or tvOS xcframeworks, but pruning them with an override is blocked by the raise.

Make macOS mirror the existing tvOS handling: fall back to an empty vendored_frameworks list when libs/macos is absent, and only hard-fail when libs/ios is missing. The error still fires for the case it was written for - a consumer who never ran yarn install, where libs/ios is also absent. No behaviour change when the packages are present, since libs/macos then exists and the original path is taken.

Also document the npm-side story, which was previously a single sentence: which prebuilt packages exist, which can be pruned and how, and why react-native-skia-apple-ios, react-native-skia-android and canvaskit-wasm cannot. Clarifies that these packages affect node_modules and install time but not shipped app size, which is a recurring source of confusion.

The podspec raises if `libs/macos` is missing, even when only iOS is being
built. tvOS already handles its own absence gracefully a few lines below, so
the two platforms behave inconsistently for the same condition.

This matters for iOS-only apps. The `react-native-skia-apple-*` binaries are
declared as hard `dependencies`, so every consumer downloads all of them. An
iOS-only app can never use the macOS or tvOS xcframeworks, but pruning them
with an override is blocked by the raise.

Make macOS mirror the existing tvOS handling: fall back to an empty
`vendored_frameworks` list when `libs/macos` is absent, and only hard-fail
when `libs/ios` is missing. The error still fires for the case it was written
for - a consumer who never ran `yarn install`, where `libs/ios` is also
absent. No behaviour change when the packages are present, since libs/macos
then exists and the original path is taken.

Also document the npm-side story, which was previously a single sentence:
which prebuilt packages exist, which can be pruned and how, and why
react-native-skia-apple-ios, react-native-skia-android and canvaskit-wasm
cannot. Clarifies that these packages affect node_modules and install time
but not shipped app size, which is a recurring source of confusion.
Spencer-Yoder and others added 2 commits August 14, 2026 10:15
Empty commit to re-trigger the workflow jobs.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@wcandillon
wcandillon self-requested a review August 18, 2026 10:13

@wcandillon wcandillon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank You for this.
I like the podspec change, can we do the same of tv os?
The idea would be that macOS and tvOS would be optional dependencies? I would be open to the idea.
If we use this approach the documentation change would be quite different.

@Spencer-Yoder

Copy link
Copy Markdown
Author

Thank You for this. I like the podspec change, can we do the same of tv os? The idea would be that macOS and tvOS would be optional dependencies? I would be open to the idea. If we use this approach the documentation change would be quite different.

Hey @wcandillon! Thanks for looking at the PR

tvos already has the podspec skip setup for it, and that is more or less where I copied the mac OS one from.

I thought about using optional dependencies, but then it gets a little tricky if someone needs tv/mac OS and still wants to also use omit=optional (or any variation or it), their build would fail. Unless there is something I am missing.

@ForestSpark

Copy link
Copy Markdown

The --omit=optional flag does not have to drive this. Mark the three apple packages as optional and give each one "os": ["darwin"]. npm and Yarn both skip an optional package when its os does not match the host, and Xcode runs only on macOS.

I tested it on npm 10.9.4 and Yarn 4.18.0, including the case where the packages sit one level down. With the esbuild package at 0.25.0, both managers install one of its 25 platform packages and skip the rest. Yarn does not download them at all. Linux installs would drop 510 MB of the 712 MB. On a Mac you still get everything.

It does nothing for the android package, since Gradle runs on Linux too, and it needs the podspec change in this PR. Happy to do that PR on top of this one.

@wcandillon

Copy link
Copy Markdown
Contributor

@ForestSpark I think I like this direction, I would be open to a PR for this. It might not help @Spencer-Yoder here as maybe we want to avoid tvOS and macOS even on a mac setup? Let me know.

@Spencer-Yoder

Copy link
Copy Markdown
Author

@ForestSpark that is a good idea and that would help a lot, especially on most CI runners. I still think having the ability to skip it on mac's would beneficial for poor internet or metered connections.

Feel free to build on my PR, or if you want I can included it here.

@ForestSpark

Copy link
Copy Markdown

Opened #4042 for the optional dependencies, stacked on this PR. The os field is in wcandillon/react-native-skia-binaries#8.

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.

3 participants