'PyInstaller on Mac: Can run through terminal, can't run by double clicking
This is driving me crazy. I have an app I built for work that works fine on Windows and Linux, but MacOS is giving me some grief. I'll be honest, Mac is my least known of the three OS's so maybe I'm doing something wrong.
After fighting with various PyInstaller settings, I finally was able to get something kind of working with --onefile. It makes an exec file that I can open through the terminal just fine, but double clicking the same file just closes it after a second. As far as I understand, the system path when launching through Finder is at /, so I guess my question is, can I just make a script that sets the current system path to where the script is and then launch it from there? I tried making a .sh and .bash file with just ./app in it, but that isn't working. I do rely on a few external files that need to be in the same directory as the executable which I've put into my Python script, but that doesn't seem to help much (unless again, I go through the terminal instead)
Any ideas?
Solution 1:[1]
Please disregard. I was able to figure out how to make a bash script that sets the directory to the current running and then runs the script. Seems to work and I'll take that as the answer
Bash script in question:
#!/usr/bin/env bash
cd "${0%/*}"
./main
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | user3005542 |
