Can I make Objective-C/Cocoa command-line text-mode applications?

Discussion in 'Mac Programming' started by printz, May 2, 2013.

  1. printz, May 2, 2013
    Last edited: May 2, 2013

    printz macrumors regular

    Dec 23, 2012
    When I start a new Xcode command-line tool project, I'm limited to choosing between C or C++. Is it impossible to use Cocoa to make command-line applications?

    EDIT: well, since not everything Objective-C is Cocoa (there's also Foundation, with arrays, strings and such), I believe I can totally do it, since there's nothing forbidding C++ from coexisting with Objective-C… I'll just limit my audience to OS X and (I think) GNUStep by doing this.
  2. lloyddean macrumors 6502a

    May 10, 2009
    Des Moines, WA
    According to some folks around here I'm not to bright and I can do it so in all likely hood so can you!
  3. Catfish_Man macrumors 68030


    Sep 13, 2001
    Portland, OR

    "Foundation tool" is the Xcode template for a command line Cocoa program. You're also not limited to just what Xcode has templates for.
  4. ytk macrumors regular

    Jul 8, 2010
    You can make a graphical Cocoa application that runs as a console program if you really want. There's nothing stopping you. The GUI part will just run under Terminal (assuming there's a GUI available—i.e. you're not in single user mode or logged in over SSH) and you'll probably have to do most of the lower-level window management stuff that is normally provided for you when you build an application. That's why you never really see it—it requires a lot of extra effort for something that it doesn't really make sense to do.

    So that said, if you just want to build a console application that operates strictly in text mode using Cocoa for some reason, you can certainly do it.

Share This Page