Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Practice Problems
  • C
  • C++
  • Java
  • Python
  • JavaScript
  • Data Science
  • Machine Learning
  • Courses
  • Linux
  • DevOps
  • SQL
  • Web Development
  • System Design
  • Aptitude
  • GfG Premium
Open In App
Next Article:
How to Install Apache Maven on Windows, macOS, and Linux?
Next article icon

How to Install Apache Maven on Windows, macOS, and Linux?

Last Updated : 17 Sep, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

Apache Maven is a comprehensive build automation tool widely used for managing and building Java projects. It simplifies the process of managing project dependencies and building projects through a standardized approach. This article provides step-by-step instructions to install Apache Maven on Windows, macOS, and Linux.

What is Maven?

Maven is a build automation tool that focuses on two main areas:

  1. Building Software: Maven uses a plugin-based architecture to manage the build process of software projects.
  2. Handling Dependencies: Maven automatically manages and downloads Java libraries needed for the project.

If you would like to install Apache Maven in operating systems such as Windows, macOS, or Linux, please take a look at the steps mentioned below.

Install Apache Maven on macOS

We need to follow the steps mentioned below to install apache maven in the macOS.

Step 1: Open Maven Website

First step is to open the maven website, simply type apache maven download in search engine and open the first website which will look similar to image below.

Open Maven Website

Step 2: Download the latest binary zip archive

Once you open the website, scroll and select the following file for downloading, this is the file that contains the apache maven for macOS.

Download the latest binary zip archive

Step 3: Extract the Zip File

Locate the downloaded zip file and double-click it to extract. It will create a new folder with the same name as the zip file.

Extract the Zip File

Step 4: Open Environmental Path

Next step is to open the environmental path and for configuring the environment variable. We will have to open it in the terminal. For this, simply launch a terminal in macOS and type the following command to open the environmental path:

vi .zshenv
Open Environmental Path

Step 5: Configure Environment Variable

Once we have opened the environmental path, we will have to configure it by adding the path where the maven folder is stored and update the BIN location (path and folder name can vary in your case).

Here is my location and path for example:

export M2_HOME="$PATH:/Users/prashantrana/Documents/Dev/JavaSpring/apache-maven-3.6.3"
export PATH=$PATH:$M2_HOME/bin

Once you save this location of the environmental path, maven is ready to be used in your macOS operating system.

Configure Environment Variable

After this, you can verify the installation by using the below command:

mvn -version

This will display the Maven version installed on your system. This is how apache maven can be installed and configured in macOS system.

Install Apache Maven on Windows

For installing apache maven on the Windows operating system, we already have a dedicated article that you can follow, it involves several steps for installing Apache Maven on Windows.

How to Install Apache Maven on Windows?

Install Apache Maven on Linux

For installing apache maven on Linux, we will have to follow the below steps one by one.

Step 1: Verify JDK Installation

First step is to verify whether JDK is installed or not. For this, simply open a terminal and type the following command:

java --version

After typing this command you can see output similar to image below, if it is not installed properly then it will show an error message that command was not found.

If you need to install JDK in Linux you can read this article: How to Install JDK in Linux?

Verify JDK is installed

Once it is verified that JDK is installed, go to the next step.

Step 2: Update Package Index

Next step is to update the library. This step is also important because we need to make sure we can run the command for installing maven and for that directory list needs to have maven in it.

Type the following command in your terminal and wait until the list is downloaded:

sudo apt update
Update the Library

Step 3: Install Maven

Next step is to install maven. For this, simply type the following command and it will install maven in the Linux system.

sudo apt install maven

As you can see in the image below as well:

Install Maven in Linux

Step 4: Verify Maven Installation

Once the installation is completed, we can check whether maven is installed successfully or not. For checking this, we will have to enter the following command in the linux terminal.

mvn -version

This will show us the maven version which is installed in the system, also seen in the image below as well.

Maven Installed

This will display the Maven version installed on your system. This is how we can install maven in different operating systems.

Conclusion

Apache Maven is a robust tool for managing project builds and dependencies. Installing Maven varies by operating system, but the process is straightforward. Follow the steps outlined above for Windows, macOS, or Linux to get Maven up and running on your system.


Next Article
How to Install Apache Maven on Windows, macOS, and Linux?

K

kishankaushik
Improve
Article Tags :
  • Installation Guide
  • Maven

Similar Reads

    How to Install Apache Maven on Windows?
    Apache Maven is an automation tool. The tool is written in Java. It was initially released on 13 July 2004. It is developed by the Apache software foundation. It is part of the Jakarta Project. It is working on two aspects: how software is built, and its dependencies. It was created by Jason van Zyl
    3 min read
    How to Install Java on Windows, Linux and macOS?
    Java is a versatile programming language widely used for building applications. To start coding in Java, you first need to install the Java Development Kit (JDK) on your system. This article provides detailed steps for installing Java on Windows 7, 8, 10, 11, Linux Ubuntu, and macOS.Download and Ins
    5 min read
    How to Install Apache JMeter on Windows?
    The Apache JMeterâ„¢ application is open-source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions. It can be used to simulate a heavy load on a
    2 min read
    How to Install Ruby on Rails on Windows and Linux?
    Ruby on Rails or just known as rails, is free and open-source software written in Ruby language under the MIT license. It is a server-side web application development framework, designed to make programming web applications easier by making assumptions about what every developer needs to get started
    2 min read
    How to Install Apache Tomcat on Windows?
    Apache Tomcat which is short for “Tomcat” is a free, open-source Java Servlet, Java Expression Language, JavaServer Pages, and WebSocket implementation. Tomcat is an HTTP web server that basically runs Java code in a “pure Java” environment. Here, we will see how to install Tomcat 10 on Windows 10 f
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences