zigup icon indicating copy to clipboard operation
zigup copied to clipboard

Error: higher priority in PATH than the path-link

Open warpdesign opened this issue 10 months ago • 8 comments

When running zigup 0.14.0-dev.2577+271452d22I get the following output:

error: zig compiler '/opt/homebrew/bin/zig' is higher priority in PATH than the path-link '/opt/homebrew/Cellar/zigup/2025.01.02/bin/zig' error: the path link '/opt/homebrew/Cellar/zigup/2025.01.02/bin/zig' is not in PATH

I'm not sure what I'm supposed to do: I have installed the latest stable version (0.13.0) using homebrew.

warpdesign avatar Jan 30 '25 10:01 warpdesign

brew uninstall zig?

P.S. maybe we could hardcode something in zigup that checks if the conflict comes from brew and give the user this suggestion as a possible solution

marler8997 avatar Jan 30 '25 13:01 marler8997

I uninstalled zig in brew, but now I get this error:

install directory '/Users/nicolas/zig' mkdir '/Users/nicolas/zig' compiler '/Users/nicolas/zig/0.14.0-dev.2577+271452d22' already installed symlink '/opt/homebrew/Cellar/zigup/2025.01.02/bin/zig' already points to '/Users/nicolas/zig/0.14.0-dev.2577+271452d22/files/zig' error: the path link '/opt/homebrew/Cellar/zigup/2025.01.02/bin/zig' is not in PATH

warpdesign avatar Feb 03 '25 08:02 warpdesign

same issue: I did zipup master --path-link /opt/homebrew/bin/zig and that works, but I feel like that's what zigup should be doing? (I also think I put it into a weird state by having stable zig brew installed before running zigup

blacktop avatar Feb 05 '25 05:02 blacktop

the way zigup works is it assumes zigup is in your path and infers that's the same place it should put the zig path-link. Is zigup not in your PATH?

marler8997 avatar Feb 05 '25 05:02 marler8997

did someone else create the zigup homebrew formula?

it is at /opt/homebrew/Cellar/zigup/2025.01.02/bin/zigup which gets symlinked to /opt/homebrew/bin/zigup (by brew install)

When you run zigup master it will create the symlink here:

/opt/homebrew/Cellar/zigup/2025.01.02/bin/zig which is NOT in the PATH, but it's (zigup) symlink is.

blacktop avatar Feb 05 '25 05:02 blacktop

I definitely installed zigup via homebrew.

warpdesign avatar Feb 05 '25 09:02 warpdesign

It appears that the zigup binary gets installed by homebrew to /opt/homebrew/Cellar/zigup/2025.01.02/bin and symlinked from /opt/homebrew/bin/zigup. My guess is that binaries appearing in /opt/homebrew/bin get searched automatically when the user enters a command (installing zigup doesn't update the PATH env variable).

After running zigup, I have a symlink in /opt/homebrew/Cellar/zigup/2025.01.02/bin, zig -> /Users/iain/zig/0.14.0-dev.3187+d4c85079c/files/zig pointing to the the latest downloaded zig binary, but zigup complains about the PATH when it finishes running.

As @blacktop suggested, by setting the path-link to /opt/homebrew/bin/zig you end up with a symlink to the downloaded binary there which resolves the problem. I assume, if the symlink in /opt/homebrew/bin pointed to /opt/homebrew/Cellar ... (the same way it does for zigup) that would fix the issue too. Also, you could get the user to update the PATH variable, but that's not my preferred solution.

Hope this helps.

blogscot avatar Feb 11 '25 10:02 blogscot

For a convenience workaround for this until it's fixed, you can add this line to your .zshrc:

alias zigup="zigup --path-link /opt/homebrew/bin/zig"

Does not interfere with any zigup command, even ones that don't use the flag thankfully.

jhmaster2000 avatar Mar 18 '25 19:03 jhmaster2000