After installing the java development environment in Apple Mac system, you want to execute Maven related commands on the command line
The problem Zsh: command not found: MVN
is found. The first reaction is that the environment variable is not configured.
Configure environment variables
vim ~/.bash_ profile
export PATH=$PATH:~/maven/bin
source .bash_ profile
Verify that the configuration is in effect
mvn -v
Apache Maven 3.8.3 (ff8e977a158738155dc465c6a97ffaf31982d739)
Maven home: /Users/codeboyzhou/maven
Java version: 1.8.0_312, vendor: Temurin, runtime: /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/jre
Default locale: zh_CN, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
You can see that it is indeed effective in the command line, and then when you open the terminal in IDEA and continue to execute other Maven commands, the problem is reported again zsh: command not found: mvn
, what’s the matter?
Guess is because the new version of Mac system uses the default zsh
, and .bash_profile
is the Linux system bash
environment variables configuration, try to modify the configuration file mv .bash_profile .zshrc
, and perform once again source .zshrc
make the configuration take effect, the problem is solved. Restart IDEA and the corresponding terminal window to confirm that the problem has indeed been resolved.
Other online article that is zsh
not automatically loaded when you start .bash_profile
caused, can be .zshrc
added to the last line of the file source .bash_profile
it automatically take effect each time the terminal starts, this method is feasible. But because my system itself does not have .zshrc
this document, other configuration information does not exist, so I use the above method directly with the environment variable to .zshrc
the next file is able to quickly solve the problem, compared to operating steps and also more concise, Which method to use can be determined according to personal preference or specific circumstances.
Similar Posts:
- Mac open terminal error – bash:: command not found
- [Solved] JSCH cannot run JAVA bash:java:Command not found.
- Mac ADB prompts command not found
- macos -bash: yarn: command not found/-bash: cnpm: command not found
- How to install “CONDA command not found” in MAC Anaconda
- Super detail: command not found: the scratch solution (add the scratch environment variable to Zsh under MAC)
- [Solved] JMeter startup error: integer expression expected
- After installing node on MAC, enter node – V to prompt node command not found
- CentOS Error -bash:systemctl:command not found
- JAVA_HOME is not defined correctly [How to Solve]