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

 

更新之前用的是bash終端,mac更新后用的是zsh,

open .zshrc

如果想要正常加載 .bashrc 文件時,就要找到用戶目錄下的 .zshrc 文件加入如下代碼:

if [ -f ~/.bashrc ]; then source ~/.bashrc fi


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM