You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cross-compiling from Linux to macOS produces non-functional binaries #183
What Node versions, OSs and CPU architectures are you building for?
linux-x64,win-x64,macos-arm64
Describe the Bug
When I build a macOS binary on Ubuntu using pkg, the build succeeds without any errors.
However, the resulting executable doesn’t run the packaged app — instead, it starts a plain Node.js process.
I checked #87 and #181, but couldn’t determine whether they are related.
Expected Behavior
The packaged application should start normally, as it does when built natively on macOS.
To Reproduce
# Step 1. Build executables for macOS on a Linux x64 machineecho'console.log("Hello, World!");'> index.js
npx @yao-pkg/pkg@6.9.0 --sea index.js -t macos-x64,macos-arm64
# => executables are generated (index-arm64, index-x64)# Step 2. Copy executables (index-arm64, index-x64) to a macOS machine# Step 3. Run executables on a macOS machine (I checked on Apple M1)
./index-arm64
# => Node.js REPL starts# Welcome to Node.js v22.20.0.# Type ".help" for more information.# ># Error: Could not open history file.# REPL session history will not be persisted.# >
./index-x64
# => Node.js REPL starts# Welcome to Node.js v22.20.0.# Type ".help" for more information.# ># Error: Could not open history file.# REPL session history will not be persisted.# >
changed the title [-]Cross-compilation from Linux to macOS seems broken[/-][+]Cross-compiling from Linux to macOS produces non-functional binaries[/+]on Oct 17, 2025
Sorry I missed the part where you mentioned you are using --sea. The issues you have mentioned here are related to the original pkg way, sea uses a completely different way to pack binaries.
I'm following steps described in https://nodejs.org/api/single-executable-applications.html to produce binaries, could you try to manually do them and tell me if it works in that way? I'm super busy in this weeks and I'm not sure when I can look at this
Activity
[-]Cross-compilation from Linux to macOS seems broken[/-][+]Cross-compiling from Linux to macOS produces non-functional binaries[/+]robertsLando commentedon Oct 17, 2025
Tried with --public?
tasshi-me commentedon Oct 18, 2025
@robertsLando
Thanks for the quick response! I tried adding
--public, but the behavior didn’t change.The
--publicoption seems to have no effect when SEA is enabled.It's passed to the
Makerinwalker.ts, but theMakerisn't called insea.ts.robertsLando commentedon Oct 20, 2025
Sorry I missed the part where you mentioned you are using
--sea. The issues you have mentioned here are related to the original pkg way, sea uses a completely different way to pack binaries.I'm following steps described in https://nodejs.org/api/single-executable-applications.html to produce binaries, could you try to manually do them and tell me if it works in that way? I'm super busy in this weeks and I'm not sure when I can look at this