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

$PATH on OS X again #927

Closed
ahti opened this issue Jul 23, 2013 · 8 comments
Closed

$PATH on OS X again #927

ahti opened this issue Jul 23, 2013 · 8 comments
Milestone

Comments

@ahti
Copy link
Contributor

ahti commented Jul 23, 2013

So, fish does /etc/paths now, which is great. There is one thing that does not work that well though:

With system-bash, my path looks like this:

/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:
/opt/X11/bin:/usr/local/MacGPG2/bin:/usr/local/share/npm/bin:/usr/texbin

this is pretty much what i expected according to my /etc/paths and /etc/paths.d/*.

/usr/bin /bin /usr/sbin /sbin /usr/local/bin /usr/local/sbin
/opt/X11/bin /usr/local/MacGPG2/bin /usr/texbin /usr/local/share/npm/bin

The problem is, that fish does not reorder things that are in $PATH already when /usr/local/share/fish/config.fish is executed. I put a echo $PATH at the top of the file, and it seems that this:

/usr/bin /bin /usr/sbin /sbin

is the path fish inherits from launchd.

I think that, if a /etc/paths file is found, fish should throw away the old path, and rebuild it completely from the files.

This would also mean moving the reconstruction of fish_user_path after the Mac OS X bit.

It also seems fish orders the files in /etc/paths.d/ a bit differently than path_helper, but I don't think thats really an issue. The files I have in that directory are named as follows:

40-XQuartz
MacGPG2
TeX
npm 
@ahti
Copy link
Contributor Author

ahti commented Jul 23, 2013

Oh, I just saw the old issue is still open, too: #417

@ridiculousfish
Copy link
Member

bash does not actually throw away the PATH it inherits. Instead it just keeps accumulating more junk onto it.

ridiculousfish added a commit that referenced this issue Aug 25, 2013
to prepend it to $PATH instead of appending it (#950)
@ridiculousfish
Copy link
Member

We should not blow away $PATH entirely, but commit dead45f and 9f46881 should reorder the contents of $PATH so that stuff in /etc/paths comes earlier, which I think should address this. Thanks for reporting this.

@albertz
Copy link

albertz commented Jan 17, 2019

Is this intended behavior? I find it quite confusing. E.g. when I'm in another shell (bash, ZSH, or whatever), or even any other tool, where there is already $PATH defined (which I have like I want it, on purpose, by setting it e.g. in ~/.bash_profile, such that I e.g. have ~/.homebrew/bin and ~/.local/bin in the beginning of $PATH, which is what I want), and then I start fish, suddenly my $PATH is totally reordered (my own entries which I want to have at the front are not anymore there).

If this is intended behavior, could we have at least an option to disable this?

@faho
Copy link
Member

faho commented Jan 17, 2019

@albertz: #5456.

@albertz
Copy link

albertz commented Jan 17, 2019

@faho Thanks. But it doesn't answer my question: How to disable that? I don't want that Fish changes/reorders my $PATH (or maybe only add entries at the end).

@faho
Copy link
Member

faho commented Jan 17, 2019

You don't. It's something we probably should change. But we shouldn't change it by introducing some weird option, but by making the default better.

@albertz
Copy link

albertz commented Jan 17, 2019

Ah, yes, that would be even better. :) I was thinking that you actually want to keep that behavior, because you (or some other people) think this is the better behavior for some reason.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 17, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants