How to add a directory to your... Note
Julia Evans

How to add a directory to your PATH

To add a directory to your PATH, you first need to determine which shell you are using, which can be done by running the command ps -p $$ -o pid,comm=. The default shell on Linux is bash, while on Mac OS it is zsh. Next, you need to find your shell's config file, which is usually ~/.zshrc for zsh, ~/.bashrc for bash, and ~/.config/fish/config.fish for fish. However, bash's config file can be one of three options: ~/.bashrc, ~/.bash_profile, or ~/.profile, and you may need to test which one is being used.After finding your shell's config file, you need to figure out which directory to add to your PATH. This can be done by checking the installation instructions for the program you are trying to run, or by using a command specific to the installer, such as npm config get prefix for Node/npm.Once you have found the correct directory, you should double-check that it is correct by trying to run the program from that directory. Then, you need to edit your shell config file to add the directory to your PATH. The syntax for this varies depending on the shell, with bash and zsh using export PATH=$PATH:~/directory, and fish using set PATH $PATH ~/directory.Finally, you need to restart your shell for the changes to take effect. If the program still doesn't work, you may need to add the directory to the beginning of your PATH instead of the end, or you may need to add the directory to your PATH in a different way if you are running the program from an IDE or cron job.Additionally, some installers may provide a script to automatically set up your PATH, which can be run by adding a line to your shell config file. However, you may prefer to manually add the directory to your PATH instead.