contour
contour copied to clipboard
Package an optionally installed Shell script that adds `.../contour.app/...` to `/etc/paths.d`
Abstract
The package layout and installation logic on Mac is... unconventional, to say the least. It is common, however, that someone would want to spawn a separate contour process (if, for nothing else, contour debug ...; but I also regularly start contour profile white for screenshotting into presentations — so the "Start new Window" keybind action is not satisfactory), but on Mac, it always gives command not found.
Specification
In an installer .dmg it is possible to package a .pkg file which runs custom installation actions (e.g., Citrix is installed this way, but so is Google Drive IIRC).
If doing a full-on .pkg is infeasible, we should package a script which, when double-clicked and sudo-authenticated by the user, optionally (i.e., not in part of the "copying" of contour.app to /Applications) installs a shell script under /etc/paths.d:
$ cat /etc/paths.d/contour-terminal
/Applications/contour.app/Contents/MacOS
This way, /usr/libexec/path_helper will return contour's installation path as well, and if this is appropriately sourced into the spawned shell profile, contour becomes an executable command as-is.
@whisperity great idea. I admit I'm having a macOS (as you know), but I've never mastered using one in terms of being a power user, and thus, I simply did not know about it. Thanks for looking into it. :)
I however wonder how to do that in the context of CMake's CPack. 🤔
@christianparpart I'm also incrementally evolving here (https://github.com/whisperity/dotfiles/commit/3c7501dcc715ce669294cff2aa47ef7c67faa02e). I think as long as we can package a shell script that can do echo "/Applications/contour.app/Contents/MacOS" > "/etc/paths.d/contour-terminal" while also requiring sudo (usually these programs pop mac's own "Please authenticate" modal dialog!) that should be fine. It just needs an icon in the .dmg view such that the user is presented with the option to click it. 😉
p.s.: Maybe we should find a better way that would avoid requiring to touch /etc/paths.d/ during installation or shell-spawn.
Ideally the PATH env var should contain the search path to the contour executable already. 🤔 ...
That is what the path_helper is for. Both Brew and Podman-Desktop uses the same "trick" to add entries into the PATH.