From 3e41edd739d4e773a3644ec3a181138c85a14837 Mon Sep 17 00:00:00 2001 From: Michael Z Daryabeygi <daryabeygi@ginkgostreet.com> Date: Fri, 10 Nov 2017 12:03:55 -0500 Subject: [PATCH] best practices for seting PATH --- docs/tools/buildkit.md | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/tools/buildkit.md b/docs/tools/buildkit.md index e4bf4c9e..5cb58f5d 100644 --- a/docs/tools/buildkit.md +++ b/docs/tools/buildkit.md @@ -78,11 +78,27 @@ 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 `export PATH` because your system certainly has already exported the PATH variable and you only need to update it. + + In windows: someone help me out here, it's been awhile... + + 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 -- GitLab