2

I used the how to from https://docs.aws.amazon.com/cli/latest/userguide/cli-install-macos.html

to install AWS CLI on macOS. After executing command source ~/.bash_profile it seems that my default PATH location from file /private/etc/paths was lost.

/private/etc/paths file content:

/usr/bin/vim /private/etc/paths

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

~/.bash_profile file content:

# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH

For example next command cant find the location of basic files installed in /usr/bin/: -bash: vim: command not found

Is it a way to restore path to be reading from /private/etc/paths?

echo $PATH
/Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/<myusername>/bin:/Library/Python/3.6/bin/

Also I can't use the same command to reread from the location

source /private/etc/paths
-bash: /usr/local/bin: is a directory
-bash: /usr/bin: is a directory
-bash: /bin: is a directory
-bash: /usr/sbin: is a directory
-bash: /sbin: is a directory
  • 1
    There has to be a second export PATH ... somewhere which breaks your default path. Otherwise echo $PATH wouldn't show: ...:/Users/<myusername>/bin:/Library/Python/3.6/bin/! Please fix your ugly /private/etc/paths content: 1. remove empty lines 2. remove spaces and /private/etc/paths (/private/etc/paths is no directory)! – klanomath May 2 '18 at 12:34
  • 1
    Yep it seems that there was error somewhere in this file in previous steps. It seems like I forgot to attach :$PATH in the end. Is it a way to use default file location? Now I added all the default paths in .bash_profile and all works nice. Just want to be configured in correct and clear way – user2105282 May 2 '18 at 12:37
  • 1
    Adding the default paths to your bash profile is just duct-taping... – klanomath May 2 '18 at 14:46
2
  1. Fix your /private/etc/paths content:

    The default content is:

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

    If you want to include /usr/bin/vim (but only if vim is a folder containing some executables - the macOS installed vim exec is /usr/bin/vim!) modify the content to:

    /usr/local/bin
    /usr/bin/vim
    /usr/bin
    /bin
    /usr/sbin
    /sbin
    
  2. You have another (superior) export PATH line somewhere (i.e. bash config files) with the following content:

    export PATH="/Users/<myusername>/bin:/Library/Python/3.6/bin/:*"
    

    with *= either completely missing or a falsely defined PATH variable (e.g. Path instead of PATH)

    At least it doesn't inherit the standard paths defined by /private/etc/paths

    This first PATH export and the second in your ~/.bash_profile then yield something broken like:

    /Library/Frameworks/Python.framework/Versions/3.6/bin:/Users/<myusername>/bin:/Library/Python/3.6/bin/ 
    

    as PATH

  • 1
    Are you sure about including /usr/bin/vim verbatim in /etc/paths? – nohillside May 2 '18 at 13:55
  • 1
    @patrix I assumed the OP added a folder vim or installed some 3rd party vim in /usr/bin/vim ;-). But I will add an explanation/exclusion; thx – klanomath May 2 '18 at 14:27
  • 1
    I think it's just bad formatting in the question and they used vim to open the file in the first line of the code block. – nohillside May 2 '18 at 15:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .