ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter West <>
Subject Re: Ant on Mac OS X
Date Wed, 05 Mar 2014 22:14:04 GMT
Download the binary distribution (latest is 1.9.3) from

Unzip (or gunzip) the distribution somewhere on your system. If you are happy using sudo,
you can put it in /usr/local, for example. Otherwise, put it in you home directory at a convenient

It's a good idea to create a softlink to the distribution directory. So if you have /Users/me/software/apache-ant-1.9.3,
create a link like so:
$ cd /Users/me/software
$ ln -s apache-ant-1.9.3 ant

Now you can set the ANT_HOME environment variable to /Users/me/software/ant, and when you
install a new distribution of ant, you only have to delete the old link and create a new one.

In /users/me/software/ant is a directory bin which contains the shell scripts (compatible
with linux/unix and os x) which will be used to run ant. You need to make sure that the bin
directory is on your PATH.

In your .profile, add the following.

Near the top of the file, define these functions:

set_env_var () {
	eval export $1=\""$2"\"
	eval launchctl setenv "$1" \""$2"\"

unset_env_var () {
	unset $1
	eval launchctl unsetenv "$1"

Anywhere below that in .profile, you can now define environment variables that will also be
set for programs that run directly from the GUI.

After your PATH environment variable has been set, add this:

set_env_var ANT_HOME /Users/me/software/ant

export PATH
launchctl setenv PATH "$PATH"

Peter West

...and again, as his custom was, he taught them.

On 6 Mar 2014, at 7:03 am, Tony Anecito <> wrote:

> Hi All,
> I am new to Mac OS X. What is the easiest way to get Ant running on OS X? I tried copying
my ant folder from Windows to Mac OS X and it would not run.
> Thanks!
> -Tony

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message