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 solve the problem of invalid configuration of mac using zsh terminal environment variables

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how to solve the problem of invalid configuration of environment variables in mac using zsh terminal". In daily operation, it is believed that many people have doubts about how to solve the problem of invalid configuration of environment variables in mac using zsh terminal. The editor has consulted all kinds of materials and sorted out simple and useful operation methods. I hope it will be helpful for you to answer the question of "how to solve the problem of invalid configuration of mac using zsh terminal environment variables"! Next, please follow the editor to study!

Create ~ / .bash_profile file

Vim ~ / .bash_profile file to configure environment variables

After that, use the zsh terminal to find that the configured environment variables are still invalid, and you need to manually source ~ / .bash_profile every time you open zsh.

Solution: modify the configuration file of zsh to read the configuration in ~ / .bash_profile every time it starts. Vim~/.zshrc adds source~/.bash_profile at the end of the file

Source ~ / .zshrc to make it effective immediately

OK~

Profile (/ etc/profile), used to set system-level environment variables and startup programs, under which the configuration will take effect for all users. When the user logs in (login), the file is executed and the shell settings are found in the configuration file in the / etc/profile.d directory. It is generally not recommended to add environment variables to the / etc/profile file, because the settings added in this file will work for all users. Bashprofile is valid only for a single user, and the file is stored in ~ / .bashprofile, which is a user-level setting that can be understood as a user's profile directory. This file can also be used to configure environment variables and start the program, but it is only valid for a single user. Like profile files, bashprofile takes effect when a user logs in (login), and can also be used to set environment modification. But unlike profile, bashprofile only works for the current user.

At this point, the study on "how to solve the problem of invalid configuration of mac using zsh terminal environment variables" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Internet Technology

Wechat

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

12
Report