Skip to content
Snippets Groups Projects
Unverified Commit d666d40f authored by Sean Madsen's avatar Sean Madsen Committed by GitHub
Browse files

Merge pull request #447 from ginkgomzd/patch-5

best practices for seting PATH
parents 5e4ec72e eeb86a4f
No related branches found
No related tags found
No related merge requests found
......@@ -78,11 +78,26 @@ You may execute the commands directly (e.g. `./bin/civix` or `/path/to/buildkit
If you want to ensure that the buildkit CLI tools are always available, then:
1. Determine the location of your shell configuration file. This is usually `~/.bashrc`, `~/.bash_profile`, or `~/.profile`.
1. At the end of the file, add `export PATH="/path/to/buildkit/bin:$PATH"`.
1. Close and reopen the terminal.
1. Determine the location of your shell configuration file. This is usually `~/.bash_profile`, or `~/.profile`. You may have to create one.
1. At the end of the file, add `PATH="/path/to/buildkit/bin:$PATH"`.
1. If you are on a mac, you can close and re-open your terminal. On other systems, you will need to log-out or source your `~/.profile`
1. Enter the command `civibuild -h`. This should display a help screen for civibuild. If you get 'command not found', then check your path and retry the steps above.
!!! note "More on bash `$PATH`"
On most OS's `~/.profile` is run only once when you login to your desktop. There is a distinction between "login shells" and "non-login shells" which you don't really need to worry about, except that the distinction is the reason that you should set your `$PATH` in your `~/.profile` and not your `~/.bashrc`.
When you open a terminal (non-login), `~/.bashrc` will be executed. The common idiom for changing the path is to add to the `$PATH`, not rebuild it, so if you update your `$PATH` every time a shell is invoked, your `$PATH` will continually grow. This is not really a problem, but you might want to be aware of this.
If you are on a mac, the situation is reversed. That is, your `$PATH` is not set when you login into your desktop and every terminal you open is a "login shell" and `~/.profile` will be executed every time.
You do not need to run `export PATH=...` because your system certainly has already exported the `$PATH` variable and you only need to update it.
References:
* <https://unix.stackexchange.com/a/26059>
* <https://superuser.com/questions/244964/mac-os-x-bashrc-not-working#244990>
* <https://askubuntu.com/questions/155865/what-are-login-and-non-login-shells#156038>
!!! note
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment