Code for Terminal in Obj-C?

Moderator
Posts: 697
Joined: 2002.04
Post: #1
As the title to the thread suggests, I'm just wondering if it is possible to code for the Terminal using Obj-C? If so, how? I'm not interested in using Cocoa, I'm just interested in learning Obj-C by hacking together a few toy projects...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Moderator
Posts: 508
Joined: 2002.09
Post: #2
Can you explain your question a bit better? Do you mean you want to make apps in the Terminal, or expand the Terminal app?

In the later case I don't think that's possible, unless it supports something like AppleScript. However you can expand the shell by writing some unix scripts, but that is usually in some language like bash or something, not objective C.

"When you dream, there are no rules..."
Quote this message in a reply
Moderator
Posts: 697
Joined: 2002.04
Post: #3
Sorry for the confusion; to clarify, I'm looking to code apps which may be run in the Terminal, much like you'd code a C/C++ Tool, just in this case coded in Obj-C...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #4

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Member
Posts: 168
Joined: 2004.10
Post: #5
Surely you just create a new project with the cocoa foundation framework in xcode for Objective - C command line apps?

Unless you want the command like GCC that is. I believe the command to compile objective - c is GCC Rasp
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #6
You can add the Appkit framework to the foundation framework to do NSImage or NSWindow stuff etc, but make sure you call NSApplicaitionMain() in the autorelease pool before trying it.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Moderator
Posts: 697
Joined: 2002.04
Post: #7
Thanks for that link unknown, 'twas very helpful Smile

Coming from a mostly-C++ background, Obj-C has the oddest syntax I've ever seen... Blink Oh well, at least I understand the fundamentals now; now to find a decent book on Cocoa...

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Member
Posts: 40
Joined: 2004.12
Post: #8
You don't even need to use Cocoa - it's just a framework.
I did a couple of projects in college using Obj-C and if I recall correctly it's pretty easy syntax to get used to.

Check out a website like http://www.toodarkpark.org/computers/objc/ to get a feel for basic tool and small program coding.

Cheers.

Jericho
Quote this message in a reply
Moderator
Posts: 697
Joined: 2002.04
Post: #9
seven Wrote:You don't even need to use Cocoa - it's just a framework.
That's why I stated, somewhere above, that I didn't want to use Cocoa – just Obj-C, to get a feel for the language Wink

Thanks for the link though, from a quick glance it seems to be one of the better tutorials Smile (I've a few dozen bookmarks to tutorials now, a few of which would have been better off unwritten...)

Mark Bishop
--
Student and freelance OS X & iOS developer
Quote this message in a reply
Member
Posts: 168
Joined: 2004.10
Post: #10
Just learn it through Cocoa, it's there and available to use without having to install GNU Step or what ever. I presume you do not want to learn the appkit until later though, foundation framework will cover Objective-C and a load of usefull stuff that is well supported in GNU step, unlike appkit.
Quote this message in a reply
Sage
Posts: 1,403
Joined: 2005.07
Post: #11
A lot of the Cocoa framework is really useful and somthing you will be dealing with a lot, Id suggest linking to the Foundation framework at least while learning. Because NSArray's and the like are what you really should be using most of the time.

Sir, e^iπ + 1 = 0, hence God exists; reply!
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #12
Learning ObjC without Cocoa is definitely pointless...
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #13
OneSadCookie Wrote:Learning ObjC without Cocoa is definitely pointless...

I'd say Foundation is a necessity, but I wouldn't agree that you need to learn the AppKit portion of Cocoa if all you want to write is terminal-based apps.
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #14
I wasn't trying to imply that you needed to learn AppKit...
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #15
OneSadCookie Wrote:I wasn't trying to imply that you needed to learn AppKit...

I didn't think you were... I just figured I'd remind everyone that Cocoa == Foundation + AppKit (+ CoreData if you're talking about Tiger)
Quote this message in a reply
Post Reply