How can I install Apache Ant on Mac OS X?

后端 未结 8 1219
难免孤独
难免孤独 2020-12-22 15:22

I tried to install Apache Ant on my Mac and I followed the next steps :

  1. I downloaded apache-ant-1.8.1-bin.tar.gz into my Downloads folder.
相关标签:
8条回答
  • 2020-12-22 15:31

    To get Ant running on your Mac in 5 minutes, follow these steps.

    Open up your terminal.

    Perform these commands in order:

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    brew install ant

    If you don't have Java installed yet, you will get the following error: "Error: An unsatisfied requirement failed this build." Run this command next: brew cask install java to fix this.

    The installation will resume.

    Check your version of by running this command:

    ant -version

    And you're ready to go!

    0 讨论(0)
  • 2020-12-22 15:31

    MacPorts will install ant for you in MacOSX 10.9. Just use

    $ sudo port install apache-ant
    

    and it will install.

    0 讨论(0)
  • 2020-12-22 15:32

    If you have MacPorts installed (https://www.macports.org/), do this:

    sudo port install apache-ant
    
    0 讨论(0)
  • 2020-12-22 15:33

    The only way i could get my ant version updated on the mac from 1.8.2 to 1.9.1 was by following instructions here

    http://wiki.eclipse.org/Ant/User_Guide

    0 讨论(0)
  • 2020-12-22 15:36

    Ant is already installed on some older versions of Mac OS X, so you should run ant -version to test if it is installed before attempting to install it.

    If it is not already installed, then your best bet is to install Homebrew (brew install ant) or MacPorts (sudo port install apache-ant), and use those tools to install Apache Ant.

    Alternatively, though I would highly advise using Homebrew or MacPorts instead, you can install Apache Ant manually. To do so, you would need to:

    1. Decompress the .tar.gz file.
    2. Optionally put it somewhere.
    3. Put the "bin" subdirectory in your path.

    The commands that you would need, assuming apache-ant-1.8.1-bin.tar.gz (replace 1.8.1 with the actual version) were still in your Downloads directory, would be the following (explanatory comments included):

    cd ~/Downloads # Let's get into your downloads folder.
    tar -xvzf apache-ant-1.8.1-bin.tar.gz # Extract the folder
    sudo mkdir -p /usr/local # Ensure that /usr/local exists
    sudo cp -rf apache-ant-1.8.1-bin /usr/local/apache-ant # Copy it into /usr/local
    # Add the new version of Ant to current terminal session
    export PATH=/usr/local/apache-ant/bin:"$PATH"
    # Add the new version of Ant to future terminal sessions
    echo 'export PATH=/usr/local/apache-ant/bin:"$PATH"' >> ~/.profile
    # Verify new version of ant
    ant -version
    
    0 讨论(0)
  • 2020-12-22 15:40

    Use Brew is always good way to install ANT and other needs. To install type below command on terminal.

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    

    after Brew installation , type

    brew install ant
    

    This will install Ant on your system. Also you will not need to worry about setting up the path.

    Also i have documented on the same - How to Install ANT on Mac OS?

    0 讨论(0)
提交回复
热议问题