Where do I find the bashrc file on Mac?
The .bashrc file is in your home directory.
So from command line do:
cdls -a
This will show all the hidden files in your home directory. "cd" will get you home and ls -a will "list all".
In general when you see ~/ the tilda slash refers to your home directory. So ~/.bashrc is your home directory with the .bashrc file.
And the standard path to homebrew is in /usr/local/ so if you:
cd /usr/localls | grep -i homebrew
you should see the homebrew directory (/usr/local/homebrew). Source
Yes sometimes you may have to create this file and the typical format of a .bashrc file is:
# .bashrc# User specific aliases and functions. .aliasalias ducks='du -cks * | sort -rn | head -15'# Source global definitionsif [ -f /etc/bashrc ]; then . /etc/bashrcfiPATH=$PATH:/home/username/bin:/usr/local/homebrewexport PATH
If you create your own .bashrc file make sure that the following line is in your ~/.bash_profile
# Get the aliases and functionsif [ -f ~/.bashrc ]; then . ~/.bashrcfi
I would think you should add it to ~/.bash_profile
instead of .bashrc
, (creating .bash_profile
if it doesn't exist.) Then you don't have to add the extra step of checking for ~/.bashrc
in your .bash_profile
Are you comfortable working and editing in a terminal? Just in case, ~/
means your home directory, so if you open a new terminal window that is where you will be "located". And the dot at the front makes the file invisible to normal ls
command, unless you put -a
or specify the file name.
Check this answer for more detail.
On your Terminal:
Type
cd ~/
to go to your home folder.Type
touch .bash_profile
to create your new file.- Edit .bash_profile with your code editor (or you can just type
open -e .bash_profile
to open it in TextEdit). - Type
. .bash_profile
to reload .bash_profile and update anyfunctions you add.