Reproduced indicate the source: http://www.jianshu.com/p/7e30b7b7ee48
Mac client environment variable configuration
Mac using bash as the default shell
Loading sequence configured MAC OS X environment
# 系统级别
/etc/profile
/etc/paths
# 用户级别
~/.bash_profile
~/.bash_login
~/.profile
~/.bashrc
The first two are system-level environment variables for all users, back with four ~/
user-level environment variable.
- The first two environment configuration will be loaded during system startup time.
~/.bash_profile
,~/.bash_login
,~/.profile
Sequentially loads, if~/.bash_profile
not present, turn back to load several files; if~/.bash_profile
the file exists, behind several file does not load~/.bashrc
Bash shell is opened when the load
Global environment variable settings
Modify global environment variable time reference system environment variables to configure the default format.
Modify global environment variables need root privileges.
- / Etc / paths global recommendation to amend this document
- / Etc / profile is not recommended to modify this file, there are global configuration, user login time will load the file
- / Etc / bashrc generally added system-level environment variables in this file, there are global configuration, bash shell will be executed when loaded
User-level environment variable settings
In the ~/.bash_profile
configuration environment.
# 使用冒号隔开
export PATH=$PATH:<PATH 1>:<PATH 2>:<PATH 3>:------:<PATH N> # 或者 export PATH=${PATH}:<PATH 1> export PATH=${PATH}:<PATH 2> # 第一种将路径合并在一起,不方便删除,建议使用第二种,换行挨个设置
# java
export JAVA_HOME = /home/myuser/jdk1.7.0_03
export PATH = $JAVA_HOME/bin:$PATH export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar # hadoop export HADOOP_HOME=/Users/YourUserName/Documents/Dev/hadoop-2.7.3 export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin # spunk export SPLUNK_HOME=/Applications/Splunk export PATH=$PATH:$SPLUNK_HOME/bin # Setting PATH for Python 3.5 # The original version is saved in .bash_profile.pysave PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" export PATH export CLASSPATH=${CLASSPATH}:/Users/YourUserName/Documents/Lib/hadoop_cli # ant export ANT_HOME=/Users/YourUserName/Documents/Dev/apache-ant-1.9.7 export PATH=$PATH:${ANT_HOME}/bin # JBOSS export JBOSS_HOME=/Users/YourUserName/Documents/Dev/wildfly-10.1.0.Final export PATH=$PATH:$JBOSS_HOME/bin # M2_HOME export M2_HOME=/Users/YourUserName/Documents/Dev/apache-maven-3.3.9 export PATH=$PATH:$M2_HOME/bin
Reload the configuration file
After configuration is complete environment, typically a computer to take effect again, if you want to take effect immediately, execute the following command
source <相应文件配置文件>
#示例
source .bash_profile
Author: Wang San cats Adelaide
link: https: //www.jianshu.com/p/7e30b7b7ee48
Source: Jane book
Jane book copyright reserved by the authors, are reproduced in any form, please contact the author to obtain authorization and indicate the source.