(1) First know what kind of shell you use for Mac OS x, use commands
Echo $SHELL
If the output is: CSH or TCSH, then you are using C Shell.
If the output is: bash,sh,zsh, then your use may be a variant of the Bourne shell.
Before Mac OS X 10.2, the default is C Shell.
The default is Bourne Shell after Mac OS X 10.3.
(2) If it is a Bourne Shell.
Then you can add the environment variables you want to add to your home directory under the. Profile or. Bash_profile, if there is no relationship added to it, if one is not generated.
1./etc/profile (it is not recommended to modify this file)
A global (public) configuration that reads the file when logged on, regardless of the user.
2./ETC/BASHRC (typically add system-level environment variables to this file)
Global (public) configuration, which will be read by the bash shell, regardless of the way it is executed.
I'm here to add aliases to the Mysqlstart, MySQL, and mysqladmin commands to ensure that each user can use these 3 commands.
3.~/.bash_profile (typically add user-level environment variables to this file)
(Note: Linux is. BASHRC and Mac is. Bash_profile)
This file will not be read until the bash shell is executed in login mode. The file is only executed once! By default, he sets some environment variables
I am here: Set the terminal color,
I am here: set command aliases alias Ll= ' Ls-la '
I am here: Set environment variables: Export Path=/opt/local/bin:/opt/local/sbin: $PATH
MAC Modify Host File
-------------------------------------------------------
sudo vi/etc/hosts
View and add path environment variables under Linux
==============================================
The format of path is:
-------------------------------------------------------
Path= $PATH: <path 1>:<path 2>:<path 3>:------: <path n>, separated by colons.
Add the path environment variable:
-------------------------------------------------------
[[email protected] U-BOOT-SH4] #export path=/opt/stm/stlinux-2.3/devkit/sh4/bin: $PATH
To view the path environment variable:
-------------------------------------------------------
[[email protected] U-BOOT-SH4] #echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
Examples of operations:
-------------------------------------------------------
Change the path by editing the startup file.
# Vim/etc/profile
At the end of the document, add:
Export path= "/opt/stm/stlinux-2.3/devkit/sh4/bin: $PATH"
Save, exit.
To take effect immediately please run:
#source/etc/profile
No error is successful.
If you want to take effect immediately , you can execute the following statement:
$ source. Bash_profile (This is the file name)
When the environment variable changes, it takes effect the next time the user logs on.
Ext.: http://www.cnblogs.com/shineqiujuan/p/4693396.html
MAC can set the location of environment variables, view and add PATH environment variables