Home > database >  XCode: Running a build script in -x86_64 while building for arm64 on macOS
XCode: Running a build script in -x86_64 while building for arm64 on macOS

Time:11-21

I am moving my app to arm64 on macOS12 Montery. While rebuilding its frameworks with arm64 worked fine so far i have some extend scripts in it that need to be compiled from JS to JSX before packing it to the app bundle. There's a Visual Studio Code plugin doing that for me (Extendscript debugger).

Therefore i have added a script phase with this script

node "$HOME/.vscode/extensions/adobe.extendscript-debug-1.1.2/public-scripts/exportToJSX.js" -f -n "$PROJECT_DIR/indesignagent/Javascript"

It works fine on -x86_64 but fails on arm64 because the plugin itself isn't optimized yet for arm64 and XCode seems to execute it with /bin/sh on arm64 arch

I found a manual solution i currently work with, but its just not as satisfying as an automated process: I open the terminal with rosetta mode and call the above command and it works through, then i build my app without that script phase.

I'd like to know: Is there any way to execute a script phase/bash script with -x86_64.

I already tried solutions mentioned here in the script phase: enter image description here

Any help appreciated

CodePudding user response:

I solved it. Node was installed with brew. Beginning with macOS Monterey its installed in /opt/ folder which runs only on arch arm64. So i manually installed an older Version of node (< 14) in usr/local/bin which runs -x86_64. The last thing to do was to tell the script where to look for node and it works. I can build an app for arm64 while in the build process calling x86_64 scripts (as long as they aren't updated for arm.

  • Related