I installed a package with homebrew (qt). I'd like to modify the source code and rebuild the package. I can't seem to find the source code, though. brew --cache
returns a directory that doesn't exist, and the code for qt isn't in /u开发者_StackOverflow中文版sr/local/Cellar. Am I missing something? Does homebrew remove the source code after the application is built?
Homebrew only keeps binaries. If your Homebrew cache directory (which is normally at /Library/Caches/Homebrew
, but can be found using brew --cache
, as you noted) has been moved or deleted, then you'll have to get the source code again. You can grab just the source code with brew fetch qt
.
If you get only the source package, it may be missing the patch included in the formula and not exactly the source of the binary you are currently running. To get the source tree with the patch applied, you may do:
brew unpack --patch <formula>
From the man page:
unpack [--git|--patch] [--destdir=path] formulae Unpack the source files for formulae into subdirectories of the current working directory. If --destdir=path is given, the sub- directories will be created in the directory named by <path> instead. If --patch is passed, patches for formulae will be applied to the unpacked source. If --git is passed, a Git repository will be initalized in the unpacked source. This is useful for creating patches for the software.
精彩评论