Skip to main content
Participant
February 1, 2012
Answered

cfexecute and Terminal.app

  • February 1, 2012
  • 1 reply
  • 2557 views


I am trying to access ffmpeg using coldfusion. I can do it on a windows machine with no problem, however for this project I have to use a mac OS X Lion.

Changing the code for the different operating system, the process works except for trying to use cfexecute. I didn't include any arguments in the following code since it won't get that far anyway.

Line of code:
<cfexecute name="/Applications/Utilities/Terminal.app" variable="cfexDump" timeout="5" />

The error:
The cause of this exception was that: java.io.IOException: Cannot run program "/Applications/Utilities/Terminal.app": error=13, Permission denied.

There's only one user on this machine (JP), and I have admin permissions.

Is there something I'm missing? Some way of allowing coldfusion permission to access Terminal?

If not, is there another software for Mac OS X that works like the Command Prompt (cmd.exe) in windows?

This topic has been closed for replies.
Correct answer Sean Coyne

On a Mac anything with a .app extension is NOT actually an executable file.  It is actually just a directory.  Its a special directory that Mac OS X knows how to handle, but to CF, its just a directory.

That said, you can simply right click on any .app item on a Mac and choose "Show Package Contents" which will open the directory and show you the files inside.  For Terminal.app do this then go into the Contents/MacOS directory and you will see an executable called Terminal.

So, to run this with cfexecute (why you would want to do this is a whole different discussion as running this is really not going to give you much info) all you have to do is change your cfexecute tag to:

<cfexecute name="/Applications/Utilities/Terminal.app/Contents/Terminal" variable="cfexDump" timeout="5" />

That should work, assuming you have the proper permissions.  But, of course, you cannot execute a directory so that is why ColdFusion is throwing an error.

1 reply

Sean Coyne
Sean CoyneCorrect answer
Participating Frequently
February 1, 2012

On a Mac anything with a .app extension is NOT actually an executable file.  It is actually just a directory.  Its a special directory that Mac OS X knows how to handle, but to CF, its just a directory.

That said, you can simply right click on any .app item on a Mac and choose "Show Package Contents" which will open the directory and show you the files inside.  For Terminal.app do this then go into the Contents/MacOS directory and you will see an executable called Terminal.

So, to run this with cfexecute (why you would want to do this is a whole different discussion as running this is really not going to give you much info) all you have to do is change your cfexecute tag to:

<cfexecute name="/Applications/Utilities/Terminal.app/Contents/Terminal" variable="cfexDump" timeout="5" />

That should work, assuming you have the proper permissions.  But, of course, you cannot execute a directory so that is why ColdFusion is throwing an error.

Participant
February 1, 2012

Thanks for that! I had to add /Contents/MacOS/Terminal/" but it works.

What a headache.

Sean Coyne
Participating Frequently
February 1, 2012

Sorry, yeah, my fault for the error in the example code.  Glad you got it working.