1 minute reading time (222 words)

Fixing: Error executing command 'ant' on Mac OS X 10.9 Mavericks

Today I stumbled over an unexpected problem when trying PhoneGap/Cordova with Mac OS X 10.9 Mavericks. Building a project for iOS went just fine, but building for Android wasn't without some guesswork.

After installing Android 4.2.2 via the Android SDK Manager (I had to use the older API v17 since it wasn't compatible with a newer one) and adding the PATH environment variables for the SDK's platform-tools and tools, I thought I was ready to take off by running the command: phonegap run android.

Nevertheless, I got the following error:

[phonegap] detecting Android SDK environment...
[phonegap] using the local environment
[phonegap] adding the Android platform...
[error] An error occured during creation of android sub-project.
ERROR : executing command 'ant', make sure you have ant installed and added to your path.



After checking my system for ant, the error message proved to be true since Apache Ant isn't packaged with Mac OS X Mavericks anymore.


So without further ado, here comes the bulletproof solution on how to fix this easily:

  1. Download and install Homebrew by executing following command in terminal:
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"​
  2. Install Apache Ant via Homebrew by executing:
    brew install ant​

That's it! Re-run the build and it should successfully compile and run the app.

PS: You can now find this post as Q&A on StackOverflow as well!

Speaker at PTC Live Stuttgart 2013
Request: Data of Business Projects for Master Thes...


No comments made yet. Be the first to submit a comment

София Дървени материали

София Дървени дъски

We use cookies on our website. Some of them are essential for the operation of the site, while others help us to improve this site and the user experience (tracking cookies). You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.