Set environment variables on Mac OS X Lion

后端 未结 16 1203
余生分开走
余生分开走 2020-11-22 11:01

When someone says \"edit your .plist file\" or \"your .profile\" or \".bash_profile\" etc, this just confuses me. I have no idea where these files are, how to create them if

16条回答
  •  隐瞒了意图╮
    2020-11-22 11:41

    Let me illustrate you from my personal example in a very redundant way.

    1. First after installing JDK, make sure it's installed.
    2. Sometimes macOS or Linux automatically sets up environment variable for you unlike Windows. But that's not the case always. So let's check it. The line immediately after echo $JAVA_HOME would be empty if the environment variable is not set. It must be empty in your case.

    3. Now we need to check if we have bash_profile file. You saw that in my case we already have bash_profile. If not we have to create a bash_profile file.

    4. Create a bash_profile file.

    5. Check again to make sure bash_profile file is there.

    6. Now let's open bash_profile file. macOS opens it using it's default TextEdit program.

    7. This is the file where environment variables are kept. If you have opened a new bash_profile file, it must be empty. In my case, it was already set for python programming language and Anaconda distribution. Now, i need to add environment variable for Java which is just adding the first line. YOU MUST TYPE the first line VERBATIM. JUST the first line. Save and close the TextEdit. Then close the terminal.

    8. Open the terminal again. Let's check if the environment variable is set up.

提交回复
热议问题