Sunday, August 17, 2008

Setting Environment Variables on Mac

I got a Mac and when I wanted to install Ant on it, I was posed with a question of How to set the environment variables on it so that I can install ant.

Things to do:

Have a X11 terminal. (If you don't have X11, get it from your Mac installation CD).

1)create .MacOSX directory in your Home directory.
mkdir .MacOSX.

2)create a new file called environment.plist
echo "" > .MacOSX/environment.plist

3) open environment.plist file in the property editor.
open .MacOSX/environment.plist

4)create a new child as ANT_HOME (It was ANT_HOME for my purpose). And set it as string.
The ANT_HOME variable should be set as the directory where the lib and bin of ANT installation is present.

In my case it was "/Users/acv/ant".

5)  save the environment.plist file and type ant in the terminal.
you will get a message as,

Build Failed.( Because we have not created the buld.xml file yet)

6) Type ant -version on the terminal. If you get the version details then Ant is successfully installed.

That's it! we have learnt how to set environment variable and install ant on Mac.

lets make mac more friendlier.