Editing
How to setup my system path
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Mac 如何設定系統 PATH == 新增程式目錄 {{kbd | key=<nowiki>~/path/to/scripts</nowiki>}} 到 PATH 1. 打開編輯器編輯 {{kbd | key=<nowiki>~/.zshrc </nowiki>}} 使用 {{kbd | key=<nowiki>echo $SHELL</nowiki>}} 得到結果 {{kbd | key=<nowiki>/bin/zsh</nowiki>}}。代表使用 [https://zh.wikipedia.org/zh-tw/Z_shell Zsh] 作為預設的 shell,會預設載入 {{kbd | key=<nowiki>~/.zshrc </nowiki>}} 設定檔 <ref>[https://tommcfarlin.com/shells-in-macos/ A Quick Guide to Shells in macOS | Tom McFarlin]</ref><ref>[https://support.apple.com/zh-tw/guide/terminal/trml113/mac 在 Mac 上的「終端機」中更改預設 Shell - Apple 支援 (台灣)]</ref>。 2. 新增下面一行 <pre> export PATH="$HOME/path/to/scripts:$PATH" </pre> 3. 重新啟動終端機,或者直接輸入指令,立即套用更改而不重新啟動終端機或登出,動態更新當前 shell 環境的設定。 <pre> source ~/.zshrc </pre> 4. 驗證有無加入 PATH <pre> echo $PATH </pre> 其他 shell 設定檔: <pre> cat ~/.bash_profile cat ~/.bashrc cat ~/.profile </pre>
Summary:
Please note that all contributions to LemonWiki共筆 are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see
LemonWiki:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Current events
Recent changes
Random page
Help
Categories
Tools
What links here
Related changes
Special pages
Page information