一般在Mac上配置環境變量時經常要創建、編輯 .bash_profile文件。
創建該文件時一般都會選擇在當前用戶目錄下,即Mac下的.bash_profile 文件的路徑是 /Users/YourMacName/.bash_profile
1、創建 .bash_profile
(1) 啓動終端
(2) 進入當前用戶的home目錄(默認就是):
cd ~ 或 cd /Users/YourMacUserName
(3)輸入touch .bash_profile
2、查看 、編輯 .bash_profile 文件
(1)終端輸入 open -e .bash_profile
(如果只是查看,直接使用open .bash_profile)
(2)編輯
(3)關閉即可保存修改
3、更新剛配置的環境變量
輸入source .bash_profile
深入瞭解:
https://blog.csdn.net/huxinguang_ios/article/details/78709428
https://www.cnblogs.com/kevingrace/p/8072860.html