Beginning Mac OS X Programming

Overview

Beginning Mac OS X Programming

Every Mac OS X system comes with all the essentials required for programming: free development tools, resources, and utilities. However, finding the place to begin may be challenging, especially if you have no prior development knowledge. This comprehensive guide offers you an ideal starting point to writing programs on Mac OS X, with coverage of the latest release - 1.4 "Tiger."

With its hands-on approach, the ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (28) from $1.99   
  • New (10) from $3.95   
  • Used (18) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$3.95
Seller since 2010

Feedback rating:

(123)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
0764573993 NEW

Ships from: Curtisville, PA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
$3.95
Seller since 2009

Feedback rating:

(2271)

Condition: New
PAPERBACK New 0764573993 Ships Within 24 Hours. Tracking Number available for all USA orders. Excellent Customer Service. Upto 15 Days 100% Money Back Gurantee. Try Our Fast! ! ... ! ! Shipping With Tracking Number. Read more Show Less

Ships from: Bensalem, PA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$7.82
Seller since 2010

Feedback rating:

(858)

Condition: New
PAPERBACK New 0764573993 Friendly Return Policy. A+++ Customer Service!

Ships from: Philadelphia, PA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$7.82
Seller since 2013

Feedback rating:

(343)

Condition: New
PAPERBACK New 0764573993! ! KNOWLEDGE IS POWER! ! ENJOY OUR BEST PRICES! ! ! Ships Fast. All standard orders delivered within 5 to 12 business days.

Ships from: Southampton, PA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$7.82
Seller since 2011

Feedback rating:

(665)

Condition: New
PAPERBACK New 0764573993 SERVING OUR CUSTOMERS WITH BEST PRICES. FROM A COMPANY YOU TRUST, HUGE SELECTION. RELIABLE CUSTOMER SERVICE! ! HASSLE FREE RETURN POLICY, SATISFACTION ... GURANTEED**** Read more Show Less

Ships from: Philadelphia, PA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$7.82
Seller since 2014

Feedback rating:

(239)

Condition: New
PAPERBACK New 0764573993 XCITING PRICES JUST FOR YOU. Ships within 24 hours. Best customer service. 100% money back return policy.

Ships from: Bensalem, PA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$7.82
Seller since 2010

Feedback rating:

(640)

Condition: New
PAPERBACK New 0764573993! ! ! ! BEST PRICES WITH A SERVICE YOU CAN RELY! ! !

Ships from: Philadelphia, PA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$31.98
Seller since 2008

Feedback rating:

(276)

Condition: New
0764573993 New item in stock, may show minimal wear from storage. May have remainder mark. I ship daily and provide tracking! 100% Money Back Guarantee!

Ships from: FORT MYERS, FL

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$31.98
Seller since 2013

Feedback rating:

(3)

Condition: New
PAPERBACK New 0764573993 New item in stock, may show minimal wear from storage. May have remainder mark. I ship daily and provide tracking! 100% Money Back Guarantee!

Ships from: LEHIGH ACRES, FL

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$51.71
Seller since 2014

Feedback rating:

(5)

Condition: New
Brand New US edition as listed. FRESH! We ship promptly with good, sturdy packaging! Ask for JR with any product questions!

Ships from: Stone Mountain, GA

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Beginning Mac OS X Programming

Every Mac OS X system comes with all the essentials required for programming: free development tools, resources, and utilities. However, finding the place to begin may be challenging, especially if you have no prior development knowledge. This comprehensive guide offers you an ideal starting point to writing programs on Mac OS X, with coverage of the latest release - 1.4 "Tiger."

With its hands-on approach, the book examines a particular element and then presents step-by-step instructions that walk you through how to use that element when programming. You'll quickly learn how to efficiently start writing programs on Mac OS X using languages such as C, Objective-C(r), and AppleScript(r), technologies such as Carbon(r) and Cocoa(r), and other Unix tools. In addition, you'll discover techniques for incorporating the languages in order to create seamless applications. All the while, you can follow along on your own system so that you'll be prepared to apply your new Mac OS X skills to real-world projects.

What you will learn from this book

  • The major role the new Xcode plays in streamlining Mac OS X development
  • The process for designing a graphical user interface on Mac OS X that conforms to Apple's guidelines
  • How to write programs in the C and Objective-C programming languages
  • The various scripting languages available on the Mac OS X system and what tasks each one is best suited to perform
  • How to write shell scripts that interact with pre-installed command-line tools

Who this book is for

This book is for novice programmers who want to get started writing programs that run on Mac OS X. Experienced programmers who are new to the Mac will also find this book to be a useful overview of the Mac development environment.

Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.

Read More Show Less

Product Details

  • ISBN-13: 9780764573996
  • Publisher: Wiley, John & Sons, Incorporated
  • Publication date: 7/11/2005
  • Series: Programmer to Programmer Ser.
  • Edition number: 1
  • Pages: 720
  • Product dimensions: 7.42 (w) x 9.28 (h) x 1.56 (d)

Meet the Author

Michael Trent has been programming in Objective-C since1997 and programming Macs since well before that. He is a regular contributor to Steven Frank’s www.cocoadev.com website, technical reviewer for numerous books and magazine articles, and occasional dabbler in Mac OS X open source projects. Currently, he is using Objective-C and Apple Computer’s Cocoa frameworks to build professional and consumer applications for Mac OS X. Michael holds a Bachelor of Science in Computer Science and a Bachelor of Arts in Music from Beloit College of Beloit, Wisconsin. He lives in Pittsburgh, Pennsylvania, with his family.

Drew McCormack has a Ph.D. in Chemical Physics and works as a computational scientist in the Theoretical Chemistry group at the Free University in Amsterdam. He is involved in developing the Quantum Chemistry software ADF (www.scm.com), which is run the world over on computers ranging from desktop Macs to massive supercomputers. He programs regularly in Python, C++, Objective-C, Fortran, and Bash, and in his spare time develops the Cocoa financial software Trade Strategist (www.trade-strategist.com). Drew maintains the Maniacal Extent website—a reference to the chaotic dimension, time—which details his various interests and activities (www.maniacalextent.com).

Read More Show Less

Read an Excerpt

Beginning Mac OS X Programming


By Michael Trent

John Wiley & Sons

ISBN: 0-7645-7399-3


Chapter One

The Mac OS X Environment

Welcome to the wonderful world of Mac OS X, the next-generation operating system from Apple Computer!

The Mac OS X operating system powers modern Macintosh computers. After many long years and a few scrapped attempts to modernize the older Mac OS operating system, Apple released Mac OS X in April of 2001. Since then, Apple has released a steady stream of upgrades and system updates. This book was written around Mac OS X version 10.4, "Tiger," the latest version.

In order to write software for Mac OS X, you need to know your way around the system. By now you may already be familiar with Mac OS X's applications and user interface style. Those things all rest on top of a number of subsystems and services that make up the Mac OS X operating system.

In this chapter you learn

How the Mac OS X operating system is structured, including what the major areas of the system are and how they work together

How to use Mac OS X's command-line interface How applications take advantage of the operating system services on Mac OS X

How Apple encourages a common look and feel for Mac OS X applications

Introducing the Mac OS X

What comes to mind when you think of Mac OS X? Is it the applications you use? Perhaps you recall Mac OS X's distinctive user interface? Or maybe you think of Mac OS X's stability? In truth, Mac OS Xembodies all these things.

The Mac OS X operating system is often described as a collection of layers, as seen in Figure 1-1. You are probably already familiar with the topmost layer: the applications that run on Mac OS X (like Mail, iTunes, Safari, and so on). These applications are all written against a collection of application frameworks. These frameworks are special libraries that provide the code and all the other resources (icons, translated strings, and so on) to perform common tasks. For example, the Cocoa framework contains a number of resources necessary to make a Cocoa application.

All Mac OS X applications use graphics to some extent, ranging from simply presenting its user interface to processing graphical data like QuickTime movies. The system provides several specialized libraries for working with graphics and graphics files.

These layers rest on the broad shoulders of the core operating system, which at the lowest level is responsible for making your Macintosh run. For example, the core OS handles reading from and writing to your hard drive and random access memory (RAM), it manages your network connections, it powers down the computer when it falls to "sleep," and so on. In fact, any program that talks to your hardware in any way ultimately goes through the core OS.

Throughout this book you examine Mac OS X in detail through Slide Master, an application that builds and displays photo slide shows. You will build Slide Master bit-by-bit as you learn more about how the elements of Mac OS X come together. The Slide Master application and its source code can be downloaded from Wiley's website; so you can check your work against our complete solution as you go.

This is a good time to take a quick tour of Slide Master. You can download Slide Master from Wiley's website, make a slide show, and view your handiwork. In doing so, you touch on all the major areas of the Mac OS X operating system.

Try It Out

Slide Master

1. Download the files for this chapter from wrox.com. Refer to the Introduction for instructions on finding the files you need from the Wrox website. You can search for the book by its ISBN number: 978-0-7645-7399-6. You are looking for a file named Chapter01.zip.

2. Uncompress the Chapter01.zip archive using your favorite decompression tool. (Mac OS X 10.3 and later supports uncompressing .zip files directly in the Finder.) Inside you will find the Slide Master application, a folder of pictures called Images, and a folder of source code.

3. Run the Slide Master application by double-clicking it in Finder. The application opens an untitled document window.

4. Add the pictures in the Images folder to Slide Master by choosing Slide Show [right arrow] Add Slide. You can select all the files at once from the open panel. The images appear in a drawer to the side of the document window and the main window displays the selected image, as shown in Figure 1-2. You can use the arrow keys to change the selection.

5. Export a slide show as a QuickTime movie by choosing File.Export. Slide Master writes out a QuickTime movie and opens it with QuickTime Player.

6. Save your document by choosing File.Save.

How It Works

Slide Master is a document-based application, which means that it provides a user interface for individual documents. In this case, documents are collections of slides that you can sift through and export as QuickTime movies. Slide Master documents can be opened, saved, and closed using the File menu. Other document-based applications also support printing, although Slide Master does not.

Much of the functionality you see here comes from Slide Master's application framework: Cocoa. The Cocoa application frameworks provide the implementation for the things you see on the screen: windows, pictures, menus, buttons, and so on. Cocoa also provides support for managing the document: reading and writing document files, closing the document when its window is closed, and routing menu commands to the selected document. Finally, Cocoa provides tools for storing application data, including working with user preferences and storing lists of items in memory.

Of course Slide Master uses QuickTime to generate movie files. You are probably already familiar with QuickTime, both through QuickTime Player and through web browsers that support the display of QuickTime movies. But QuickTime also makes most, if not all, of its functionality available to applications through its framework interface.

When you save a Slide Master document, the document file contains a list of image files that are part of your slide show, not the actual images themselves. As a result, these documents can be relatively small. Behind the scenes, Slide Master uses aliases to track these image files so that they can be found if the files are moved around on your disk. These aliases are the same aliases you can create in the Finder, although they are embedded in your document rather than saved separately to disk. Slide Master uses the Carbon application framework for working with aliases. Even though Slide Master is a Cocoa application, it can still access many of the services available in Carbon.

You learn more about Cocoa, Carbon, QuickTime, and other technologies later in this chapter, and as you proceed through this book.

The Core Operating System

The heart of Mac OS X is based on the Unix operating system. Unix was developed by AT&T in the early 1970s. In those days, computers were large and expensive, and Unix was intended as a way to share computing resources between multiple users at once. It was likely that an organization at that time could afford only one computer for all its members, and Unix provided a way for people to use that computer simultaneously without getting in each other's way.

Over the years, Unix development has split off into many distinct "flavors" of Unix, all headed up by different groups of people, all with somewhat different goals. BSD and Linux are two such examples. Each version of Unix shares some portion of the original vision and typically implements a common set of libraries and commands.

Unix is regarded as a robust operating system whose scalability and innate networking capability make it ideal for use as a server. In fact, most of the modern day Internet is powered by Unix servers of one version or another. It turns out that these features are also desirable in modern desktop operating systems. So it is no surprise when seeking to modernize the original Macintosh operating system, Apple turned to Unix.

Mac OS X's core operating system is a Unix flavor called Darwin. Like most Unix flavors, Darwin's source code is freely available, allowing interested parties to see exactly how the core operating system works. Apple maintains several resources for programmers interested in Darwin, including a way for people-at-large to contribute changes and bug fixes back to Apple.

Although Mac OS X tries to hide Darwin from the average user, there are some places where the Unix command-line pokes through. The most obvious example is the Terminal application, found in /Application/Utilities. You can use Terminal to work directly with Darwin's command-line tools. A more subtle example includes the way you describe file locations on Mac OS X: by using a file path. A file path is a string of text that describes a file's location.

The original Mac OS operating system abhorred file paths and tried its best to avoid them; but even so it devised a convention for describing a path to a file. Mac OS file paths are composed of a disk volume name followed by several folder names and possibly a file, all separated by colons, as in Macintosh HD:Applications:Utilities:Terminal.app.

Although there are places where this old convention still exists, Mac OS X mostly uses Unix's method of describing file paths: a series of directories from the root directory all separated by slashes, as in /Applications/Utilities/Terminal.app. The root directory contains all the files and directories on a Mac OS X system and is referred to simply as /. The path /Applications refers to a file or directory named Applications in the root directory. A path that begins with the root slash is called an absolute (or full) path because it describes a precise file location. If the root slash is not included, the path is called a relative path because it is relative to your current location.

If you look in /Applications/Utilities in the Finder, you might notice that there is no Terminal.app; instead there's just a program called Terminal. By default, Finder and other applications hide file extensions such as .app and .txt from you. So the application at /Applications/ Utilities/Terminal.app appears simply as Terminal. The Core OS makes no attempt to hide extensions from you; if you browse the file system using Mac OS X's command-line interface, you can see all these extensions. You learn more about Mac OS X's command-line interface later in this chapter.

Darwin is composed of several parts, including a kernel, a system library, and numerous commands, as illustrated in Figure 1-3.

The Kernel

The heart of a Unix operating system is its kernel. The kernel is the program that loads when the computer is first turned on and is responsible for managing all the hardware resources available to the computer. The kernel is also responsible for running the other programs on the system, scheduling process execution so that they can share the central processing unit (CPU) and other resources, and preventing one process from seeing what another process is doing. These last two responsibilities are more commonly known as pre-emptive multi-tasking and protected memory, respectively.

Because Unix prevents programs from accessing the computer hardware or other programs directly, it protects against the most common forms of system crashes. If a process misbehaves in one way or another, the system simply terminates the process and continues on its way. In other words, the misbehaving process crashes. In some operating systems, a misbehaving process can stomp all over other applications, or even break the operating system itself, before the system is able to terminate the process. As a result, poorly written programs can cause the entire computer to freeze or crash. Not so on Unix; because a process cannot modify other processes, including the kernel, there is virtually no risk of a bad process bringing down the entire operating system.

Although the kernel is responsible for accessing hardware, much of the knowledge of specific hardware details is delegated to device drivers. Device drivers are small programs that are loaded directly into the kernel. Whereas the kernel might know how to talk to hard disks, for example, in general, a specific device driver knows how to talk to specific makes and models of hard disks. This provides a way for third parties to add support for new devices without having to build it into Apple's kernel. Mac OS X includes default drivers for talking to a wide variety of devices, so much of the time you won't need to install separate drivers when you install new third-party hardware.

The System Library

The kernel is responsible for critical functions such as memory management and device access, so programs must ask the kernel to perform work on its behalf. Programs communicate with the kernel through an application program interface (API) provided by a special library. This library defines some common data structures for describing system operations, provides functions to request these operations, and handles shuttling data back and forth between the kernel and other programs. This library is simply called the system library.

As you might imagine, every program on Mac OS X links against this library, either directly or indirectly. Without it, a program would be unable to allocate memory, access the file system, and perform other simple tasks.

The system library takes the form of a dynamic library installed as /usr/lib/libSystem.B.dylib. Mac OS X also includes a framework called System.framework in /System/Library/Frameworks that refers to this library. The files that define the Darwin interface live in the /usr/include directory. By the way, neither of these directories is visible from Finder; Mac OS X actively hides much of the complexity of Darwin from the average Mac user.

Unix Commands

Unix users interact with their systems using command-line tools. These tools typically perform very specialized functions, such as listing files in a directory or displaying files on-screen. The advantage of supplying many specialized tools lies in the way commands can be combined to form more sophisticated commands. For example, a command that lists the contents of a directory can be combined with a program that lists text in "pages" for easy reading.

As you have learned, you use the Terminal application to gain access to Darwin's command-line tools.

The following Try It Out looks at Darwin's command-line interface. You start by browsing files using the command-line, looking up command information in Darwin's online help system, and running a command that displays its own arguments.

(Continues...)



Excerpted from Beginning Mac OS X Programming by Michael Trent Excerpted by permission.
All rights reserved. No part of this excerpt may be reproduced or reprinted without permission in writing from the publisher.
Excerpts are provided by Dial-A-Book Inc. solely for the personal use of visitors to this web site.

Read More Show Less

Table of Contents

Acknowledgments.

Introduction.

Part I: Mac OS X Developer Resources.

Chapter 1: The Mac OS X Environment.

Chapter 2: Developer Tools.

Chapter 3: Xcode.

Chapter 4: Interface Builder.

Part II: Application Programming.

Chapter 5: The Application.

Chapter 6: The C Language.

Chapter 7: The Objective-C Language.

Chapter 8: Using the Cocoa Frameworks.

Chapter 9: Using the Carbon Frameworks.

Part III: Script Programming.

Chapter 10: Overview of Scripting Languages.

Chapter 11: The Bash Shell.

Chapter 12: AppleScript and AppleScript Studio.

Chapter 13: Using Scripts Within Applications.

Appendix A: Exercise Answers.

Appendix B: Developer Resources.

Appendix C: Developer Tools Roadmap.

Index.

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing all of 2 Customer Reviews
  • Anonymous

    Posted December 8, 2005

    Good starting point

    This is a great book for the programmer who is just getting started in the mac world. From the InterfaceBuilder to code optimization, you'll have a helping hand along the way. It has quickies on C, Objective-C, and a few scripting languages, but it also covers the basics on Carbon and Cocoa. It even gets you started on building Quicktime movies into your applications. And what book on Tiger would be complete without an introduction to Widget development? Also features a thick tutorial on BSD and the CLI. The samples are great, and the end of chapter questions help drive in the important points.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted February 9, 2010

    No text was provided for this review.

Sort by: Showing all of 2 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)