Setting the CDPATH environment variable saves you having to cd to commonly-used parent directories. I usually put my main workspace directory in there to allow direct directory changes to project dirs, as well as ‘..’ to allow jumping to sibling directories.
Having recently switched from Ubuntu (again), where console niceties are the default, I was frustrated to find that bash didn’t complete my CDPATH entries. However, it’s easily fixed with Homebrew:
brew install bash-completion
This works: new bash shells will complete CDPATH. However, it slows shell load time down considerably. This problem is fixed in the latest bash-completion script, but it’s only compatible with Bash 4. OSX ships with version 3. Let’s upgrade it:
brew unlink bash-completion brew install bash sudo -i echo "/usr/local/bin/bash" >> /etc/shells exit brew install bash-completion chsh -s /usr/local/bin/bash
Now new shells will have CDPATH completion, and will start up in a reasonable time. Plus, you have the latest Bash. If you need to back this out, check out the comments on the accepted answer to a question that helped me arrive at this solution.
About the AuthorMore Content by Andrew Bruce