How Do I Create Applications/Programs for OSX?
March 17, 2006 12:18 AM   Subscribe

I would like to start developing programs/apps for Apple's Mac OSX, I have no experience at all with anything like this. Nor do I have any knowledge of the terminology or tools used, please help me work my way up from the very bottom. Including tutorials for beginners or anything you would think help me start my journey into the unknown. A couple of examples of the type of programs I am inspired by are Clutter and Noise. Both for OSX. Let me know if you need anymore information from me. Thanks!
posted by Building to Education (28 answers total) 1 user marked this as a favorite
 
http://developer.apple.com/gettingstarted/

Although even that might be too low-level for you. Have you ever done any kind of programming at all? Even simple AppleScripts? Messed around with HTML? (Do you even know that much terminology?)

It's difficult to know where to start, since you haven't given us any idea what you DO know. There's a continuum from "knows how to find the power button" to "expert kernel hacker", and you must be somewhere on there...
posted by xil at 12:27 AM on March 17, 2006


Also keep in mind that programming is a craft, and there's a whole culture that has built up around it. You have to learn the technical side of things, but you also have to learn the cultural things -- where to find information and how to get help, at the very least.

And like jumping into any new culture, it's likely to be frustrating for a while. There's a whole cultural context that's difficult for outsiders to understand AND difficult for insiders to explain coherently.
posted by xil at 12:34 AM on March 17, 2006


Response by poster: Very good point, a few years ago I did give some HTML a go, but that was a few years ago. I've never worked with apple script. I've attempted blogging and use an RSS reader, haha.
I consider myself capable of learning very fast, even though I'm not expecting to be an instant wiz; I think I’d be ok diving in. Is this a false hope?
I really appreciate the link above too.
posted by Building at 12:35 AM on March 17, 2006


Master this language young turtle, and then come back and ask again.
posted by nonmyopicdave at 1:01 AM on March 17, 2006


I asked a similar question, view the thread here
(And, ultimate procrastinator that I am, i'm no further. bleh.)
posted by slater at 1:01 AM on March 17, 2006


if you're serious about this, it's going to take a long time and a lot of work to get to the point where you can write software that does neat things in a graphical user interface like OSX.

some rough steps:

0. download and install the Xtools package on your mac. this will install a whole buttload of software-development stuff that you'll need later. (btw, first lesson - when programming, start counting at 0, not 1)

1. learn to program in a simple language like C in a simple environment like unix. you can do this on your mac via the terminal window. get a book about c that will hold your hand, something like this or this.

these books will probably be oriented for a windows user but it should translate no problem since at this stage you're probably only going to deal with text. instead of using borland or visual C, use the "gcc" command in your terminal window. that will get installed when you install Xtools.

while you're at it, pick up a book on unix like this or this. (i have that last one and it's quite good.)

there's also lots of good free information out there, for example if you google:c tutorial.

2. once you've gotten good at C, move on to C++, which is like C but is object-oriented, which is how most GUI software is written. get another book, "learn C++ in 12 minutes!" and work through that. you'll still be dealing with text but learning about objects and concepts that are relevant to a graphical interface.

3. if you've figured object-oriented programming you're probably ready to dive into the apple stuff. at this point, come back to AskMe and ask this question again and you'll probably get some good pointers; or follow xil's link and start reading.

expect this process to take a long time and be a lot of work. people don't start writing GUI code overnight. the people who wrote the software you named probably have been programming for years and years!

that said, learning how your computer works and being able to make it do exactly what you want is very rewarding, empowering and makes you useful++. go for it!
posted by sergeant sandwich at 1:17 AM on March 17, 2006


whoops, i meant Xcode Tools, not Xtools. sorry.
posted by sergeant sandwich at 1:19 AM on March 17, 2006


Response by poster: Incredible information!
Is there a convenient way to learn more about those components and how they interact with one another (i.e Unix and C) or should I just try the old google and read until i die.
I'm willing, I'm willing!

p.s. this is the first question ive asked on metafilter, its unreal how helpfull and knowledgeable all of you are, i hope i can be an asset as well.
posted by Building at 1:47 AM on March 17, 2006


I disagree strongly that you should start with C and unix (and for god's sake not C++.) Those are incredibly dense and low-level languages and concepts. If you wanted to learn carpentry you start by building a spice rack or a bird house, you don't start by tackling the job of adding a deck or replacing your home's foundation.

Try writing a couple of simple scripts in python or ruby first. Don't even think about the GUI part yet, just get your feet wet.
posted by Rhomboid at 1:55 AM on March 17, 2006


Rhombold is absolutely right. Start with something like python, then move on to learning Objective-C, and not C or C++. (Pick up a good book on learning python too - I'm sure someone else can recommend one but I never learnt python myself - I know it only by it's excellent reputation)

The reason behind not learning C or C++ is that C++ will teach you to use the object orientation of C++ and not that of Objective-C which is behind much of OS X programming, and learning just straight C will lead you down the path of learning much low-level stuff that is unlikely to be necessary if you're using Objective-C. Pick up a book on Cocoa programming from O'Reilly or someone like that at this stage, and they'll take you through the steps on this. Cocoa is a layer on Objective-C for OS X programming and the two are often taught together.

If you later want to go and expand on your skills and learn C++ that's great, and you can roll the two together into Objective-C++ but you're just starting out and shouldn't dive in too deep.

An alternative path might be to learn Java in place of Objective-C and its sister languages, but if your focus is definitely on OS X then Objective-C is most likely the language you're aiming to ultimately learn.
posted by edd at 2:08 AM on March 17, 2006


I also want to point out that the time-honored way that I suspect the majority of people get their first experience with programming is not by building something from scratch on their own, but by taking some existing piece of code and modifying it in some way. This can result in a greater emotional reward, because at the very first stages of beginning it's very hard to write anything substantial from scratch since you just don't have the concepts in place yet. But it is possible to add some feature or modification that is based on this existing framework.

There are some cautions about this method though:
  • As opposed to learning from scratch from a rigorous tutorial or book, you will not be exposed to as many "hows and whys" of the language and so many things will just seem strange and arbitrary without the background explanation.
  • Many aspects of the design of this existing script/application/whatever will be completely opaque and mysterious to you, because they are likely to have used more advanced methods or techniques than you are familiar with.
  • You may end up spending way too much time puzzling over something that should be trivial, or going about tasks in the wrong way.
  • You will pick up the style and habits of the code project that you learned from -- if you choose carefully this can be a good thing, but in many cases this means picking up bad habits.
Because of these factors, I suggest that you combine aspects of both. Get a book or tutorial that will lay out the fundamentals of whatever language or system you're trying to learn. At the same time, make sure you poke around in existing code of that system so that you are not trying to build everything up from scratch (and getting frustrated at your lack of ability to make anything nontrivial.)
posted by Rhomboid at 2:17 AM on March 17, 2006


I said this in the other thread, but basically I learnt to program Macs by spending a week studying this document. Though I recommend you learn the basics of programming first. PHP is a good place to do that.
posted by cillit bang at 2:38 AM on March 17, 2006


Again, Rhomboid is spot on. When you install XCode you should get a number of Apple's example applications. These will be very handy as examples because they'll be written the 'right' way and will be well commented.
posted by edd at 2:39 AM on March 17, 2006


good book on learning python

Dive Into Python is terrific and available for free online.
posted by yerfatma at 6:34 AM on March 17, 2006


I would play around with a scripting language first: perl or php or even javascript or applescript. Once you understand variables and the basic control structures and how functions work you'll have a strong base for learning OOP, whichever language you choose.
posted by miniape at 6:43 AM on March 17, 2006


Rhombold is right on.

Learn Ruby or Python first, so that you can master basic programming concepts, and then move on to Objective-C.

Applescript is a confusing and tempermental language and is not a good starting point for non-technical people who want to learn programming.

C, C++, or Java are great and deep, but not necessary for what you want to do, and the profound differences between C++ and Objective-C will only serve to frustrate you.
posted by bshort at 7:35 AM on March 17, 2006


I did it with XCode and Cocoa, by reading docs given in that first link.

I had a working program in a day. BUT, I've been programming since I was 10, already knew C, C++ and IDEs, and had experience navigating complex systems with documentation.

But you could do it too, if you have some programming experience. If not, check out Programming in Objective C, which tries to teach you object-oriented programming and C and Objective C all in one go.

And use Cocoa, rather than Carbon or Java (assuming you want GUIs -- if it's just command line stuff you want, just use C).
posted by teece at 8:27 AM on March 17, 2006


Python is an excellent choice for a first language, if only for the reason that you already have it. OS X uses python for large number of tasks. You can run it from the Terminal program by typing "python".

There is a pointer to the online python tutorial available by typing "help" once you've started python. I must admit that I've never worked through that tutorial, but I trust in Guido to have gotten it right.
posted by tkolar at 9:38 AM on March 17, 2006


I'll just add another vote for learning a scripting language first (Python is my favorite; PHP would be useful if you wanted to do some web applications but less useful for introducing you to object orientation), then moving on to Objective-C with Cocoa. C can be useful, but you can get to that later -- it's not necessary at all, and much of what you'd learn from an average C tutorial will be irrelevant to Mac programming with Cocoa. C++ will be useful only if you need to modify someone else's code or port something to Windows (and maybe not even then).

I'll also second the recommendation of Dive Into Python as a good first programming primer. If you buy a book on Cocoa programming, make sure it doesn't assume that you already know C or Objective-C, and also try to get something pretty recent -- check the first two chapters or so: if it mentions Project Builder it's a bit out of date; if it mentions XCode it's recent enough. Cocoa Programming for Mac OS X (Second Edition), by Aaron Hillegass, might do the trick.
posted by Acetylene at 9:48 AM on March 17, 2006


By the way, I want to echo what some others have said about GUI programming being an advanced topic. Master a script language first.

For what it's worth, I do all my GUI programming in Java. Objective-C has a much tighter integration with MacOS X (e.g Cocoa), which means that it's easier to make pretty things happen, but that the final product will only run on the Mac.
posted by tkolar at 9:48 AM on March 17, 2006


One last note on using python on the Macintosh: The Terminal program gives you a Unix prompt. If you are working in the Terminal program, then any place that a tutorial mentions "Unix", that applies to you.
posted by tkolar at 9:55 AM on March 17, 2006


I'm going to be a dissenter and say: you do not need to learn a scripting language first. Bah.

Programing is programming. The language is a detail. C is not a complicated language (memory management is complicated in C, because it's almost like the computer handles it, but you don't need C memory management in Objective C, so you can ignore that). Unlike python, you are going to have to learn C if you want to program for the Mac. Programming for the Mac is GUIs. Command line programming and scripting is Unix, which you can do on the Mac, but it's not what I would think of as "programming for the Mac."

I think the most direct route is to learn C, particularly the subset that you'll use frequently with Obj-C and Cocoa (which is what the book I linked above tries to teach you). It's the core of Objective C, it's not hard, and there are billions and billions of resources on it. You're going to need it anyway, so why not start there?
posted by teece at 11:28 AM on March 17, 2006


I'm somewhat in the same situation that you are, though I know more than a thing or two about XHTML and CSS, plus I can write a very basic shell script; but those haven't really helped so far, they've just taken away the initial fear of looking at code.

What I've been doing is looking at an open-source implementation of the kind of program I'd like to write, then going line by line, googling all the way, trying to figure out what it all means. It's extremely slow-going, but it's going nonetheless. If you try this method, I'd suggest that you not rush ahead. Be methodical. Be aware that programming languages are artificial and have faith that they're designed to make sense logically. I'm sure they probably have their quirks, but it's not like learning, say, French. If there's an "s" at the end of a word in a programming language, it's pronounced damn it.
posted by bitpart at 12:29 PM on March 17, 2006


I'm sure they probably have their quirks, but it's not like learning, say, French.

Spoken like a man who has never coded in assembly language. At least reading four letters of misaligned French won't cause you to roll over and die.
posted by tkolar at 1:58 PM on March 17, 2006


teece writes...
You're going to need [to learn Objective-C] anyway, so why not start there?

All right, I bite.

C is all fun and games until pointers come along and bite you in the ass. Pointers are hard enough for students who already know how to code -- trying to teach them simultaneously with basic coding is suicide.

As you say, for the most part which programming language you use is just a detail. So if you're going to learn how to program, wouldn't it be better to pick a language that doesn't contain huge pitfalls for the uninitiated? You can learn to program without getting bogged down in deeply frustrating complexities, and all of your new-found skills will transfer directly to the more powerful languages when you want to move over.

Remember, all of the basic things: if-thens, for-loops, variables, functions, return values -- are still unknowns to Building. Best to learn those in the simplest environment possible, and then move on to event loops and mouseClickHandlers afterwards.
posted by tkolar at 2:14 PM on March 17, 2006


C is all fun and games until pointers come along and bite you in the ass. Pointers are hard enough for students who already know how to code -- trying to teach them simultaneously with basic coding is suicide.

Right -- but you don't even need pointers to program in Objective C, really, and you can skip right over those. That's what I was getting at with the memory management comment.
posted by teece at 6:09 PM on March 17, 2006


I really think people are underestimating how easy Objective C and Cocoa are to use.

It's a damn good development platform. I've never written easier GUIs, and I've played around with MFC, Borland whatever it was, QT, and GTK+. The subset of C you really need in Objective C kills the major pitfalls that C has (pointers and memory management), and adds a very simple, very elegant object-oriented framework.

I've read about Mac programers that went from zero knowledge of programming to award-winning commercial software in a couple of years with Cocoa and Objective C. It can be done, and if Mac programs are your goal (which really implies GUIs), just jump in and get going.
posted by teece at 6:14 PM on March 17, 2006


Well, I must admit a certain amount of my distaste for Xcode comes from my personal experiences trying to get it to recognize third party JAR files.

It's obviously got much better integration for Objective C with Cocoa. I agree that Xcode with IB is easy to use for basic GUIs.

However...
[Y]ou don't even need pointers to program in Objective C

You don't need pointers to program in ANSI C either. They're just the right tool for a large number of jobs and for that reason are taught as part of the language. Perhaps if Building can find a tutorial on C that never mentions pointers, he'll be in business.
posted by tkolar at 7:58 PM on March 17, 2006


« Older Looking for coffee shops in the greater los...   |   Recommend me some good Elephant6 Collective music Newer »
This thread is closed to new comments.