Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the environment variable path in mac

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to modify the environment variable path in mac, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

(1) first of all, you need to know what kind of Shell the Mac OS X is used, and use the command

Echo $SHELL

If the output is csh or tcsh, then you are using C Shell.

If the output is: bash,sh,zsh, then you may be using a variant of Bourne Shell.

Before Mac OS X 10.2, the default was C Shell.

After Mac OS X 10.3, the default is Bourne Shell.

(2) if it is Bourne Shell.

Then you can add the environment variable to be added to the .profile or .bash _ profile under the home directory, and add it if there is no relationship, if one is not generated.

1./etc/profile (it is not recommended to modify this file)

Global (public) configuration, no matter which user, will read the file when logging in.

2./etc/bashrc (usually add system-level environment variables to this file)

Global (public) configuration, this file will be read no matter how the bash shell is executed.

I add aliases for the mysqlstart, mysql, and mysqladmin commands here to ensure that every user can use these three commands.

3.~/.bash_profile (usually add user-level environment variables to this file)

(note: Linux contains .bashrc and Mac is .bash _ profile)

This file is read only if the bash shell is executed in login mode. The file is executed only once! By default, set some environment variables

Example: modify the environment variable of firefox

1. Enter the vim editor through vim. / .bash _ profile

two。 Enter I in English mode to enter editing mode

3. Join path

Export FIREFOX_HOME=/Applications/Firefox.app/Contents/MacOSexport PATH=$PATH:$FIREFOX_HOME

4. Click esc to exit editing mode 5. Enter: wq to exit vim editor 6. Go back to the terminal input interface and enter source ~ / .bash_profile

The above is all the contents of the article "how to modify the environment variable path in mac". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report