Can I build a .app in such a way that I can later edit some information in it without Mac quarantining it? #8885
-
I am trying to build an app that runs cognitive tasks. I'm building the .app file with PyInstaller 6.9.0 on an Intel Mac running Sonoma (14.7). Participants will be downloading the task from a website after completing a survey, and I want to embed a unique participant id into each .app before packaging it in a dmg for download so that the results of the task can be linked to the results of the survey and participants don't have to enter a code manually (which can be error prone). I'm accomplishing this by building the app with a WorkerID field in the plist of the same length as the worker ids generated by the website. When I try downloading and running a .app file that I've modified with pefile, I get a message saying:
When I check the xattrs of the .dmg, sure enough, it's got a quarantine tag:
I'm running the webpage from the Python 3.12 Docker image and using pefile 2024.8.26. Is there a different way to set up the .app so that I can embed a unique ID in each app before I package it in a .dmg for download? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
If you modify .app bundle, you will need to re-sign it using the See pyinstaller/PyInstaller/building/osx.py Lines 661 to 671 in a2a6d1e and pyinstaller/PyInstaller/utils/osx.py Lines 370 to 391 in a2a6d1e (you should probably be looking at ad-hoc signing codepath, i.e., without identitity). |
Beta Was this translation helpful? Give feedback.
-
In case anyone else stumbles on this, I was able to find a solution for signing mac apps on linux, the apple codesign tool from the zombie project pyoxidizer. I was initially hesitant because it's a zombie and I've never used Rust, but it was easy to install in the docker image: RUN curl https://sh.rustup.rs -sSf > install_rust.sh && \
bash install_rust.sh -y && \
. "$HOME/.cargo/env" && \
cargo install --git https://github.com/indygreg/apple-platform-rs --branch main --bin rcodesign apple-codesign And easy to use (in my case, running it from a python function): sign_cmd = [
'/root/.cargo/bin/rcodesign',
'sign',
img_app_path
]
run(sign_cmd) |
Beta Was this translation helpful? Give feedback.
If you modify .app bundle, you will need to re-sign it using the
codesign
utility (this applies both to modifications of Info.plist and addition/removal of files in the bundle).See
pyinstaller/PyInstaller/building/osx.py
Lines 661 to 671 in a2a6d1e