MAC下如何設定環境變數

來源:互聯網
上載者:User

1 首先查看PATH

  命令:$PATH  

2 如何設定PATH

  命令:echo "export PATH=xxxxxx:$PATH" >> ~/.bash_profile

  解釋:把"export PATH=xxxxxx:$PATH"輸出列印到~/.bash_profile中去。

3 Unix知識補充:~/.bash_profile介紹

  mac和linux終端一般用bash來進行解析。當bash在讀完了整體環境變數的/etc/profile並藉此調用其他設定檔後,接下來則是會讀取使用者自訂的個人設定檔。bash讀取的檔案總共有三種:

  ~/.bash_profile   ~/.bash_login    ~/.profile

  其實bash再啟動是唯讀上面檔案的一個,而讀取的順序則是依照上面的順序。也就是說讀到bash_profile就不讀後面的了,如果bash_profile不存在,後面的才能有機會。

  讓我們來看看bash_profile裡面有什麼內容:

  命令:cat ~/.bash_profile  

  圖中展示了其中的內容。

查看某些檔案夾需要root許可權所以用sudo去查看

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.