How can I prevent OSX upgrade messing up my apache ant install
OS X used to come with a version of Apache ant, but not since OS X 10.9.

I think that previously I must have installed into /usr/bin directly from the apache site but that is a bad idea because on upgrade anything Apple doesn't recognise in /usr/bin is removed (although a copy is moved to /Library/SystemMigration/History/Migratio**********/QuarantineRoot).

Instead I should have installed into /usr/local

I did this using homebrew, installation of homebrew and then ant with homebrew was easy and I did not have to manually setup any paths, however note if you need to install custom jars they need to be put into (i.e /usr/local/Cellar/ant/1.9.6/libexec/lib) libexec/lib which is non-standard, there is no libexec folder in the standard version of ant. Other than I have had no other issues with the homebrew version of ant.