January 3, 2014

Salesforce Migration Tool installation on Mac OSX

I was setting up a Mac Machine, while installing Force.com migration tool, I was able to grab the zip file salesforce_ant_29.0.zip as per following steps mentioned in official guide.
  1. Log into a Salesforce organization on your deployment machine.
  1. From Setup, click Develop | Tools, and then click Force.com Migration Tool.
  1. Save the .zip file locally and extract the contents to the directory of your choice.
  1. Copy ant-salesforce.jar and paste into your Ant installation's lib directory. The lib directory is located in the root folder of your Ant installation.
I was stuck in last step #4, as I have to locate ant "lib" directory in installation folder.

First thing came to my mind was to try
$whereis ant
But this returned nothing. On googling I found people are suggesting various hard coded paths to various directories, none of them existed on my machine. This is due to fact we all use variety of ways to install ANT on Mac, i.e. homebrew, macports, direct installation, etc.

The simplest and clean way to find path is available in "ant" executable only. Just fire this command in terminal

 $ant -diagnostics 
It will throw a huge amount of information on you, including the key one as indicated below
-------------------------------------------
 ANT PROPERTIES
-------------------------------------------
....
....
ant.core.lib: /usr/local/Cellar/ant/1.9.2/libexec/lib/ant.jar
ant.home: /usr/local/Cellar/ant/1.9.2/libexec
In my case home directory for ANT is "/usr/local/Cellar/ant/1.9.2/libexec", where I found required "lib" folder, as mentioned in step#4 above.

Hope this helps and saves your time some day.