[python] 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.

This question is related to python macos homebrew

The answer is


On some system, instead of the .bashrc file, you can edit your profils' specific by editing:

sudo nano /etc/profile

The .bash_profile for macOS is found in the $HOME directory. You can create the file if it does not exit. Sublime Text 3 can help.

  • If you follow the instruction from OS X Command Line - Sublime Text to launch ST3 with subl then you can just do this

    $ subl ~/.bash_profile
    
  • An easier method is to use open

    $ open ~/.bash_profile -a "Sublime Text"
    

Use Command + Shift + . in Finder to view hidden files in your home directory.


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 any functions you add.

~/.bashrc is already a path to .bashrc.

If you do echo ~ you'll see that it's a path to your home directory.

Homebrew directory is /usr/local/bin. Homebrew is installed inside it and everything installed by homebrew will be installed there.

For example, if you do brew install python Homebrew will put Python binary in /usr/local/bin.

Finally, to add Homebrew directory to your path you can run echo "export PATH=/usr/local/lib:$PATH" >> ~/.bashrc. It will create .bashrc file if it doesn't exist and then append the needed line to the end.

You can check the result by running tail ~/.bashrc.


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.


Open Terminal and execute commands given below.

cd /etc
subl bashrc

subl denotes Sublime editor. You can replace subl with vi to open bashrc file in default editor. This will workout only if you have bashrc file, created earlier.


Examples related to python

programming a servo thru a barometer Is there a way to view two blocks of code from the same file simultaneously in Sublime Text? python variable NameError Why my regexp for hyphenated words doesn't work? Comparing a variable with a string python not working when redirecting from bash script is it possible to add colors to python output? Get Public URL for File - Google Cloud Storage - App Engine (Python) Real time face detection OpenCV, Python xlrd.biffh.XLRDError: Excel xlsx file; not supported Could not load dynamic library 'cudart64_101.dll' on tensorflow CPU-only installation

Examples related to macos

Problems with installation of Google App Engine SDK for php in OS X dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac Could not install packages due to an EnvironmentError: [Errno 13] How do I install Java on Mac OSX allowing version switching? Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools) Can't compile C program on a Mac after upgrade to Mojave You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory. (mac user) How can I install a previous version of Python 3 in macOS using homebrew? Could not install packages due to a "Environment error :[error 13]: permission denied : 'usr/local/bin/f2py'"

Examples related to homebrew

dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac How can I install a previous version of Python 3 in macOS using homebrew? SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443 pip3: command not found env: node: No such file or directory in mac Stuck at ".android/repositories.cfg could not be loaded." Brew install docker does not include docker engine? What do raw.githubusercontent.com URLs represent? Homebrew refusing to link OpenSSL