Installing Force.com Migration Tool (Ant) on Mac OsX

I was trying to run ANT to migrate code between two Salesforce orgs today and realized I hadn't configured the Force.com Migration Tool properly for my new Mac. I kept getting the error; [antlib:com.salesforce] Could not load definitions from resource com/salesforce/antlib.xml. It could not be found.

I already had the latest version of Eclipse installed, which handles the Ant installation for you. You can confirm this by typing ANT-version in Terminal. So, it was just a question of getting the migration tool in the Ant lib directory. (This took me a bit of searching hence this quick post).

  1. Download the Force.com Migration Tool (instructions here).
  2. Unzip the file
  3. Open a terminal window in the directory of the unzipped file (See my last post for a quick way to do this)
  4. Type: sudo sh
  5. Enter your password
  6. Type: cp ant-salesforce.jar /usr/share/ant/lib/ant-salesforce.jar

Now you're good to go. Check out Jeff Douglas' blog post on the hows and whys of this tool.