Install Maven On Mac OS X
Many of the people heard about Apache Maven which is a built-in software and mainly used for Java Programs but if you are new to Apache Maven and don’t even know what is Maven, Don’t worry by the end of this article you can get a clear-cut information about What is Maven? and How to Install Maven On Mac OS X.
First things first now we can learn about What is Maven?
What is Maven?
A maven is just a Build tool, For example, generally, a developer develops a code and places it in any of the repositories like SVN, Github repositories to make it open source, Then the common user will clone the code manually and make an executable file using this maven build tool. This Maven is mainly used for Java Code.
Visit Also: How to open Mac Task Manager
Install Maven On Mac OS X:
First before Installing Maven on Mac, just make sure that Maven is not previously installed in your Mac.
To do so follow the steps carefully which are listed below:
Step-1: Check whether Maven is Already Installed on your Computer:
- First things first open your Terminal by using Spotlight and Type the below command to cross-check whether Maven is already Installed on your Computer
If it shows maven command not found then Maven is not installed on your System or else if maven is in your Computer it shows the version of your Maven.
Now you can get very angry that instead of telling how to install maven why you are telling this unnecessary thing, Yaa I know, So without further ado let’s get into our main Topic.
Method-1: Installing Maven only in the Present Terminal – Temporary Purpose
- Some people don’t want to install the Softwares permanently in their computer so for those people who want to use maven for the temporary purpose this section is perfect for them.
- First Download the Maven Zip file from the link below and Download the Maven Zip file under the Files section
- Now Unzip the file and change the folder from Downloads to some other path.
- In this tutorial, I am changing my Path to (Users/Vinod/) means literally after unzipping, copy the maven file and paste in some other folder and remember the path. If you are the person like me asking that where we can see our path? Then don’t worry you can right click on the copied file and click on copy path.
- Now if you got your path then you need to set your system variables to do that first go to terminal and type these two variables.
export M2_HOME="**********" (Here * this symbol in the sense the newly pasted folder path
Note: Folder Path means the newly pasted folder path, For example, I have Copied and Pasted the Maven file in Users>vinod>apache-maven-3.3.9 so in the terminal I need to write…
- After writing this variable click Enter and Now you need to set the path variable. To set the path variable you need to type this line.
export PATH=$PATH:**********(Here * this symbol in the sense the newly pasted folder path)
Note: Folder Path means the newly pasted folder path, For example, I have Copied and Pasted the Maven file in Users>vinod>apache-maven-3.3.9 so in the terminal I need to write this Line and click Enter
- Now the Variables is all set and the Maven is Installed successfully Now Check whether the Maven is Installed or not by typing “mvn —version” Then you can observe the current Maven version which is installed on your PC.
But remember one thing that this is a temporary process and If you closed the present terminal then you can’t see Maven in the another Terminal
Now, what to do? Yes, there is a Permanent way to install maven on mac os If you want to know that then Continue Reading.
Method-2: Installing Maven only in Your PC Permanently- Permanent Purpose.
- To make Maven permanent for all Terminal sessions in you PC First you need to create a bash file in your Users folder to do so type the below command in the terminal.
- If you open the Users folder you cannot see the bash file normally because it is a hidden file so to see the bash file copy the below command and paste in the Terminal.
$ defaults write com.apple.finder AppleShowAllFiles TRUE
- Now right click on the finder and Tap on Relaunch to see the bash file Now Edit the bash file with any editor available in your device.
- Now you need to type the two variables which we have seen clearly in the Method-1 if you don’t have any idea or skipped the article one’s look into Method-1 there you can find the two HOME and PATH VARIABLE copy and paste the same variables in this file and save the bash file.
- Yes, That’s it You have successfully installed the maven in your PC and this is permanent.
Install Maven on Mac OS- Conclusion:
Yes it is a bit long process but it will be the easiest process once you have understood, There are many uses of maven like you can easily clone the java related codes from almost all the repositories, So if you want to clone the codes so what are you waiting for just go and install Maven.