1. 程式人生 > >MAC下產生sudo:command not found

MAC下產生sudo:command not found

是因為環境變數設定錯誤

 1.在命令列中輸入:

  export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/X11R6/bin

 可以實現暫時的使用。

 2.輸入cd ~/ #進入當前使用者的home目錄

 3.建立bash_profile 執行命令:

  touch .bash_profile

 4.開啟並編輯bash_profile執行命令:

  open .bash_profile

 5.這樣就打開了一個筆記本,會顯示已經配置過的path,修改記事本,先全部刪除,有用的可以備份,命令列解決後再加

  export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"

  PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"

  export PATH=$Path:/usr/local/mysql/bin

 6.儲存,command + s

 7.在此命令列輸入更新命令

  source .bash_profile

 8.然後輸入 sudo spctl --master-disable

 

#轉自知乎Bleet