.bash_profile file
If you’re not familiar with a .bash_profile file, this is a startup file that is read whenever you open a new Terminal window. It’s a special configuration file, and it needs to be placed in your home directory. For instance, on my MacBook Pro, this file is located as /Users/bowen.li/.bash_profile
.
My .bash_profile file
As you can see from my sample file shown below, the .bash_profile file can contain any legal Unix command, including Unix alias definitions, Unix export and PATH statements, and other commands to set up your Bash prompt.
1 |
# aliases |
How to permenantly set environment variables on Mac
1 |
echo $YOUR_KEY |
it prints current path value.
Then do
1 |
vim ~/.bash_profile |
and write
1 |
export YOUR_KEY=YOUR_VALUE |
then do
1 |
source ~/.bash_profile |
this will execute it and add the path
then again check with
1 |
echo $YOUR_KEY |
近期评论