Many time this happens. As i install a package from apt it require dependency and try to install that dependency. But this package is previously installed by brew. How to restrict that and tell my apt, that the package is installed and don’t waste my time cpu and memory.
I think that’s a question for the apt forums, but generally mixing package managers is a recipe for disaster.
You REALLY shouldn’t do this, and you usually can’t.
Binary package management systems (like
apt and bottle-enabled Homebrew) are intended to be internally consistent (i.e. binaries, libraries and support files in perfect harmony), so installing a package but not some/all of its dependencies is an error state. Even if you could trick either side into allowing this, using one side’s binaries with the other side’s libraries of a different version than expected may lead to “launch failure” at best, or Heisenbugs in the worst case.
If having separately-versioned copies of the same package is absolutely unacceptable, then use
apt as the “primary reference” and download/build/install individual source tarballs of the other stuff. I personally use graft to maintain a versioned hierarchy of such manually-compiled packages, in a structure very similar to Homebrew’s Cellar concept. This way, the base dependency versioning (i.e. the system one) is stable, and if an upgrade breaks some source-built stuff, I just rebuild against the new libraries and carry on with life.