Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Binju

macrumors member
Original poster
I create a cocoa application using xcode and i build it.

But i want to run the app from the terminal?

How to run an app from terminal?
 
What command are you running?

And what is the name of your app (is it a compiled as a .app?) and where is it located?
 
Even if it's not the best option, you can 'cd' into the filename.app folder and find the executable inside "filename.app/Resources/MacOS/" ( or around there ) folder and run it.

In the end, Finder shows the *.app file as a program but it's really a folder with the resources and the executables packed into.
 
Is it possible to pass the parameter with the open command in the terminal

For example,I need to play a song in a player,The songs list should come from a playlist.playlist so the playlist.playlist is a parameter of my app

So i need to pass
Code:
open filename.app playlist.playlist
 
Is it possible to pass the parameter with the open command in the terminal

For example,I need to play a song in a player,The songs list should come from a playlist.playlist so the playlist.playlist is a parameter of my app

So i need to pass
Code:
open filename.app playlist.playlist

Code:
man open
answers all!

Edit: I'm feeling nice. Use:
Code:
--args
 
[ Use:
Code:
--args
[/QUOTE]


ok.

So the code is
Code:
open filename.app --player.playlist

How can I get the player.playlist in to my application
 
I wrote an application that plays the playlist from the resources of the application

What i want to do is , I need to play the playlist from some particular path

So if i give

Code:
open filename.app --args user/me/Player.playlist
in the terminal

My app should play the playlist from the user/me/Player.playlist.

If I give the above command in the terminal,myapp is opened and play the playlist in the resource.

But I dont know how to say to my app to take the playlist path specified in the terminal

Any idea?
 
Try a Google search for "Cocoa application handle command line arguments". The very first result will tell you one option for getting the command line arguments in Cocoa.
 
When i run my app from terminal , In the console it does not display anything.

Why?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.