Built-in method to get a list of installed symlinks?


(Timothy Sutton) #1

Hello,

I’m working on a way to build installer packages from formulae I’ve installed on a machine.

I see that I can get a list of what seems to be a complete set of installed files using brew ls --verbose <formula>, and that I can also use brew info --json=v1 <formula> to get additional metadata. Is there some way I could also pull an easily parseable list of symlinked files?

One potential hack seems to be that I could do:

brew unlink <formula>; brew link --dry-run <formula> and parse the output, but it starts getting trickier when directories are involved and it lists mkdir -p statements, etc. I could also just walk the prefix path myself and mark any symlinks which link to a path including /usr/local/Cellar, but I was wondering if there’s a way I could use brew’s built-in tools or a method or two within the Homebrew Ruby library to do this in a more robust way.

I also notice that this doesn’t list post_install items which might, for example, have been installed in /usr/local/var/<formula>, but those I can potentially deal with as a separate issue.

Any ideas would be very welcome!


(Mike McQuaid) #2

There’s no built-in way for doing this, sorry! I’d probably advice you to only use clean Homebrew installations (i.e. with nothing installed) and then install a package and perform a diff of all the new files.