Setting environment variables on OS X

后端 未结 30 3166
你的背包
你的背包 2020-11-21 05:15

What is the proper way to modify environment variables like PATH in OS X?

I\'ve looked on Google a little bit and found three different files to edit:

30条回答
  •  我在风中等你
    2020-11-21 05:48

    Set up your PATH environment variable on Mac OS

    Open the Terminal program (this is in your Applications/Utilities folder by default). Run the following command

    touch ~/.bash_profile; open ~/.bash_profile
    

    This will open the file in the your default text editor.

    For Android SDK as example:

    You need to add the path to your Android SDK platform-tools and tools directory. In my example I will use "/Development/android-sdk-macosx" as the directory the SDK is installed in. Add the following line:

    export PATH=${PATH}:/Development/android-sdk-macosx/platform-tools:/Development/android-sdk-macosx/tools
    

    Save the file and quit the text editor. Execute your .bash_profile to update your PATH:

    source ~/.bash_profile
    

    Now every time you open the Terminal program your PATH will include the Android SDK.

提交回复
热议问题