git-cola icon indicating copy to clipboard operation
git-cola copied to clipboard

Built macOS app is not self-contained

Open Feuermurmel opened this issue 5 years ago • 1 comments

I was trying to get git-cola running on my mac by following the build instructions in a VM and copying the result to my development machine. It seems that Python, and probably other dependencies, are not bundled with the .app produced by the build process. Trying to run the binary results in this error:

$ git-cola.app/Contents/MacOS/git-cola 
/Users/michi/Downloads/git-cola.app/Contents/MacOS/git-cola: /Users/michi/Downloads/git-cola.app/Contents/Resources/bin/git-cola: /usr/local/opt/python/bin/python3.7: bad interpreter: No such file or directory
/Users/michi/Downloads/git-cola.app/Contents/MacOS/git-cola: line 10: /Users/michi/Downloads/git-cola.app/Contents/Resources/bin/git-cola: Undefined error: 0

I know that this is not a simple issue to solve but it would help make distributing the application simpler. I was planning on introducing a friend I will teach some Git basics today to git-cola as the only Git interface besides the command line. To make this as friction-less as possible, I would have provided them with a pre-built binary.

Feuermurmel avatar Apr 22 '20 07:04 Feuermurmel

yeah this is a tough problem. We usually point folks towards homebrew since it's an all-in-one solution.

make git-cola.app doesn't produce fully self-contained .app bundles.

If you build it w/out using homebrew's python then it may be relocatable to another machine (since it'll use the system python3 installation) as long as it's roughly the same macOS version.

I recently updated the Makefile target so that things are slightly more self-contained. We now install our own virtualenv into the .app bundle, and all of the PyQt5 dependencies are in the bundle.

That means that you don't need to have homebrew's python modules available in order to generate it anymore -- we handle that now during make git-cola.app.

The only thing that escapes the app bundle is Python. Making python relocatable is an interesting science project, but it's too much effort to maintain something like that which is why I haven't really sunk too much time into it.

This project shows some of the challenges in doing that:

https://github.com/gregneagle/relocatable-python

In theory it's possible to use something like relocatable-python to create your own standalone python and then tweak things to build using the relocatable python. There's a lot of details in how that's done so the stuff in this repo is deliberately simple and not trying to solve those problems.

I hope that helps.

davvid avatar Apr 02 '22 10:04 davvid