Hendrik Wiese
Hendrik Wiese

Reputation: 2219

Add path before asdf (particularly pipx, respectively ~/.local/bin)

I'm using asdf-vm on my MacBook in an oh-my-zsh environment. It works pretty well, except for one thing.

I have a bunch of python based tools which I don't want to be managed by asdf. They are installed via pipx which provides its own virtual environments for the tools. One example is powerline-status.

I repeatedly get into trouble when asdf adds itself at the very beginning of the PATH variable. It stubbornly tries to manage everything and I keep getting errors that the tools I want to manage through pipx are not installed in the respective asdf environment. Of course I can install them, but it's an annoyance since I have quite a lot of asdf environments (repositories with .tool-versions).

The solution would simply be to add ~/.local/bin (or other paths) at the beginning of the PATH variable, before asdf.

However, wherever I add the ~/.local/bin to the path (.zshprofile, .zshrc...), asdf somehow always slips past and pushes itself to the very beginning of the PATH.

So where do I have to add my path to the environment variable in order for it to work as I desire?

Upvotes: 0

Views: 359

Answers (1)

Stratus3D
Stratus3D

Reputation: 4906

The solution to this should be to do the following (assuming you installed asdf via Git):

# Source asdf (this is where asdf adds itself to your $PATH
. "$HOME/.asdf/asdf.sh"

# Manually change the path after sourcing asdf, as asdf shouldn't mess with your $PATH again
PATH="$HOME/.local/bin:$PATH"

If this doesn't work let me know. Another solution to this would be to configure vim to fallback to system version for Python - https://asdf-vm.com/manage/versions.html#fallback-to-system-version

Upvotes: 0

Related Questions