MAC environment variable Configuration

Source: Internet
Author: User
Tags sublime text

Where the MAC environment variable is saved

When there is no zsh, the environment variables in the Mac are saved in the

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 that is specific to their own use, and when the user logs in, the file executes only

If you want to modify the environment variable, the general modification ~/.bash_profile is OK.

View environment variables
$ printenv
Echo $SHELL/bin/zsh

View the currently used shell

Zsh after installation

When ZSH is installed, it is not automatically read by default ~/.bash_profile .
There should be directories in the user directory .oh-my-zsh , and .zshrc configuration files

    1. .oh-my-zshDirectory: It is the installation folder of Zsh and can change itself

    2. .zshrc: Inside is zsh default configuration, can be used to set environment variables (export), alias command aliases, set themes, etc.

      However, ZSH does not recommend the direct operation of this default configuration, if users need custom configuration, recommended to go here./oh-my-zsh/custom/custom.zsh Modify.
      Note: All configurations in the custom folder will be automatically read and configured by ZSH.
    3. ./oh-my-zsh/custom/my_custom.zsh: User-defined custom system variables, custom commands, and more

      In general, we ./oh-my-zsh/custom/my_custom.zsh configure a shortcut key in

      Alias zshconfig="subl ~/.oh-my-zsh/custom/my_custom.zsh"

In summary, if you want to configure the environment variable
    1. Execute zshconfig , the configuration file is opened automatically using the command you defined
    2. Add the environment variables you want to add to the file, such asexport ANDROID_HOME=/Development/android-sdk/
    3. Restart CMD, take effect! Ok. Configuration complete
Back up a configuration file of my own

./oh-my-zsh/custom/my_custom.zshAs follows:

Alias zshconfig="subl ~/.oh-my-zsh/custom/my_custom.zsh"alias code=\ " /applications/visual Studio code.app/contents/resources/app/bin/code'alias subl= '  '/applications/sublime text.app/contents/sharedsupport/bin/subl '"alias NW= " /applications/nwjs.app/contents/macos/nwjs " Export Android_home=/development/android-sdk/

Okay, you can use the command line.

Code xxx/file. txt

It's a quick way to Vscode.


MAC environment variable Configuration

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.