How to add /usr/local/bin in $PATH on Mac

前端 未结 6 1404
臣服心动
臣服心动 2020-12-07 08:39

When I do \'open .profile\' in the terminal I have the following:

export PATH=$PATH:/usr/local/git/bin 

Now I installed node.js for Mac and

相关标签:
6条回答
  • 2020-12-07 09:10

    I've had the same problem with you.

    cd to ../etc/ then use ls to make sure your "paths" file is in , vim paths, add "/usr/local/bin" at the end of the file.

    0 讨论(0)
  • 2020-12-07 09:11

    I tend to find this neat

    sudo mkdir -p /etc/paths.d   # was optional in my case
    echo /usr/local/git/bin  | sudo tee /etc/paths.d/mypath1
    
    0 讨论(0)
  • 2020-12-07 09:12

    Try placing $PATH at the end.

    export PATH=/usr/local/git/bin:/usr/local/bin:$PATH
    
    0 讨论(0)
  • 2020-12-07 09:13

    In MAC OS Catalina, this are the steps that worked for me, all the above solutions did help but didn't solve my problem.

    1. check node --version, still the old one in use.
    2. cd ~/
    3. atom .bash_profile
    4. Remove the $PATH pointing to old node version, in my case it was /usr/local/bin/node/@node8
    5. Add & save this to $PATH instead "export PATH=$PATH:/usr/local/git/bin:/usr/local/bin"
    6. Close all applications using node (terminal, simulator, browser expo etc)
    7. restart terminal and check node --version
    0 讨论(0)
  • 2020-12-07 09:21

    To make the edited value of path persists in the next sessions

    cd ~/
    touch .bash_profile
    open .bash_profile
    

    That will open the .bash_profile in editor, write inside the following after adding what you want to the path separating each value by column.

    export PATH=$PATH:/usr/local/git/bin:/usr/local/bin:
    

    Save, exit, restart your terminal and enjoy

    0 讨论(0)
  • 2020-12-07 09:28
    export PATH=$PATH:/usr/local/git/bin:/usr/local/bin
    

    One note: you don't need quotation marks here because it's on the right hand side of an assignment, but in general, and especially on Macs with their tradition of spacy pathnames, expansions like $PATH should be double-quoted as "$PATH".

    0 讨论(0)
提交回复
热议问题