Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OSX - ZSH - PATH - /usr/bin duplicated

Tags:

path

macos

zsh

I need some help to understand why my path looks like the way it looks.

Issuing echo $PATH in zsh returns :

/Library/Frameworks/Python.framework/Versions/3.2/bin:/usr/bin/:/bin:/usr/sbin:/sbin:
/usr/local/bin:/usr/X11/bin:/usr/local/go/bin:/usr/bin

Now, let's have a closer look of the different parts :

- /Library/Frameworks/Python.framework/Versions/3.2/bin:

it comes from my .zprofile (Python 3 installation)

- /usr/bin/: 
- /bin: 
- /usr/sbin:
- /sbin:
- /usr/local/bin:

These parts come from my /etc/paths folder.

- /usr/X11/bin:

This part come from my etc/path.d folder

- /usr/local/go/bin:

This part was added during GO installation.

- /usr/bin

???

I have looked at -/etc/paths -.zshrc -.zprofile -.profile -/etc/profile -.zshenv. None of them sourced or added a second /user/bin neither to the PATH.

How can I remove the second /user/bin from my PATH if I don't know which file to edit?

Thank you.

like image 631
politicus Avatar asked Jul 24 '12 16:07

politicus


1 Answers

In ZSH, removing duplicates in the PATH variable is done via typeset -U PATH and not typeset -u PATH(the latter would just convert the content to uppercase..)

like image 76
Clemens Avatar answered Oct 02 '22 03:10

Clemens