Location of MAC environment variables, viewing and adding PATH environment variables

Source: Internet
Author: User

MAC Boot load file location (environment variables can be set)

(1) First know what kind of shell you use for Mac OS x, use commands
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.

Where the MAC configures environment variables
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.

3.~/.bash_profile (typically add user-level environment variables to this file)
Each user can use the file to enter shell information dedicated to their own use, and when the user logs in, the file executes only once!

Setting the Android ADB environment variable

1, to the local path of the Android SDK,

ADB command under Platform-tool, credited as xxxx

My path is (/applications/eclipse/android-sdk-mac_x86/platform-tools)

2. Open Terminal input

Touch. Bash_profile

Open-e. Bash_profile Point Enter

3. Add a path

The. Bash_profile opens and we add the path here,

If there is already content in the open document, we just add it later; XXXX (note that the front must be separated by semicolons),

If it's a blank document, let's enter the content.

Export Path=${path}:xxxx

Save, turn off this document,

4. Terminal input command source. bash_profile

5. Terminal Input command adb point enter, if command not found is not displayed, it is valid and the environment is set to complete.


When developing with eclipse, you do not use the Android configuration environment variable, in its properties to specify the Android installation directory, but after setting the environment variable for our future development, especially in the terminal debugging, save a lot of trouble. Below I will in the MAC environment configuration steps are recorded as follows, the online introduction of the article a lot, but there are some small details of the problem, the following is my practice record, especially some details.

1. Create the file ~/.bash_profile in the local directory (home directory, which is your own user's home folder, ~/). Note ~/.bash_profile file (hidden file). The commands I use to edit or create files with Vim are as follows:

Vim ~/.bash_profile

2, write the following in the file, in the inside the tools path plus here is the ":" Colon to separate, and do not have an empty space, otherwise, I have learned in the above, which is different from the environment variable of window system, it uses ";" Semicolon to separate!

Export Path=${path}:/users/android-sdk-mac_x86/tools:/users/android-sdk-mac_x86/platform-tools

Where:/users/android-sdk-mac_x86/tools is not fixed, it points to the tools directory of the Android SDK,/users/android-sdk-mac_x86/platform-tools refers to The Platform-tools directory to the Android SDK is also subject to availability.

For example, my own configuration of the computer is:/USERS/DANS88/ANDROID-SDK This directory, so to use this path to replace.

3, then, exit the Vim edit state, press ": Wq", save.

4, execute the command, let the configuration take effect:

Execute the following command: Source ~/.bash_profile

5, verify: Enter the ADB carriage return. If command not found is not displayed, the command is valid and the environment variable setting is complete.

MAC Modify Host File
sudo vi/etc/hosts

Location of MAC environment variables, viewing and adding PATH environment variables

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.