Scenes
Use the Mac mongodb, are generally required to configure the look of the environment variable in .bash_profile, a little later would be more convenient to use. Problems encountered situation is: After you configure .bash_profile, source a bit, and then start the mongodb, Then they built a terminal window to connect to the database, to perform mongo command, remind:
the reason
Terminal using zsh, zsh loading was ~ / .zshrc file, and '.zshrc' file not defined Task Environment
solve
1, the terminal execute commands, open .zshrc file:
open -e ~/.zshrc
2, in ~ / .zshrc file Finally, add a line:
source ~/.bash_profile
3, execute the command, to take effect immediately
source ~/.zshrc
4, a new window, test:
PS:
profile (/ etc / profile), is used to set system-wide environment variables and startup programs, configuration will take effect for all users in this file. When a user logs in (login), the file will be executed, and find shell settings from the configuration file /etc/profile.d directory.
Generally we do not recommend adding an environment variable in the / etc / profile file, because the set will be added to all users in this file work.
bash_profile only a single valid user, the file store is ~ / .bash_profile, the file is a user-level setting to be understood that a user profile under a certain directory. This file also can be used to configure the environment variables and start the program, but only valid for a single user.
And a profile similar documents, bash_profile will take effect when the user logs in (login), can also be used to set environment variables management. But with a different profile, bash_profile only for the current user.
Generally we do not recommend adding an environment variable in the / etc / profile file, because the set will be added to all users in this file work.
bash_profile only a single valid user, the file store is ~ / .bash_profile, the file is a user-level setting to be understood that a user profile under a certain directory. This file also can be used to configure the environment variables and start the program, but only valid for a single user.
And a profile similar documents, bash_profile will take effect when the user logs in (login), can also be used to set environment variables management. But with a different profile, bash_profile only for the current user.