

Read more about invisible and hidden files here. You need to use ls -a to see if they are present. ~/.bash_profile or ~/.bashrc.īoth these files are on the first level of your home directory ~/. There are (mainly) two user level files which bash may run when a bash shell starts. Thanks to the rich and long history of bash the answer to which file you should put your configuration in, is surprisingly confusing. Other shells and other operating systems may have other files or rules. This article will talk about customizing bash on macOS. shell), or you can configure your shell to do this automatically.ĭepending on which shell you use and how you start the shell, then certain script files will be executed which allow you to set up these customizations. You could type this command every time you open a new Terminal window (i.e. In bash you append to existing PATH do this with: export PATH="$PATH:~/bin"

#Mac high sierra set environment variable for all apps full
I like to add a folder in my home directory ~/bin to that list, so that I can execute certain tools without needing to type out the full path. This is a list of directories (separated by a colon ‘ :’) that the system searches through in order for commands. This can mean changing environment variables, such as where the shell looks for commands or how the prompt looks, or adding customized commands.įor example, macOS sets the PATH environment variable to /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin by default. When you work with the command line and the bash shell frequently, you will want to customize the environment. Obviously, you may wonder: how do I do that? And which file should I use? Why? In this spontaneous series on the macOS Terminal I have often mentioned adding something as an alias or function to your bash_profile or bashrc. You can learn more about using Terminal and the shell on macOS in my my book: “ macOS Terminal and Shell” - Thank you! Learn more about Configuration Profiles in my book: ‘Property Lists, Preferences and Profiles for Apple Administrators’ Note: bash_profile is completely different from configuration profiles.
