Ant command not found in OS X 10.10 Yosemite

Monkey Targets Forums/Android/Ant command not found in OS X 10.10 Yosemite

Steve Oliver(Posted 2014) [#1]
I had everything working in 80c on my Mac OS X 10.9 Mavericks and could build from Monkey to several Android devices.

After installing OS X 10.10 Yosemite (beta) now I can't build to the Android target. I get this in the Ted console:

"/Applications/MonkeyXPro80c/bin/transcc_macos" -target=Android_Game_(Experimental) -config=Debug -run "/Monkey/Any Screen/anyscreen.monkey"
TRANS monkey compiler V1.73
Parsing...
Semanting...
Translating...
Building...
sh: ant: command not found
TRANS FAILED: Android build failed.
Done.

I've tried both the experimental and non-experimental Android Game targets.

I verified the ant location in my config.macos.txt and it's the same as it was under Mavericks.

I can re-boot back to Mavericks on the old partition and the same Monkey project works again.

I did have to update Java and tweak the JRE settings in Eclipse, and after that verified I can build projects onto Android directly from Eclipse.

Any ideas?

Thanks.


marksibly(Posted 2014) [#2]
Ant got removed from OS X at some point I think - there should be a binary version around somewhere you can install, but it doesn't seem to be easy to find! Will keep looking...


dawlane(Posted 2014) [#3]
ANT if I remember, was no longer part of OSX when Mavericks came out. You could try mac ports/home brew or try and build ANT directly from source.


Steve Oliver(Posted 2014) [#4]
I have Ant installed, and when I boot back into Mavericks, Monkey can find it and build with it. My config in Monkey hasn't changed. Only the partition I am booting to has changed. When I boot to Mavericks, everything is fine. When I boot to Yosemite, then Monkey can't find Ant.

So just to be clear, I didn't change anything about my Monkey install at all. I kept it the way it was in Mavericks, and installed Yosemite to another partition. When I boot to the Yosemite partition, I am still using the same Monkey install.


marksibly(Posted 2014) [#5]
Then it could be a PATH problem?

If you open a command line and just type 'ant' what happens?


dawlane(Posted 2014) [#6]
So you have Monkey and ANT installed on Mavericks and are accessing it when booted into Yosemite and you haven't change any thing? Does this mean that you have not updated the config.macos.txt file in the bin directory? If so, then as Mark says this is a path problem and sound to me that you need to update the config file to include the volume as part of the path.
Try this.

Run Monkey in Yosimite and open the config.macos.txt file. Never open this file with the text editor that comes with Mavericks or Yosimite, unless you have turned off smart quotes and dashes etc.

Open Finder and navigate to where ANT is located on the Mavericks partition. NOTE that you may have to turn on the show hidden files and directories feature if they are in the /usr directory etc.
When you turn on show hidden files and directories, and open the what should be the hard drive for Yosemite, you will see a directory called Volumes. It is here where you will find mounted devices such as hard drives and Network Attached Storage devices.

Add new path variables to the config.macos.txt file by right clicking the directory of where ANT etc resides, and select 'Get Info'. In the dialog in the general section, it should give you the full path. You should be able to copy and paste this.
After making the changes, save the file and restart Monkey.


Steve Oliver(Posted 2014) [#7]
@marksibly

When I type 'ant' at the terminal prompt I get:
Buildfile: build.xml does not exist!
Build failed

and if I display my path it is:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/me/adt-bundle-mac-x86_64/sdk/platform-tools/:/Users/me/apache-ant-1.9.4/bin/


Steve Oliver(Posted 2014) [#8]
@dawlane

Thank you for the detailed reply!

I'm not sure why I would need to edit config.macos.txt file if I'm using the same Ant directory under both Mavericks and Yosemite? and the same Monkey installation?

Just to be sure, I did open config.macos.txt in Monkey and re-saved it, and re-started Monkey. I'm using the same user directory (not a new one under Yosemite).

As another check, in terminal if I cd $HOME/apache-ant-1.9.4 it opens up the ant directory. $HOME/apache-ant-1.9.4 is what I have set in my config.macos.txt


Steve Oliver(Posted 2014) [#9]
Has anyone been able to build to Android under Yosemite?

I wonder if this is an issue with my particular setup, or a general issue with Yosemite. If someone has it working, please let us know.


Danilo(Posted 2014) [#10]
Has anyone been able to build to Android under Yosemite?

I remember having such problems back when I installed everything month ago, using Mac OS X Mavericks (10.9.x).

The problem for me was, newer versions of Java are 64bit only, and there was an incompatibility
with a build-tool that requires 32bit Java.
I found out about it by starting some of the involved build commands at command line.
So I deleted all newer versions of Java (1.7.x) from /System/Library/Java/JavaVirtualMachines/ and installed only
Java JDK version 1.6.0.jdk there. Since then, everything works fine for me, with Mavericks (latest 10.9.5 now).

Could it be the same issue with your Yosemite? I don't use it, as it is not final yet. The problem just
sounds familiar to me, so I thought I tell you anyway... ;)

EDIT:
The version I had to install was: Java for OS X 2014-001


dawlane(Posted 2014) [#11]
Steve Oliver wrote
Post 4
So just to be clear, I didn't change anything about my Monkey install at all. I kept it the way it was in Mavericks, and installed Yosemite to another partition. When I boot to the Yosemite partition, I am still using the same Monkey install.
This to me, is that you're saying that you are trying to access the Monkey installed on the Mavericks Partition while you are booted into Yosemite. Hence the detailed in post 6.
Post 8
I'm not sure why I would need to edit config.macos.txt file if I'm using the same Ant directory under both Mavericks and Yosemite? and the same Monkey installation?

Just to be sure, I did open config.macos.txt in Monkey and re-saved it, and re-started Monkey. I'm using the same user directory (not a new one under Yosemite).
The last bit "I'm using the same user directory (not a new one under Yosemite)" tells me that you should need to use a full absolute paths to the executables directory found on the Mavericks partition with no system variables in your config.macos.txt file; unless you have set up the $HOME variable in Yosemite to point to the user directory in Mavericks. Also make sure the you have the JDK installed in Yosemite.

@Danilo: Never had a problem with installing JDK 1.7.x on Mavericks. The only issue that could arise is using the NDK.


marksibly(Posted 2014) [#12]
Ok, I am getting the same problem here on my home Mac! Ant is there, config file is correct and I only have one partition - and it *used* to work. Will look into it very soon.


marksibly(Posted 2014) [#13]
Weirdly, ant now appears to require a full path when executing it via system() - it's not just enough to be in the current dir and execute "ant". It used to be, but yosemite must have changed something.

Anyway, seems to be fixed here now, will upload a new version tomorrow.


dawlane(Posted 2014) [#14]
Could it be possible that they have strengthened the "Do not execute unsigned programs" feature? It may be worth it to see if any thing has cropped up in the beta test forums about execution of user installed tools.


Brucey(Posted 2014) [#15]
Perhaps "." is not in $PATH ?
As a test you could try "./ant" in the system call to see if it picks it up from the current dir.

That's the only reason I can see why you wouldn't find something in the current dir.


Pellegrinetti(Posted 2014) [#16]
I upgrade today my 2 mac to yosemite... and have the same problem with ANT (ant not found)... and the problem also occurs with flash target (mxmlc not found)


dawlane(Posted 2014) [#17]
Well I have finally got round to installing Yosemite. There has definitely been a major change.
I didn't do a clean install, just the upgrade and opening app bundles in the normal way results in the ant not found problem.
But if I open the the Ted binary directly (right click the app bundle Show Package Contents, Contents\MacOSX\, it works as it should, as does building from the command line.
I will see what happens when I do a clean install.


dawlane(Posted 2014) [#18]
OK looks like Apple have changed the way the launch service works.
If you want a quick and dirty way to get your application work then open up the Applescript editor and past the code below.
set MONK_PATH to POSIX path of ((path to me as string) & "::") & "bin/Ted.app/Contents/MacOS/Ted "
do shell script MONK_PATH & " > /dev/null 2>&1 &"

Save this as an app bundle in your MonkeyX root directory. I haven't figured out yet on how to pass files to the app script bundle yet.

@Mark: Not too sure of whats going on, but it looks to me like that when the Execute function is being called that the PATH variable is being reset when it calls an external process like ant.
In stead of building the transcc paths and then placing them back as PATH. I set it a a new environment variable TRANS_PATH and over rode the PATH variable when calling ant.
PATH=$TRANS_PATH && ant
This so far is working


Steve Oliver(Posted 2014) [#19]
Android api 10 is now working on Mac OS X Yosemite with Monkey 81b.

Thanks, Mark!


jjunior(Posted 2014) [#20]
Hello, I solved this problem in Yosemite, installing Apache Ant via MacPorts and creating a symbolic link in the folder /bin

cd /bin
sudo ln -s /opt/local/share/java/apache-ant ant