Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do I find the bashrc file on Mac?

Hello I am following this page.. I'm installing Python onto my mac so that I can set up a Django / Eclipse development environment. However I am not too sure how to go about executing this step:

  • The script will explain what changes it will make and prompt you before the installation begins.
  • Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable.
  • You can do this by adding the following line at the bottom of your ~/.bashrc file
  • export PATH=/usr/local/bin:$PATH

Where do I find the bashrc file on my mac and where do I find the homebrew directory?

I am running a macbook pro with OS 10.8.5.

like image 695
pencilVester Avatar asked Oct 29 '13 15:10

pencilVester


2 Answers

The .bashrc file is in your home directory.

So from command line do:

cd ls -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/local ls | 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 . .alias alias ducks='du -cks * | sort -rn | head -15'  # Source global definitions if [ -f /etc/bashrc ]; then     . /etc/bashrc fi  PATH=$PATH:/home/username/bin:/usr/local/homebrew export PATH 

If you create your own .bashrc file make sure that the following line is in your ~/.bash_profile

# Get the aliases and functions if [ -f ~/.bashrc ]; then     . ~/.bashrc fi 
like image 151
Peter Party Bus Avatar answered Sep 21 '22 11:09

Peter Party Bus


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.

like image 26
beroe Avatar answered Sep 19 '22 11:09

beroe