8

I've recently moved over to asdf to manage runtimes (specifically Node, Ruby and Python). However, I've got a lot of packages installed via Homebrew that depend on a version of one of these runtimes that was installed by Homebrew itself. I'd like to delete these and only manage runtimes via asdf.

How can I point Homebrew to use the runtimes managed by asdf?

Flux
  • 9,805
  • 5
  • 46
  • 92
zeitchef
  • 204
  • 2
  • 8
  • Same question. I've already tried placing `~/.asdf/shims` first in the PATH, but Homebrew still reinstalls & compiles Ruby, Rust & Co. into `/usr/local/Cellar` despite `~/.asdf/installs` already having the exact same versions of it. – Katrin Leinweber Dec 13 '22 at 13:50

1 Answers1

0

The short answer to this is NO.

The long answer is things are complicated, and while nothing prevents Brew from using asdf-installed versions, it's not likely to work in practice. Let me elaborate.

Brew

Brew is a package manager for MacOS (though now supports other OSes). Brew is installed system wide, and you have to use sudo to install it. It. only depends on the underlying operating system, and packages you install using it only depend on the OS or other Brew packages. Brew wasn't designed to manage multiple versions of the same package, but it does have limited support for it today.

For each package there is a Brew "formula" defined for it that specifies how the package should be compiled/installed. The formula also specifies any dependencies the package has, and Brew recursively installs packages until everything required by the package you requested is installed. For example, if you run brew install vim, Brew will likely install other Brew packages like ruby and python as they are listed as dependencies in the vim formula.

asdf

asdf is a version manager that is typically installed at the user level. Often in $HOME/.asdf. It was specifically designed for juggling multiple versions of the same package at the user level. It relies on the OS or other OS package managers for plugin dependencies, but plugins can rely on other plugins as well.

Problems

Given these differences between asdf and Brew, there are several issues that prevent Brew packages from relying on asdf plugins:

  • Brew is installed globally at the system level. Packages installed by it should not rely on things installed at the user level (such as those installed by asdf). You could work around this by installing asdf as a system level thing. I don't know that anyone has ever done this.
  • Brew is mostly self contained, and Brew packages are designed to only rely on other Brew packages or things provided by the OS. Regardless of what is on your $PATH Brew will install any other Brew packages listed as dependencies by the package you are installing.
Stratus3D
  • 4,648
  • 4
  • 35
  • 67