mac modify environment variables path

(1) we must first know the use of Mac OS X is what Shell, use the command

echo $SHELL

If the output is: csh or tcsh, then use is the C Shell.

If the output is: bash, sh, zsh, then use is probably a variant of the Bourne Shell.

Prior to the default Mac OS X 10.2 is the C Shell.

After the default Mac OS X 10.3 is the Bourne Shell.

 

 

 

(2) If a Bourne Shell.

You can add environment variables to be added to the main directory of .profile or .bash_profile, if there is not added into the relationship can be, if not a generation.

 

 1./etc/profile (not recommended to modify this file)

 Global (public) configuration, regardless of which user will log in to read the file.

 

 2./etc/bashrc (usually add system-level environment variables in this file)

 Global (public) configuration, when the bash shell execution, no matter how, will read this file.

 I'm here to join the alias mysqlstart, mysql and mysqladmin command to ensure that every user can use these three commands.

 

 3. ~ / .bash_profile (user-level environment variable is generally added in this document)

(Note: Linux and Mac is inside .bashrc .bash_profile)

 If the bash shell is a login mode execution, will read this file. The document is performed only once! By default, set some environment variables

 

Example: firefox modify environment variables

1. By vim ./.bash_profileentering the editor vim

I is 2. English input mode, enter the edit mode

  

3. Add the path

export FIREFOX_HOME=/Applications/Firefox.app/Contents/MacOS
export PATH=$PATH:$FIREFOX_HOME

 

4. Click edited esc exit edit mode
5. Type: wq to exit the vim editor
6. Back terminal input interface, input source ~/.bash_profile

 

 

Guess you like

Origin www.cnblogs.com/may18/p/12466139.html