I’m creating a custom tap and formula, but I’ve got a situation I don’t know how to handle.
At runtime, the software installed by this formula needs to know the complete path to an executable file that belongs to a dependency which was also installed by Homebrew.
So, for example, the path to the executable it needs might be
There are two ways provided to supply this path to the software:
- The path can be build into the executable during compilation. I certainly know how to do this with a patch… but only if the path is a fixed string I know before installation. It’s not fixed, though, because it involves
$(brew --prefix), which might differ from user to user.
- It can be written to a special configuration file in the users’ home directory that the software will look for. However, I don’t know if it’s possible (due to sandboxing) to write a file to the users’ home directory.
(If interested in specifics, I’m building GV, which needs to know the path to a keg-only version of ghostscript, also a custom tap, that was built with X11 support). Yes, it actually compiles this path into the
gv executable by default.
Thanks for any advice on how to do this!