Every developer environment variable is not open around the topic herein, this simply tells Mac in
~/.bash_profile
relevant environmental variables
Mac configuration environment variable in position
Mac and configuration environment variable positions mainly in the following three (see below several multi-load order):
/ etc / profile (not recommended to modify this file)
global (public) configuration, regardless of which user will log in to read the file/ etc / bashrc (generally added in this file system-level environment variables)
global (public) configuration, when the bash shell execution, no matter how, will read this file~ / .bash_profile (generally added in this user-level file, environment variables used )
for each user can input information for the file using the shell to their specific use, when a user logs in, the file is performed only once
OS X system environment variables, loading order:
1 |
/etc/profile |
View Mac use what shell
1 |
echo $SHELL |
Types of shell are:
- csh or tcsh; these types categorized as: C Shell (before the default Mac OS X 10.2)
- bash, sh, zsh; these types categorized as: (default after Mac OS X 10.3) Bourne Shell
different languages will only shell is to use the rules there will be little difference, are interested in children's shoes which can further explore the difference; the text in a manner suitable for Bourne Shell
~ / .Bash_profile configuration
create
1 |
touch .bash_profile |
turn on
1 |
open -e .bash_profile |
After just close the edit box will be saved, saved can refresh
1 |
vi ~ / .bash_profile |
vi commonly used commands:
command | DEFINITIONS |
---|---|
:w | Storage |
:q | Exit vim |
:wq | Save and Exit |
:wq! | (In the case of the conversion rights may) forced to save and exit |
:q! | Exit without saving |
:w filename | Save as filename |
:n,m w filename | The n-th row to the m-th row is saved filename |
: Not set | Show Line Numbers |
:set nonu | It does not display line numbers |
:! command | Temporarily leave vim, and execute command, executed after their entering vim |
:r filename | The read data file filename into the current file |
:set all | Display the current environment configuration of vim |
According to the command editing, save;
Configuration
1 |
Export the PATH = $ {} the PATH : Path 1: Path 2: $ the PATH (a ":" split) |
Such as:
1 |
export xx1_HOME=/Library/xxx/xxx/xxx/Contents/Home |
or:
1 |
|
Refresh
1 |
source ~/.bash_profile |
These are some simple configuration environment variable, there are many interesting configurations, children's shoes can explore on their own, welcome to exchange and share
Original: Big Box Mac configured environment variables