What is a .bash_profile and Why Should I Care?
Hidden inside your Mac’s user directory is a file called .bash_profile. Your .bash_profile contains all the configurations and preferences for your command line and assigns it a user specific environment. First off, why would you want to edit your terminal profile? If you’re a heavy terminal user, you may find it useful to customize certain text colors, change command line prompts, edit your $PATH directory and add aliases to certain commonly used functions.
Editing your .bash_profile
- Open your Terminal app
cd ~/to navigate to your home folder.
touch .bash\_profileto create your dot file if you don’t have one already.
- You can edit .bash_profile in TextEdit by typing
open -e .bash\_profileor if you use Sublime Text, you can open the file using the super handy Sublime Text OSX Command Line tool by typing
- Last, type
. .bash\_profileto reload .bash_profile and update any aliases you just added.
Your awesome new .bash_profile
The following is a compiled .bash_profile that I came across on GitHub and forked it for future reference. It’s a very concise and well commented document that has a ton of useful aliases. Here is the link to the file via GitHub Gist thanks to Nathaniel Landau who compiled the file.Tweet