Search code examples
bashapacheandroid-studioantosx-elcapitan

-bash: ant: command not found on mac os x El Capitan


I try to integrate zxing on my android studio project and I need Apache Ant for it. I followed this steps for Apache Ant install: http://www.mkyong.com/ant/how-to-apache-ant-on-mac-os-x/ but when I finish to follow all those steps from link, I receive this message:

-bash: ant: command not found


Solution

  • Given the output of echo $PATH:

    /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/mkyong/gradle/bin:/Users/mky‌​ong/apache-maven-3.1.1/bin:/Users/mkyong/apache-ant-1.9.6/bin 
    

    It seems that you have followed the link instructions a bit too much here (step 3):

    export JAVA_HOME=$(/usr/libexec/java_home)
    export GRADLE_HOME=/Users/mkyong/gradle
    export M2_HOME=/Users/mkyong/apache-maven-3.1.1
    
    # Apache Ant
    export ANT_HOME=/Users/mkyong/apache-ant-1.9.4
    
    # Export to PATH
    export PATH=$PATH:$GRADLE_HOME/bin:$M2_HOME/bin:$ANT_HOME/bin
    

    Since mkyong refers to the writter's username. So just do the same with your username (you can get it by running whoami in terminal) and it should do the trick.