Reputation: 1501
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.
- 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
.
Upvotes: 149
Views: 555213
Reputation: 11
Go to home directory of your user: cd ~/ list all hidden files in the directory using: ls -a locate the file: .zprofile Edit the file in vi and enter your alias in it at the end of the file. Eg: alias ll='ls -lart' Save with: wq: Run the command: source .zprofile Run the command: ll. You will see the alias working.
Upvotes: 1
Reputation: 1
cd ~/
.zprofile
alias ll='ls -lart'
source .zprofile
ll
. You will see the alias working.Upvotes: 0
Reputation: 906
In my macOS Monterey version, zsh
is the default terminal shell. zsh executes ~/.zshrc every time the terminal is opened.
vi ~/.zshrc
#Add your path export to .zshrc
PATH=/usr/local/bin:$PATH
Now, when you open the terminal, the path will be set correctly.
Upvotes: 21
Reputation: 554
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.
Upvotes: 5
Reputation: 311
On your Terminal:
Type cd ~/
to go to your home folder.
Type touch .bash_profile
to create your new file.
open -e .bash_profile
to open it in TextEdit).. .bash_profile
to reload .bash_profile and update any
functions you add.Upvotes: 16
Reputation: 488
On some system, instead of the .bashrc file, you can edit your profils' specific by editing:
sudo nano /etc/profile
Upvotes: 7
Reputation: 8378
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.
Upvotes: 2
Reputation: 12326
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.
Upvotes: 69
Reputation: 2476
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
Upvotes: 138
Reputation: 430
~/.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
.
Upvotes: 3