Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Programs installed via Nix are shadowed by preinstalled MacOS programs #337

Closed
robbins opened this issue Jun 28, 2021 · 4 comments
Closed

Comments

@robbins
Copy link

robbins commented Jun 28, 2021

MacOS preinstalls Git in /usr/bin/git (which is really just a command to install Xcode dev tools). Anyways, when I install Git via Nix-Darwin, I'm unable to run it as it always defaults to the preinstalled one.

Checking out $PATH: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/zfs/bin:/Users/nate/.nix-profile/bin:/run/current-system/sw/bin:/nix/var/nix/profiles/default/bin I see that /usr/bin has precedence over my nix profile.

What's the "Nix way" to move that to the front of $PATH? I guess I could add it to zshrc but I'm not sure if that's the proper solution.

This doesn't happen with programs installed via nix-env, not sure why.

@hauleth
Copy link
Contributor

hauleth commented Jul 9, 2021

It also happen when I install coreutils via Nix, which is quite irritating that in some shells I have access to Nix installed coreutils (when using Direnv) and sometimes I do not (when in "top-level" shell).

@robbins
Copy link
Author

robbins commented Jul 9, 2021

Well, I'm not sure what I did wrong initially but I ended up just reinstalling macOS + Nix + Nix-Darwin and the proper paths are at the start now. Maybe there was some issue in Nix-Darwins ability to edit the /etc/zshrc or other related files, I'm not sure.

But I don't have the issue anymore, although it seems like there might be others with the problem? (I didn't use direnv, though, so maybe it's a different issue). Should I leave this open or close it?

@robbins
Copy link
Author

robbins commented Aug 30, 2021

Should be fixed by NixOS/nix#5179

@robbins robbins closed this as completed Aug 30, 2021
@arichtman
Copy link

I've just encountered this issue - is there any suggestions on how to fix it? It looks like nixpkgs source code hasn't regressed...

nix files

arichtman@macbookpro ~ % nix --version
nix (Nix) 2.13.2
arichtman@macbookpro ~ % uname -a 
Darwin macbookpro 21.6.0 Darwin Kernel Version 21.6.0: Mon Dec 19 20:44:01 PST 2022; root:xnu-8020.240.18~2/RELEASE_X86_64 x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants