add to the PATH on MAC

Here are some way to add to the path.

Why i do this?

In the process of testing mitmproxy, I installed mitmproxy. After the mitmproxy installer finished, it recommendedThe scripts mitmdump, mitmproxy, mitmweb, pathoc and pathod are installed in '/Users/dc/Library/Python/3.7/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.. It turns out there is avery neat way to do this in OSX, the /etc/paths file. The file contains a list of paths that are added to the $PATH variable in the shell. Here are some way to add to the path:

  • Open up Terminal.
  • Run the following command:
    sudo nano /etc/paths
    
  • Enter your password, when prompted.
  • Enter the path you want to add on the bottom of the file.
  • Hit control-x to quit
  • Enter Y to save the modified buffer.
  • Then, open new terminal window, type:
    echo $PATH
    
  • You should see something similar to this(including the path you’ve added!):
    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/dc/Library/Python/3.7/bin:/usr/local/go/bin:/Applications/Wireshark.app/Contents/MacOS
    
Zerlz wechat
扫码关注一个很懒的程序员!
Winter is coming, give me a penny!