'Where can I find environment variables in MacOS Monterey?

I do a lot of search on finding environment variables. When I use the command printenv. I see a lot of environment variables. But I can't find them in my MacOS system.

I tried to open ~/.bash_profile and ~/.zshenv. But nothing in there!

I want to know clearly, in some searches, they said, there are two kind of environment variables in this link

  • Temporary environment variables, for example, using command:
export PATH=/Users/user1/Documents/apache-maven-3.5.0/bin:$PATH

to add /Users/user1/Documents/apache-maven-3.5.0/bin to the PATH list

  • Permanent environment variables are stored at .bash_profile

Now I want to know in MacOS Monterey, which location used for storing temporary environment variables, which location used for storing permanent environment variables?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source