Running Mac OS X Panther [1st ed] 9780596005009, 0596005008

Calling Mac OS X "the first real operating system for the 21st century," a Portland, OR-based freelance softwa

324 36 5MB

English Pages 398 Year 2003

Report DMCA / Copyright

DOWNLOAD PDF FILE

Recommend Papers

Running Mac OS X Panther [1st ed]
 9780596005009, 0596005008

  • 0 0 0
  • Like this paper and download? You can publish your own PDF file online for free in a few minutes! Sign Up
File loading please wait...
Citation preview



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Copy right

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Pref ace cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Audience X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir How This Book I s Organized syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e How t o Use Th is Book w ell on you r w ay. Com pat ibilit y Con vent ion s Used in This Book How t o Co nt act Us Ack nowledgmen ts Part I : Get tin g St art ed Cha pter 1. Where I t All Cam e From Section 1 .1 . Th e Classic Mac OS Section 1 .2 . Sy st em 7 Section 1 .3 . Coplan d Section 1 .4 . NEXTSTEP Section 1 .5 . Rh apsody Section 1 .6 . Con t in ued Develo pment of t he Classic Ma c OS Section 1 .7 . Mac OS X 1 0. 0 Section 1 .8 . Mac OS X 1 0. 1 Section 1 .9 . Mac OS X 1 0. 2 Jagu ar Section 1 .1 0. Mac OS X Pant h er Section 1 .1 1. What Does th e Fut ur e Hold? Cha pter 2. Lay of t he Land Section 2 .1 . Filesyst em Hierar chy Section 2 .2 . Th e Man y Root s of t he Finder Section 2 .3 . Filesyst em Dom ains

Section 2 .4 . Th e Libr ary Section 2 .5 . Fur th er Explor ation s Cha pter 3. The Ter mina l and Shell Section 3 .1 . Term inal Ov erv iew Section 3 .2 . Mac-specif ic Shell Com m ands Section 3 .3 . Con figu ring and Using bash Section 3 .4 . Using Ot her Shells



Section 3 .5of . Shell Script Table Content s s



Section Review 3 .6 . s Gett in g Help



Reader iewg sText Files Section 3 .7 . Rev Editin



Er r ata Section 3 .8 . Fur th er Explor ation s

• •

Part PARTAcademic I I : Essen t ia ls

Ten Dig Cha pter 4. Things Syst emI St art About up and Pant Loginher



Scheduling in Pant Section 4 .1 . Th eTasks Har dware Boother Pr ocess Running Ma c O S X P ant he r Section 4 .2 . Th e Oper at in g Sy st em Bo ot Process By Jam es Duncan SectionDavidson 4 .3 . Logging I n Section 4 .4 . Monit oring Users Pub lish er: O'Reilly Section 4 .5 . Logging Ou t Pub Dat e: Decem ber 00 3t tin g Down t he Sy st em Section 4 .6 . 2Shu I SBN: 059 6005 00 Section 4 .7 . Fur-8 th er Explor ation s Pages: 32 6 5. Users and Groups Cha pter Section 5 .1 . Wh at is a User Any way ? Section 5 .2 . Managing Users Section 5 .3 . Nonhu ma n Users Cha pter 6. Files and Permissio ns

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Section 6 .1 . Findin g Files cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS 6 .2 . File Ownersh ip X's cor e, rSection evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Section 6 .3not . Ty pe Crea tor syst em . You m ay beanad Mac guCodes ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Section 6 .4 . Fur th er Explor ation s w ell on you r w ay. Cha pter 7. Mon itor in g t h e System Section 7 .1 . About This Mac Section 7 .2 . Sy st em Profiler Section 7 .3 . Monit oring Syst em Act ivit y Section 7 .4 . Work ing wit h Processes Section 7 .5 . Fur th er Explor ation s Cha pter 8. Scheduling Task s Section 8 .1 . Set tin g t he Time Section 8 .2 . Using iCa l t o Sch edu le Task s Section 8 .3 . Using per io dic Section 8 .4 . cro n Section 8 .5 . Th e System cr ont ab File Section 8 .6 . Th e User cron ta b Section 8 .7 . Ch anging periodic' s Execu t io n Tim e Section 8 .8 . Fur th er Explor ation s Cha pter 9. Preferences and Def ault s Section 9 .1 . Pro per ty List s Section 9 .2 . Wh ere Preferences are St ored Section 9 .3 . Reading an d Writ ing Preferences Section 9 .4 . Determ inin g Pref er en ce Keys Section 9 .5 . Fur th er Explor ation s

Cha pter 10 . Disk s an d Filesy st em s Section 1 0. 1. Filesy st em s Section 1 0. 2. Net work -based Filesy st ems Section 1 0. 3. Disk Ut ilit y Section 1 0. 4. Erasin g an d Form at t ing Disks Section 1 0. 5. Part ition ing Disks Section 1 0. 6. Disk I mages

• • • •

Section 1 0.of 7. Content Creatin gs a RAI D Table Section Review 1 0. 8. s Fu rt her Ex plorat ions

Reader iew s Part I I I : Advan cedRev Topics Er 11 r ata Cha pter . Open Direct ory



Academic Section 1 1. 1. Open Directo ry in Action



Ten1Things I Dig Pant her ed Section 1. 2. Direct oryAbout Serv ices Defin



Scheduling Tasks Pant her Section 1 1. 3. Direct ory in Dom ains Running Ma c O S X P ant he r Section 1 1. 4. The Local Dom ain and Net I nf o By Jam es Duncan SectionDavidson 1 1. 5. Conf iguring Shared Do mains Section 1 1. 6. Kerberos and Single Sign- on Pub lish er: O'Reilly Section 1 1. 7. Comm and- Lin e Open Direct ory To ols Pub Dat e: Decem ber 3 her Ex plorat ions Section 1 1. 8. 2 00 Fu rt I SBN: 0- 5912 6-.005 00t -8 Cha pter Prin in g Pages: 32 6 Section 1 2. 1. Print Sy st em Ov erv iew Section 1 2. 2. Manag in g Print ers Section 1 2. 3. Addin g an d Co nfigu ring Print ers Section 1 2. 4. An at omy of a Pr in t Job Section 1 2. 5. Print ing fr om t he Com m and Line

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Section 1 2. 6. Fu rt her Ex plorat ions cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Cha pter 13 . Net work ing X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Section 1 3.not 1. The syst em . You m ay beI nt a ernet MacPro gutocol ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Section 1 3. 2. Conf iguring I P Addresses w ell on you r w ay. Section 1 3. 3. Nam ing and DNS Section 1 3. 4. Priva te Net work s an d NAT Section 1 3. 5. Rout ing Section 1 3. 6. Act iv e Net work Conn ect ion s Section 1 3. 7. AppleTalk Section 1 3. 8. Locat ion s Section 1 3. 9. Using a Dial- Up Connect ion Section 1 3. 10. Virt ual Privat e Net work s Section 1 3. 11. Firewalls Section 1 3. 12. I n tern et Conn ection Sha ring Section 1 3. 13. Furt h er Explorat ion s Cha pter 14 . Net work Serv ices Section 1 4. 1. File Sh aring Section 1 4. 2. Web Sharin g Section 1 4. 3. Rem ot e Login Section 1 4. 4. FTP Access Section 1 4. 5. Sh aring Print ers Section 1 4. 6. Mail Part I V: Appendix es Appendix A. I nst alling From Scrat ch Section A. 1. Preparing t o I n st all Pan th er

Section A. 2. I nst alling Pant h er Appendix B. Boot Com man d Keys Appendix C. Oth er Sour ces of I n for mat ion Section C. 1. Books Section C. 2. Magazin es Section C. 3. Mailing List s Section C. 4. Web Sit es



About th e Table Aut h orof Content s



Coloph on Review s



Reader RevXiew s th er Lab The Run ning Mac OS Pan



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Ru nni ng Ma c OS X P an t he r by James Du ncan Dav id son Cop yr igh t © 200 4 O'Reilly & Associat es, I n c. All r ight s r eser v ed . Pr int ed in t h e Un it ed St at es of Am erica Pub lished by O'Reilly & Associat es, I n c. , 1 005 Gr av enst ein Highw ay Nor t h , •Sebast opol, CA Table Content s 95of472 . •

Review s

Edi t or: •

Reader Rev iew sChuck Top orek



Er r ata



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Copye di t or:Academic •

Jill St ein berg

P rodu ct i on M a na ger : Clair e Clout ier Running c O Sne X P Cove r DMa esig r:ant he r

Em m a Colb y

By Jam es Duncan Davidson

I nt e ri or D esig ne r: Pub lish er: O'Reilly

I nt e ri or La you t :

Dav id Fut at o Jam es Du ncan D avid son

Pub Dat e: Decem ber 2 00 3 005 00 -8 Prin t inI SBN: g H i0-st59 or6-y: ber 20 03: Pages: Decem 32 6

Fir st Ed it ion.

Nut shell Hand book , t h e Nut shell Handb ook logo, an d t he O' Reilly log o ar e r egist er ed t rad em ar k s of O' Reilly & Associat es, I nc. Ru nning Mac OS X Pant her , t h e im age of a Ger m an sh ep her d, and r elat ed t r ade d ress ar e t r adem ark s of O' Reilly & Associat es, I nc. Ru Mac OS Pant her leScr is t he im atleScr e Swipt issStArudio, my Knife( TM) ; , for pow er kuser s w a, h o Car w ant to Appnning le, t he App le X log o, App ip tult , App Ap pleTalk Ap pleWor s, Aqu bon, cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Cocoa, Color Sy nc, Finder , FireWir e, iBook , iMac, I n kw ell, iPod, . Mac, Mac, Mac logo, Macint osh, X's e, r evealing t hee,inn er w ork eing s of Rendezv Pant her fous, or t hSher ose w h o, wan ant t o g et t hect e smost of tar heir Powcor erBook , Qu ick Tim QuickTim logo, lock d WebObj ar e tout r adem ks syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll of App le Com put er , I nc. , r eg ist er ed in t he U. S. an d ot h er cou nt r ies. Th e " k ey boar d" App le logboe ( w ell you rww ay.per mission of App le Com pu t er , I nc. ) isonused it h Man y of t he d esignat ion s used b y m anuf act ur er s an d seller s t o dist ingu ish t heir p rod uct s ar e claim ed as t r adem ark s. Wher e t hose d esign at ions app ear in t h is book , and O' Reilly & Associat es, I nc. w as aw ar e of a t rad em ar k claim , t he designat ion s hav e been p rin t ed in caps or in it ial cap s. While ev er y p recaut ion has b een t ak en in t he p repar at ion of t his b ook, t he p ublisher and t he aut h or assu m e no responsibilit y for er r or s or om issions, or for d amag es result ing f rom t he use of t he in for m at ion con t ained h er ein. I SBN: 0- 596 - 005 00- 8 [ M]

Preface Mac OS X is t he f ir st real op er at ing sy st em f or t h e 21st cent u r y. A st unn ing ach iev ement not t o be con fused wit h Mac OS 9 and it s p redecessor s even as it b uilds on t heir legacy, Mac OS X r ed ef ines our ex pect at ions of w hat a com pu t er sh ould be. On t he su rf ace, Mac OS X has a •gr aph ical user Table of Content s ) w it h usabilit y t hat can 't be t ou ched b y any ot h er OS on t h e planet . in t erf ace ( GUI •Under t h e hood Review it hs as a p ow er fu l Unix engine kn ow n as Dar win , w hich w as d ev eloped t hr ough •App le' s open Reader iew s iv e and b ased on Fr eeBSD 5. 0 Un ix dist r ib ut ion and t he fully sou rceRev init iat •bu zzw ord - com Er rpata lian t Mach 3. 0 k er nel. This com binat ion of f eat u r es g ives t h e sy st em it s sm oot h •m ult it askin g Academic b eh avior an d vir t ual mem or y m anagem en t . •

Ten Things I Dig About Pant her

at ion Tasks p rov in ides e sy st em t he st ab ilit y it needs t o amaz e, in t r ig ue, and ser v e •This st r ong f ound Scheduling Pantt hher y ou. I t is t his f ound Running Maalso c OS X P ant he r at ion t hat let s y ou r un t he Ap ach e w eb ser v er, t he Post f ix mail ser ver , and X11 ap plicat ion s next t o Micr osoft Wor d, Ad obe Phot osh op, an d Macr om edia By Jam es Duncan Davidson Dr eamw eav er —a feat t hat nobod y t houg ht possib le a f ew year s ago. For m an y, Mac OS X has r ep laced t he d ual b oot sy st em s t h at t h ey used t o hav e: one p art it ion f or Window s so you could O'Reilly r un Pub Oflish ficeer:and anot h er for Linux f or doin g Unix r elat ed w ork . Now , it ' s all un der one roof . Pub Dat e: Decem ber 2 00 3

Ev en bIet t er ,0-Mac OS00X-8 cont inu es t o im pr ove. Each r elease br ing s new f eat ur es, speed SBN: 59 6- 005 im pr ovem ent s, and m or e polish. This book —Ru nning Mac OS X Pant her —w ill help you m ast er Pages: 32 6 t he lat est ver sion of Mac OS X. You 'll lear n h ow t o get t h e m ost out of t he p r et t y GUI as w ell as how t o d iv e int o t he Un ix lay er of t he sy st em t o t ak e f ine- gr ained cont rol w hen y ou need t o.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Audience This b ook is w r it t en f or users an d pow er user s of Mac OS X and assu m es t hat y ou alr ead y hav e som e ex per ien ce wit h Mac OS X and w it h com pu t er s in gener al. For ex am ple, t h is book assu m es t hat y ou hav e foun d and used t h e Syst em Pr efer en ces ap plicat ion , hav e discover ed h ow t o ay t hat you r w •chang e t he wTable of Content s in dow s m inim ize and how t he Dock w or k s, and t hat y ou'v e f igur ed out how t o chan ge y our D esk t op backg rou nd. I ' m goin g t o speak t o y ou as som eb ody w ho w ant s • Review s t• o t ru ly m astReader er w h at is g oin g on w it h y our sy st em . May be you w ant t o t ur n y our Mac int o a w eb Rev iew s ser v er. Or m ay be y ou w an t t o k now t h e pr os and cons of t he v ariou s filesy st em choices t h at y ou • Er r ata hav e. Possib ly you w ant t o u nder st and how Mac OS X's n et w or k ing su bsyst em m ak es it possible • Academic t o sw it ch ef for t lessly bet w een w ir ed an d u nw ir ed net w or ks as w ell as let t in g y ou shar e y our • Ten Things I Dig About Pant her connect ion wit h ot h er s. •

Scheduling Tasks in Pant her

Running O S Xline P antwhe The comMa mcand illr

be cov ered ex t ensively in t his b ook and w hile I ex pect t hat y ou ar e at least comf or t able w it h t he idea of t he com man d lin e, one t hin g I w on't assu m e is t hat you ar e a By Jam es Duncan Davidson Unix gu ru w ho is k now led geable abou t all t h e shell' s dar k cor ners. I ' ll giv e y ou enou gh help an d expPub lanat of how t h e comm and line w or k s so y ou can accomp lish ever yt hing you n eed t o. I f lish ion er: O'Reilly y ou d ecide you like t he Unix side of Mac OS X, y ou can lear n m or e abou t it by r eading Lear ning Pub Dat e: Decem ber 2 00 3 Unix for M ac OS X Pant h er , b y Dav e Tay lor and Brian Jepson. I SBN: 0- 59 6- 005 00 -8

6 t hePages: ot her32 han d,

On if y ou are a Unix gur u , y ou m ay b e int erest ed in Mac OS X Pant her f or Unix Geeks, b y Brian Jepson and Er nest E. Rot h man , as a com pan ion b ook t hat ser v es as a m agic decoder r ing descr ibing t he diff er ences bet w een Mac OS X's int ern als and t hose of Lin ux , Solar is, and ot h er v ar iant s of Unix . And , if you r eally o w ant how y our Desk t op pTM) ict u;r es d how t o use Ru nning Mac OS Xd Pant hert ois lear t he nult im att oe set Sw iss Ar my Knife( foran pow er user s w hSt o ickies, w ant t o iChat , and iTunes, I sug gest y ou put t his b ook dow n and pick up t he lat est ed it ion of Mac OSOS X: cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac The M issing Manu al, Pant her Edit ion , b y Dav id Pog ue; sur ely it 's locat ed som ew here nearb y in X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir t he book st or e. Betnot t er be y eta, buy samyeout im p ick u p, tbhis one. The bookits, gyou o w'llell syst em . You m ay Mac itguatrut he w hen st e aryou t t his book ut once you 'vt w e or ead be w it h each ot her . w ell on you r w ay. Ther e ar e t w o ot h er book s t hat y ou shou ld consider com panion book s t o t his on e: Mac OS X Pant her in a Nut shell, b y Ch uck Topor ek, Chr is St one, an d Jason McI nt osh, ser v es as a q uick r ef er ence t o man y of Pant h er ' s feat ur es. Mac OS X Pant her Pock et Guide, b y Ch uck Topor ek, sq ueezes t h e m ost used f eat ur es in t o a pock et - sized quick r ef erence g uide.

How This Book Is Organized This b ook consist s of 1 4 ch apt ers along w it h t h ree ap pendix es.

Table of Started Content s Part I, Getting • •

Review s

•This sect ion of Reader Rev iewint s rod uces wh er e Mac OS X came fr om , how it is pu t t og et her, and how t h e book •it w or k s. I t cov Er r er atas how t he sy st em look s, how m ult iple user s coex ist on t he sy st em , an d how t o •use t h e Ter mAcademic inal t o get at t h e Unix fou ndat ion of t he operat in g sy st em . •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Ch apt er 1 , Wh er e I t All Cam e Fr om Pub Mac lish er:OS O'Reilly X is

t he successfu l hy br id of t echn ologies fr om Unix and t h e or ig inal Mac OS. On it s ow n, t he h Pub Dat e: Decem ber 2ist 00or 3 y w ould be in t er est ing en ough . But t he im pact of Apple's d ecisions w hile fu sin g t hese t wo I SBN: 0- 59 6- 005 00 -8 syst em s t oget her af fect s how t he sy st em operat es t o t his d ay. Pages: 32 6

Ch apt er 2 , Lay of t he Land The lay out of t he Mac OS X filesyst em is dif fer en t f rom t hat of m ost ot her op er at ing systMac em s. hist y wult it himt rat adeitSw ioniss al Unix st em t s, bu int r odu Ru nning OSI t Xshar Pantesher isort he Ar myfilesy Knife( TM) layou ; for pow er t user s w hces o wsever ant tal o t h ,atand m ak e itereasier f oru pt hteheir sy stMac. em t This o k eep it s tdak ates a separ atse deep f rom in you rs. Mac Th isOS cust omconcep ize, t wt seak g en ally r ev b ook reader side er look st he beneat ' s Pant pr esent iont hof t hw e hfilesy st em s how t het heir X's corchapt e, r evealing inn erh twhe orkFind ing serof her at f or ose o w ant t o and g et texp h e lain most out of em laidbeout w it hgudet on ywou hat is tlocat w here. syst emfilesyst . You m ayisnot a ,Mac ru ails w hen st ar t his ed book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Ch apt er 3 , Th e Ter m inal and Shell The Ter m inal g iv es y ou access t o t he Un ix cor e of Mac OS X. W hile it is p ossible t o becom e a d ecent user w it hout ever using t h e Ter m inal, y ou' ll need a good un derst an ding of it t o becom e a gu r u an d u nleash t h e fu ll pot ent ial of t he syst em . This chap t er sh ow s how t o use t he Ter m inal an d h ow t o con figu re t he v ar ious shells on t he syst em .

Part II, Essentials The n ex t sect ion of t he b ook giv es y ou t he t ools you need t o ex amin e how y our sy st em is r unn ing and how t o adj ust som e of t h e kn obs b eh in d it s operat ion . I t cov er s t opics ran ging fr om pr ocess cont rol t o m anag ing sof t w ar e inst allat ion s and back up st rat eg ies.

Ch apt er 4 , Sy st em St ar t up and Login Qu it e a bit hap pens behin d t h e simp le gr ay Apple log o and spinn er t hat appear w hen Mac OS X st ar t s up . This chap t er looks at w hat get s ex ecut ed w hen and w hat t he v ariou s boot opt ion s ar e. I n add it ion, it t akes a look at t h e pr ocess b y w hich ev en t s hap pen w h en y ou

log in an d ou t of t h e syst em .

Ch apt er 5 , User s an d Grou ps

• • •

Than ks t o it s Unix h er it age, Mac OS X is a m ult iuser oper at ing syst em t h rou gh and t hr ou gh. Th is chapt er d iv es int o t he q uest ion of w hy t here ar e m ult ip le user s on t h e syst emTable an d of wh y t heys ar e gat h er ed in t o g rou ps. I t also ex plains h ow t o add user s f r om Content bot h t hReview e Accou nt s p refer ence panel an d t he com man d lin e, how u ser secu rit y w or k s, and s how t oReader accessRev t hiew e fu nct ionalit y of t he root user. s



Er r ata



Academic

•Ch apt er 6 , Files Ten and Things I Digissions About Pant her Perm • Scheduling Tasks in Pant her Running Most Ma c O adm SX P inant isthe r atr ion

t ask s t hat you p er for m will in volv e w or king w it h files in one capacit y or an ot her. This chapt er ex plains t h e v ariou s at t r ibut es an d p er m issions t hat a f ile can By Jam es Duncan Davidson hav e and h ow t o wor k w it h t hem . I t also t akes a look at h ow t o ef fect ively fin d f iles on t h e syst em . Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Ch apt er 7 , Mon Pages: 32 6 it or ing t he Sy st em The f ir st st ep t o keeping y our sy st em in t ip- t op sh ape is t o kn ow w her e t o g o t o get inf orm at ion abou t h ow t he sy st em is ru nnin g. Th is ch apt er cover s t he Console, Syst em Pr ofiler, Act iv it y Mon it or, and m any ot her t ools as w ell as gives y ou t he sk inny on w hat t o look for in y our sy st em' s log files. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst emer. You m ay not a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Ch apt 8 , Schedu lingbe Task s w ell on you r w ay. Behind t he scenes, Mac OS X r un s m any t ask s on a per iodic basis. These t asks p er f orm essent ial h ousek eep ing ser v ices f or t he sy st em . Th is ch apt er div es int o how t h ese t ask s ar e r un and how t o set u p y our ow n t ask s t o ru n at per iodic int er vals.

Ch apt er 9 , Pr efer en ces an d Defau lt s All user conf ig ur at ion dat a on Mac OS X is st ored in t he d ef ault s sy st em . This sy st em is st r uct ur ed, in a w ay sim ilar t o t h e filesy st em, t o k eep y our d at a separ at e fr om t he syst em 's d at a, allow ing you t o m ig rat e it b et w een m achines easily . I n addit ion t o discussin g h ow t he default s sy st em w ork s, t h is ch apt er show s y ou how t o m odify pr efer en ces st or ed in t he sy st em in a v ariet y of w ay s.

Ch apt er 10 , Disk s an d Filesyst em s Mac OS X su ppor t s m any diff er ent kin ds of disk s including : h ard dr iv es, r em ovab le USB and FireWir e dr iv es, f loppy d riv es, CDs, DVD s, and vir t ual disk imag es. Th is chapt er g iv es y ou t he low dow n on t he d if fer en t k ind s of filesy st em s y ou can u se and t he p ros and con s of each . I n addit ion, it cover s v ar iou s back up st rat egies t o help k eep y our d at a saf e.

Part III, Advanced Topics This p art of t he book cover s som e adv anced t op ics su ch as h ow t o wor k w it h Dir ect or y Ser vices, t he pr int ing syst em of Mac OS X, n et wor k ing, and how t he v ariou s net w or k ser v ices w or k.



Table of Content s Ch apt er 11 , Open Dir ect or y • • • • • •

Review s Reader iew Op en Dir ect orRev y st orses t he m ost im por t an t d at a ab out y our sy st em—t he list of user s, r ata gr oup s,Erpr int er s, and so for t h . Based on LDAP, it w or ks wit h Net I nfo, flat files, ot her LDAP ser v ers, Academic an d Micr osoft ' s Act ive D irect or y. This chapt er show s y ou how t his syst em w or k s and how m od if dat a cont ained Tent oThings I y Dig About Pant her w it hin it . Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By ChJam aptes erDuncan 12 , PrDavidson int ing

r in t ing Pub The lish er:p O'Reilly

ar ch it ect ur e t h at Mac OS X uses is v er y f lex ible and supp or t s bot h local and net w or k pr int Pub Dat e: Decem ber er 2 00s.3 This chapt er g ives y ou a det ailed look at how pr int ing w or ks, h ow t o use pr int ser v er s, how I SBN: 0- 59 6- 005 00 -8 t o conn ect w it h W in dow s- host ed p rin t er s, and ev en how t o shar e y our ink j et pr int er t o Wind ows user s. I t also offer s a look at t h e Com m on Unix Pr int Sy st em Pages: 32 6 ( CUPS) , w hich ser v es as t he f ound at ion for t h e r est of t he p rint in g sy st em .

Ch apt er 13 , Net w or king Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o X liv e er connect edutpo tot herMac. m achines. Thist ak chap er sh ow s you inh side ow t he cust omMac ize, OS t w eak , es andt ogben ally r ev heir This b ook es treader s deep Mac OS or kin g syt he st em includin w ir eless, anw eou dezvou X's cornet e, w r evealing innwor er wk sork ing s ofgPant her f orspont t h ose h oswnet antw tor o king g et t(hRen e most outs)of, and t heir er net Connect ion arin t also t obook connect corpyou orat'vee VPN or ks. syst emI nt . You m ay not be a Sh Mac gug. ru I w hen ycov ou ers st arhow t t his , b utt oonce r eadnet it , wyou 'll b e w ell on you r w ay. Ch apt er 14 , Net w or k Ser vices I n addit ion t o b ein g ab le t o conn ect t o ot h er machin es, Mac OS X can serv e as a ser v er for m any d if fer ent p r ot ocols. I t can shar e bot h f iles an d p r in t er s t o ot her Macs as w ell as Wind ows mach in es. I t can serv e w eb pages t o ot her m achines fr om an yw h er e on t h e net w or k. And it can ev en ser ve as a f ull f led ged m ail serv er . This chap t er sh ow s you h ow t o con figu re t hese ser vices and w her e t o g o t o look for m or e inf or mat ion .

Appendixes The ap pendix es include q uick ref er ence m at erial.

App en dix A, I nst alling f r om Scrat ch Ev ery new Mac com es w it h Mac OS X inst alled . For m any r eason s, how ev er , y ou m ay w ant ( or n eed) t o r einst all y our sy st em . Th is can b e an easy pr ocess, b ut t here are a few t hings y ou sh ould t hink ab out as you do it . Th is append ix pr ovides a set of r ecipes t o use w hen r eb uilding y our sy st em .

App en dix B, Boot Com m and Keys While y our Mac boot s up you can giv e it all sor t s of com man ds, and t h ey all in volv e som ew hat cry pt ic key com binat ions. Th is append ix giv es y ou t he full refer ence t o all t he com man ds. •

Table of Content s



Review s

• App en dix C, Reader Ot her Sour Rev iew ces s of I nf or m at ion • • • •

Er r ata

Ther e ar e a w ide var iet y of good r esour ces con t aining m or e infor m at ion about Mac OS X. Academic This apTen pendix serv esAbout as a Pant list of Things I Dig herresour ces t hat will h elp y ou develop kn owledg e about Mac OS X. Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

How to Use This Book You should be ab le t o j um p in t o t h is book w h er ever y ou w ish. Reading st r aig ht t hr oug h f r om fr on t t o back, how ever , w ill ensur e t hat y ou w on 't en cou nt er any su rp rises as ever y eff ort has been m ad e t o av oid for w ar d r efer en ces. I f at an y t im e y ou n eed t o d ig d eep and fin d ou t w h y t wor ing ass y ou ex pect , r ead Ch apt er 7, Mon it or in g t h e Syst em . •som et h in g isn' Table of kContent •

Review s



Scheduling Tasks in Pant her

Ther e ar e a zillion t hings I ' d love t o show y ou abou t how you r Mac op er at es u nder t h e hood. Due • Reader Rev iew s t o t he d esir e t o b ot h get t h is book int o y our han ds b ef ore t he end of t his cent u ry as w ell as t o • Er r ata allow y ou t o car ry it nex t t o y our Pow erBook in y our b ack pack , I 'm going t o cov er t he m ost • Academic salient and int er est in g aspect s of each sub ject and , w her e appr op riat e, p oin t y ou t o ad dit ional •sour ces of in for TenmThings at ion.I Dig About Pant her Running c O Sab X out P ant doghe r ear ing Don 't beMashy

t he p ages as w ell as high lig ht ing par t s of t he book t hat you f in d usefu l. Com putDavidson er b ooks sh ould not be t r eat ed as p rist ine cof fee t able b ooks. Th ey sh ould be By Jam es Duncan used. An d, it w on't be lon g b ef or e Apple r eleases a n ew ver sion of Mac OS X, wh ich w ill pr om pt a r ev ision of t h is book t h at y ou' ll sur ely w an t t o buy . So go ahead, scrib ble not es in t he mar gin s! Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Compatibility Mac OS X is ev olvin g r apid ly —t h er e h ave b een t hr ee m ajor releases since it w as f irst r eleased as v er sion 1 0. 0 in March 200 1—an d t h er e is n o sign t hat App le is slow ing dow n . To k eep t h in gs simp le, t his book is t arg et ed dir ect ly at Mac OS X Pant her ( v ersion 10. 3 .1 w as t h e m ost cur rent t h is ofbook w ent •v er sion w h enTable Content s t o p ress) . While m ost of t h is in for m at ion may wor k w it h pr eviou s or lat er r eleases of Mac OS X, t her e is no way t o ensur e t h is—an d I ' m cer t ainly n ot g oing t o p ret end • Review s t• hat I 'm psychic an d t hat t he adv ice in t his book w ill ap ply t o t he n ex t r elease of Mac OS X Reader Rev iew s ( w hat ev er big cat t hey n ame it aft er ) . Use t his b ook w it h Pan t her and y ou sh ould be safe. •

Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Conventions Used in This Book The f ollow in g is a list of t he t yp ogr aphical conv ent ions u sed in t his book :



Table of Content s

I• t alic

Review s

• • • •

Reader Rev iew s r ata Used t oErin dicat e new t er ms, URLs, filenam es, f ile ex t ensions, dir ect or ies, com m and s and opt ion s, Academic and pr ogr am nam es, as w ell as t o highligh t com m en t s in ex am ples. For ex am ple, a p at h Ten in t h e filesyst w ill app Things I Dig em About Pant herear as / Developer/ Ap plicat ion s.



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Constant Width Pub lish er: O'Reilly

t o show PubUsed Dat e: Decem ber 2code 00 3

exam ples, t he con t en t s of a file, or t he ou t pu t f rom com m and s.

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Constant Width Italic Used in ex am ples and t ables t o sh ow t ext t hat should be replaced w it h user- su pplied v alues. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on youWidth r w ay. Bold Constant Used in ex am ples and t ables t o sh ow t ext t hat is inp ut b y t he user .

A car r iage r et ur n ( ) at t h e en d of a line of code is u sed t o d en ot e an un nat ur al line br eak; t hat is, y ou shou ld n ot ent er t h ese as t w o lines of code bu t as on e cont inu ous line. Mu lt ip le lin es are u sed in t hese cases du e t o p rin t ing con st raint s.

$, %, # The d ollar ( $) and percent ( %) sign s ar e used in som e ex am ples t o sh ow t he pr omp t of t h e bash or t csh sh ell; t he hash ( #) mar k is t h e pr om pt for t he r oot u ser .

Menu s/ Nav igat ion Menu s and t heir opt ion s ar e r ef er r ed t o in t he t ex t as File Op en , Edit Cop y, and so on. Ar row s will also b e used t o signif y a n avigat ion pat h w h en using w indow opt ions; for exam ple, Sy st em Pref er ences Accou nt s St ar t up I t ems means t hat you w ould launch

Sy st em Pr efer en ces, click t he icon f or t h e Accoun t s pr efer en ce panel, and select t he St ar t up I t ems pane w it h in t h at p anel.

Menu Sy m b ols

• • • •

When lookin g at t he menu s for any app licat ion, you w ill see som e sy m bols associat ed w it h k ey boar d shor t cut s fsor a p art icular com m and . For ex am ple, t o cr eat e a new pr oject in Table of Content Pr ojectReview Bu ild ser , y ou w ould go t o t he File m enu and select New Pr oject ( File New Pr oject ) , or y ou Reader cou ld issue - N. Th e sy m bol is u sed t o r efer t o t he Rev iewtsh e key boar d sh ort cu t , Shif t App le menu in t he u pper lef t cor ner of t h e scr een . Er r ata



Academic



Ten Things I Dig About Pant her

•Dir ect ories and Scheduling Fold er sTasks in Pant her Running Ma c O S X P ant he r

I nDuncan t he t ex t y ou w ill By Jam es Davidson

see t h e sam e t hing r ef er r ed t o som et im es as " dir ect ories" and som et im es as " f old er s" . Th e t erm " dir ect or y " is used w hen r efer rin g t o dir ect or ies in t he com man d line or in t he Unix par t of t he OS. When using t he Finder an d ot her GUI Pub lish er: O'Reilly app licat ions, h ow ev er, t he t r adit ion al Mac OS t erm " folder " is used . Pub Dat e: Decem ber 2 00 3

I SBN: 059 6-special 005 00 -8 at t ent ion t o n ot es set apar t f r om t he t ex t w it h t h e follow ing icon s: You should pay Pages: 32 6

This is a t ip, sug gest ion , or g en er al n ot e. I t cont ains usef ul su pplem en t al inf orm at ion abou t t h e t opic at han d. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. This in dicat es a w ar ning or a cau t ion. I t w ill h elp y ou solv e and av oid ann oying p rob lem s.

How to Contact Us All t h e people w ho hav e w or ked on t his book , includ in g ( but not lim it ed t o) t he aut h or , ed it or , and copy edit or , hav e t est ed and v erif ied t he in for m at ion in t h is book t o t he b est of t heir abilit y, bu t y ou m ay find t h at f eat u r es h ave ch anged—or ev en t hat w e hav e mad e m ist ak es! As a r ead er you can help su s t o im pr ov e f ut ur e edit ions by sen ding along y our f eedb ack . Please •of t his b ook, Table of Content let us kn ow abou t an y er r or s, inaccu racies, bug s, mislead ing or confu sin g st at em ent s, and t y pos • Review s t• hat y ou find Reader any w her e in t his book . Rev iew s •

Er r ata



Scheduling Tasks in Pant her

Please also let us k now w h at can be d one t o mak e t h is book m or e useful t o y ou. Your com m en t s • w ill be t ak en Academic ser iously, an d we w ill t ry t o incor por at e r eason able sugg est ions in t o f ut u re •edit ions. YouTen About canThings w r it eI tDig o us at : Pant her Running Ma c O S X P ant he r By Jam es Duncan Davidson

O'Reilly & Associates, Inc. Pub lish er: O'Reilly

1005 Gravenstein Highway North

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 Sebastopol, CA00 -8 95472 Pages: 32 6

(800) 998-9938 (in the U.S. or Canada) (707) 829-0515 (international or local) (707)Mac 829-0104 (fax) Ru nning OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e You alsor w send w ell can on you ay. us m essag es elect ron ically . To b e put on t he m ailing list or t o requ est a cat alog, send em ail t o: info@or eilly . com To ask t echn ical q uest ion s or t o com m ent on t he book , send email t o: book qu est ions@or eilly .com The w eb sit e for Ru nning Mac OS X Pant her list s ex amp les, er rat a, and plans for f ut u re edit ion s. You can f ind t his sit e at : w w w .r u nningosx. com / Ther e is also a p age on O' Reilly ' s w eb sit e dedicat ed t o t his b ook. You can f in d t his pag e at : w w w .or eilly . com / cat alog/ r unm acx pant h er For m ore in for m at ion about t his b ook and ot her s, see t h e O' Reilly w eb sit e: w w w .or eilly . com /

Acknowledgments First and for emost , I ' d lik e t o t han k all t he p eop le w ho r ev iew ed t he m at erial in t h is book as it w as w r it t en : Gabe Benv en ist e, Mik e Clar k , Dam on Clink scales, St uar t Hallow ay , Bet hany Jane Hanson, Joseph Heck , Mant on Reece, Dan iel St ein berg , Dav e Thom as, and Glenn Vand er bu r g as lotofof people •w ell as a w h ole Table Content s at App le ( you gu ys kn ow w ho you ar e) . These people had f ron t r ow seat s t o t h e creat iv e pr ocess, w at ched a book gr ow , m ade t on s of helpfu l comm ent s, an d ask ed • Review s all t h e r ig ht quest ions along t h e w ay. They ev en cam e t h rou gh w hen I ask ed t hem t o rev iew • Reader Rev iew s chapt er s ov er t he Th ank sg iving holiday . Th e book y ou hold in y our hand s is, in lar ge p ar t , a • Er r ata r esult of t heir inp ut . I owe t hem all m y gr at it u de and t h ank s. •

Academic

•Special t han ks Teng Things I Dig AboutDan Pantiel herw h o bot h w ent w ay bey ond t he call of du t y . Any t im e I can o t o Dav e and •r ep ay t he favScheduling Tasks in Pant her or, guy s, and r eview m at er ial for y ou, I ' ll be t here. Running Ma c O S X P ant he r

OfJam cour t herDavidson e' s t he ed it orial t eam wit h out wh om an aut h or is ju st som eb ody w ho scr ibbles By es se, Duncan r andom gibber ish on pap er . Chuck Top orek , w ho has w or ked w it h me on t h r ee b ooks and becom e a f riend along t he way , b r ought t h is id ea t o m e an d help ed m e br ing it t o f ru it ion. I n Pub lish er: O'Reilly add it ion t o edit ing t he b ook, Chu ck also p ick ed up t he p en and aut hor ed App en dix A. Jill Pub Dat e: Decem ber 2 00 3 St einber g, also a fr iend, w as t he copy edit or f or t he b ook. She f ret t ed over m y u se of w or ds and 59 6- 005 helpedI SBN: t ur n 0-t hem int00o-8somet hin g t hat I ' m pr oud t o put on t he b ookshelf. I n ad dit ion t o w ield ing Pages: 32 6 t he red pencil, she also of fered v alu able adv ice and crit iq ue du rin g t he early w or k on t his book . Bot h Chu ck and Jill ar e t op- n ot ch . Wit hou t t hem, t his w ould not be a coherent book . Man y t hank s t o t he wom en and m en of t he Apple Dev elop er Conn ect ion w ho w er e of gr eat assist ance t h r oughou t t he pr oj ect . Wit h out t heir supp ort , t his b ook cou ldn' t h ave b een w r it t en and pr intMac ed inOS 200 Wrher it ingis abou t an easy t askTM) . Wr; itfor in g pow about one st hwath oiswev olving Ru nning X 3. Pant t he ult im OS at e is Swnot iss an Ar my Knife( er user ant to as f ast as Mac OS X is and st ill being t imely is ev en har der . Wit h out t he supp ort of t he ADC and cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS ot her s e, at rApple, by t the he inn t imere w got t ogt hetose her,w hnews of tthe ver sion out of Mac OS X's cor evealing w eork ingas decent of Pant book her f or o w ant o gnetext th e most of t heir X w ou ld h ave m ad e it obsolet e. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Gr eat t h ank s, as alw ays, t o Tim O' Reilly f or so m any t hing s, but m ost of all f or alway s list ening and being w illin g t o t r y t o do w h at 's righ t , ev en if it 's r isky and hasn' t b een done befor e. The pr odu ct ion of t h is book w as an yt h in g but t y pical. The last chap t er w as w rit t en du rin g t h e 20 03 Than ksgiv ing holiday an d t he book sh ould be in st or es by t he end of t he year or j ust aft er —in ot her w or ds, it cam e t oget her v er y r apidly . We' ve b en t a few r ules along t h e w ay and w it hout Tim 's sup por t , it cou ldn' t h ave h appened. Dav id Fu t at o w at ched as I t ook a design t uned fr om y ear s of Fr am eMak er u se and imp lem ent ed it af r esh using Adobe I n Desig n. Along t he w ay he of fer ed m any h elpf ul su ggest ions and t ip s. I m ay hav e execut ed t he lay out and t w eaked it t o w ork w ell in a n ew env ir onm ent , but t he d esign is his an d I hope it w as im plement ed t o his sat isf act ion . Du ring t h e w r it in g of t his book , m any t hings happ en ed in my personal lif e f or w hich I am t han kf ul. I mov ed t o Por t land , Or eg on, a fan t ast ic place t o liv e even w it h t h e r ain. I w at ched t w o of m y best f riend s get m ar r ied : Jason Hunt er t o Kat hly n in Yosem it e; and Jim Dr iscoll t o Sent - si in Hawaii. An d, w it h t he help of Dr . At k ins, I weigh less t han I hav e in 10 y ear s. I 'm not su re how I m anaged t o d o all t hat w h ile w r it ing a book —a pr ocess t hat foun d m e u p unt il t he w ee hou rs of t he nig ht and, on m or e t han on e occasion, w at chin g t h e Sun r ise b ef or e going t o bed. The m u sic. Alw ay s t he m usic. iTunes show s t he f ollow ing ar t ist s as t he most fr equent ly p layed du rin g t h e creat ion of t his b ook: Am on Tob in, BT, Th e Ch em ical Br ot hers, Coldplay , The Cr yst al Met hod , Elect ric Sk y ch ur ch, Ev er clear , Fat boy Slim ( Nor m an Cook) , Filt er , Fischer sp ooner, Fluk e, Foo Figh t ers, Groov e Ar m ada, Josh Wink , Ju no React or , No Doubt , The Orb , Paul Oak enfold , Paul v an Dy k , Pink Floyd , Tabla Beat Science, Tim o Maas, Tor i Am os, Under w or ld ,

and Venus Hum . You bet t er believ e t h at I can' t wr it e w it hou t m usic. And f in ally , m any t hank s t o m y fam ily and f riends w ho lent t heir supp ort t o t he b ook w rit ing pr ocess an d wh o alw ay s en cour aged m e t o chase m y dr eams.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Part I: Getting Started • • • • • • •

Any m ast er at t heir subj ect kn ow s t hat t o t r u ly und er st and a sub ject , y ou hav e t o f irst un derst an d t h e basics—w h at t h e subj ect is and w here it all cam e fr om . Th e fir st par t of t his book set s t h e st age f or t he r est of t h e book b y sh ow in g you w her e t oday ' s Mac OS X cam e Table of it Content fr om and how is puts t oget h er . Th is sect ion also cov ers t w o essent ial elem en t s of Mac OS Review s and t he shell, w hich you 'll n eed t o b e pr oficien t at t o be a t ru e pow er user. X, t h e Term inal Reader Rev iew s

Ch apt ers Er rin atat h is par t of t he book in clu de: Academic

Ch apt erTen 1, Wher AllAbout Cam Pant e From Thingse I itDig her Scheduling Tasks in Pant her

Ch apt er 2, Lay of t he Lan d

Running Ma c O S X P ant he r

By Jam es Davidson ChDuncan apt er 3, The Ter m in al

and Shell

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 1. Where It All Came From The or igin al Mac OS defin ed t h e basic m et ap hor s t hat inf lu en ced per son al com put in g an d f or a decade w as t h e st andar d by w h ich all ot h er p er sonal com pu t er oper at ing sy st ems wer e m easu red. I t w as not un t il Microsof t Wind ow s 95 w as int r odu ced t hat any t hin g else cam e close. •Unfor t u nat ely, Table s m ist akes m ade by App le wh ile Micr osoft cont inu ed t o imp rov e dueof tContent o m any •Wind ows, close Review s good enoug h and Micr osoft ended up ow ning t h e user desk t op exp er ience w as •for t he last h Reader s alf of tRev he iew 19 90s. Now , wit h t h e adv en t of a t ech nological t our de f orce k now n as •Mac OS X, t hEr ata is on ce again set t ing t h e st andar d for w h at a per son al oper at ing sy st em e rMac •should be. Academic •

Ten Things I Dig About Pant her

w e nowTasks k nowin it is her f ar dif fer en t f rom t he on e r eleased in 198 4. I t is a successful •The Mac OS as Scheduling Pant hy br id of w rer e f irst ex pr essed in t h e or iginal Macint osh and of t echnologies t h at com e Running Maideas c O S X tPhat ant he fr om a com put ing p hilosop hy long considered t o b e t he ant it hesis of t he Mac ex per ien ce: Un ix . By Jam es Duncan Davidson The f usion of t hese t w o v er y d iffer ent cam ps gives u s t he p lat for m w e k now and love t oday . lishof er:gO'Reilly I nstPub ead iving t h e sam e lau ndr y list of f eat u res in t his ch apt er t hat y ou can get fr om App le' s w ebPub sitDat e or f r om ber m ost e: Decem 2 00 3ot h er b ooks cov erin g Mac OS X, I 'm g oin g t o t ak e a look at t h e pr edecessors t o Mac I SBN: 0- 59 6- 005 00OS -8 X and ex plor e t h e v arious orig in s of t he m od er n syst em . The int en t isn' t t o t ell Pages: t he st32 or6y of Apple Com put er or of St ev e Jobs, t houg h t h ose hist ories ar e int er est ing . The focu s here is on t he t echnologies at hand , w her e t hey cam e fr om , and how t hey inf luence t he dev elop ment of t he Mac oper at ing sy st em. Each maj or t echnology of t he cur r en t Mac OS X w ill be in t r oduced an d it s sou rce ident if ied .

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.1 The Classic Mac OS I n 198 3, af t er t he incr edible success of t h e orig in al App le I I , w h ich w as t h e fir st com put er t h at w as a t ru e per son al com put er f or m ost people, an d af t er t he lat er r elat ive d isap point m ent s of t he Apple I I I and t h e Lisa, St eve Jobs or ganized a g rou p of eng ineer s u nder a pir at e flag t o er of t hContent at could •m ake a com put Table s be used by any body . •

Review s

The r esult of t h eir ef for t s, k now n as t he Macin t osh , w as int r od uced t o t he w or ld a y ear lat er • Reader Rev iew s accom p anied b y t he f anf are of t he f amou s " 19 84" com m er cial ( d irect ed b y Ridley Scot t of Alien • Er r ata and Blad e Ru nner f am e) . Wit h a m essage of em pow er ment , t he Mac r ed ef ined w h at a personal • Academic com put er could be. Wh at m ade t he Mac d iff er ent fr om ev er y ot h er p er sonal com pu t er at t he t im e •w as it s Gr ap hical Ten Things her User I I Dig nt erAbout face Pant ( GUI ) , inspir ed b y r esearch t hat or iginat ed at Xer ox PARC: a •deskt op w h erScheduling Tasks in Pant her e f iles liv ed in folder s, and y ou u sed a m ouse t o m ove t hings w here y ou w ant ed Running Maec Mac's O S X P or antiginal he r t hem . Th desk t op is show n in Figur e 1- 1 . By Jam es Duncan Davidson

Pub lish er: O'Reilly

Figu r e 1 - 1 . The or ig in al M a c O S de sk t op

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

The d esk t op m et ap hor int rod uced w it h t he or iginal Mac in 198 4 liv es on t oday in t he cu rr ent Finder . Sur e, t oday ' s desk t op is r ender ed in fu ll color an d t he or iginal was com p arat iv ely cr ud ely dr aw n in b lack an d wh it e, but t he basic id ea r em ains mu ch t h e sam e: opening disks and folder s y ields win dow s t hat cont ain icon s t hat r ep resent f iles. At t he hear t of t he syst em w as a set of pr ogr am m at ic rou t ines called t he Macin t osh Toolbox t hat allow ed pr ogr am m er s t o im plement t he var ious essent ial int erf ace comp onent s, such as w indow s, m enus, aler t b oxes, scr ollbar s, and ot her cont rols, in t heir app licat ions. I n 198 4, t he Toolbox w as an am azing feat of en gineering an d cont ribu t ed t o a con sist ent user ex per ience t h at w as t h e en vy of ot her oper at ing sy st em v en dor s. But , ov er t he year s aft er it s release, m or e and m or e rou t ines w ere ad ded t o t h e Toolbox as t h e syst em dev elop ed . This r esu lt ed in m ore

feat u res, bu t t h ose feat ur es came wit h a pr ice—t h e sy st em became fr agile.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.2 System 7 I n 199 1 Ap ple int r odu ced Syst em 7 , an upg rad e t hat gr eat ly m odern iz ed t he Mac. I t incor por at ed m any feat ur es t hat w ould guid e fut ur e dev elopm ent : seam less m u lt it ask ing ( albeit cooperat iv e) , color icons, per son al file shar ing , v ir t u al m em or y , and a h ier ar chical Syst em f older iz e Cont r ol Pan •t o help or ganTable of Content s els and Ex t en sion s. The Mac in t er f ace also ev olv ed for Syst em 7, gr ow ing a b it m or e sophist icat ed as show n in Figur e 1- 2 . • Review s •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Figu r e 1 - 2 . The Syst e m 7 de sk t op

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Sy st em 7 also lay t h e fou ndat ion f or t hr ee v er y im por t ant t ech nologies:

Qu ickTim e A p ow er f ul m ult im edia t echnolog y for m an ip ulat ing, en hancing , st orin g, an d st r eamin g v ideo, gr aph ics, sound , and anim at ion.

Color Syn c

A set of sy st em rou t ines for color m anag em ent allowin g f or gr ap hics t o b e color m an aged fr om ed it in g t o pr int .

App leScr ipt An easy - t o- use scr ip t ing langu age t hat allow s y ou t o aut om at e t ask s on y our sy st em . •

Table of Content s

Alt hou gh Syst em 7 w as y ear s ah ead of ever y ot her op er at ing sy st em f r om t he ease- of- u se • Review s per sp ect iv e, not all w as r osy wit h t h is release. Wit h all t he new f unct ionalit y , t h e Toolbox had • Reader Rev iew s becom e ev en mor e f rag ile t han it s pr edecessors. I t t ur ned out t hat coop er at iv e m ult it askin g, • Er r ata w her e applicat ions ar e ex pect ed t o play nice w it h each ot her , m ean t t h at an y applicat ion cou ld • hog all t h e prAcademic ocessor t im e and , in ef fect , lock up a sy st em . An d, m ost g lar ing ly, t he Mac OS did •not pr ov ide m Ten I Dig Pantwher emThings or y p rot ectAbout ion bet een pr ogr am s. This not only let ap plicat ion s r un fast er as •w ell as enable Scheduling Tasks in Pant herom izat ions ( also k now n as hack s) , bu t it also let applicat ions all sor t s of nif t y cust Running X P ant r 's m em ory space, inev it ably corr u pt ing t he sy st em . As Apple r eleased scr ibb leMa intc oO Seach othe her new ard w are,Davidson d ev elopers dr eam ed up new f eat u res t h at could only b e imp lem ent ed using By Jamhes Duncan syst em ex t en sion s. While ext ensions h ad good in t ent ions, t h ey f r eq uent ly conf lict ed w it h each ot her w hich for ced user s t o r eboot t heir Macs sever al t im es a day . Pub, lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

At t his poin t , even t hou gh developm ent con t inued on t he Mac OS, event u ally leadin g t o OS 8, OS 0- 59 6- 005 00 -8 9, and I tSBN: he Classic env ir on ment un der Mac OS X, it was obv iou s t o Apple t h at a rad ical over haul Pages: 32 6 w as needed t o pr ov ide a m ore solid foun dat ion for t he f ut ur e.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.3 Copland To ad dr ess t he need for a m ore st ab le operat in g sy st em , Ap ple em bar ked on t he d ev elop m en t of a n ew oper at ing sy st em, dub bed Copland , in 1 993 . Wit h Coplan d, t h e focus was on in cr easin g st abilit y, por t abilit y , ease- of - use, and perf or m ance. Copland w as int end ed t o be Ap ple' s st epping u re OS t h at wsould include pr eem pt iv e m ult it askin g an d pr ot ect ed •st one t o a f utTable of Content m em or y —k eeping app licat ions separ at e an d pr ev ent ing t h em f r om crash in g each ot her or t ak ing • Review s t• he en t ire sy st em dow n. Much t o t h e ch agr in of Mac users as w ell as Apple, Cop lan d descended Reader Rev iew s int o a d eat h spir al of bu dget and sch ed ule ov er r uns. •

Er r ata



Academic Thr ee y ear s lat er , in 199 6, Cop land w as can celled an d Ap ple desper at ely look ed elsew her e f or a •new f ound at ion Ten for Things Dig About Pant her t h eI Mac OS. For a t im e, it look ed lik e Apple w ou ld p ur ch ase Be, st ar t ed by •App le alu m JeanScheduling Tasks in Pant Louis Gassée, anher d u se t he t echnically sop hist icat ed BeOS as t he f oundat ion f or Running c Oer S at X ion P antoper he r at ing syst em . The BeOS was developed on t he Pow erPC chip fit t in g in it s nex t Ma g en w it h Apple's Mac har dw ar e st r at eg y, had im pr essive m u lt it ask ing abilit ies, an adv anced By Jam es Duncan Davidson filesyst em , and pr ov ided t h e m em or y pr ot ect ion t hat t he Mac OS so d esper at ely need ed . The onlyPub cat BeOS w as an un finished wor k - in- p rog ress t hat w as un pr ov en in t he m ar ket p lace. lishch: er: O'Reilly Pub Dat e: Decem ber 2 00 3

Aft er sev er al m ont hs int o negot iat ions t o acqu ir e Be, t h e t w o com panies w er e not able t o agr ee I SBN: Be 0- 59w 6-ant 005ed 00 -8$40 0 million dollars f or it s u nfin ish ed and un pr ov en syst em , and App le did on a p rice. Pages: 32 6 not w ant t o t ak e t h at m uch r isk f or t h e pr ice. Af t er negot iat ions fell t hr oug h lat e in 1 996 , Be st r ugg led for sev er al m or e y ears, ev en t ually being acquir ed b y Palm, I n c. On ce ag ain, App le w as lef t w it h no dir ect ion for it s oper at ing sy st em, and m any t h ough t t h at t h e dem ise of Ap ple w as near . Th en , discu ssions st ar t ed w it h St ev e Jobs t hat led t o t he pu r ch ase in Decem ber 1 996 t h e com heat foun af my t er leav ingTM) App le inpow 1 985 NeXT ut ert o. Ru nning Mac OS of X Pant her pisany t het hat ult im e Swded iss Ar Knife( ; for er :user s wComp h o w ant Wit h t his p ur ch ase cam e t h e por t able an d feat ur erich NEXTSTEP oper at ing sy st em. cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.4 NEXTSTEP Or iginally int r od uced t o t he w or ld in 19 87, along w it h t h e elegan t NeXT cub e, NEXTSTEP w as int end ed t o, " Cr eat e t he nex t in san ely g reat t hing ," as only St ev e Jobs cou ld say . The dr iv ing m ant r a w as t o do ever yt hing r ig ht , an d not t o r epeat t h e m ist ak es t hat Apple h ad mad e. Built on t he Mach m icr ok er nel, NEXTSTEP h ad t h e pr eem pt iv e m ult it ask ing and •t op of BSD Unix Tablean ofdContent s m em or y pr ot ect ed core t hat Mac OS need ed . NEXTSTEP also ut ilized Disp lay Post Scr ipt fr om • Review s Adob e allow ing d ev elop er s t o use t h e same cod e t o d isp lay docum en t s on scr een as w ell as t o • Reader Rev iew s pr int t o p aper —en abling t r uly WYSI WYG applicat ions. NEXTSTEP also feat u red a r ich GUI • Er r ata deskt op, as show n in Figur e 1- 3 . •

Academic

•For dev eloperTen Things I Dig About hera set of lib rar ies, called " fr am ew or k s, " and t ools t o en able s, NEXTSTEP camePant wit h •pr ogr am m er sScheduling Tasks in Pant her t o bu ild app licat ions using t he Ob ject ive- C langu age. Dev eloper s lov ed t his m ix of Running Ma c O S For X P ant r ple, t echnologies. exhe am

Tim Ber ners- Lee u sed NEXTSTEP t o w r it e t h e fir st f ew ver sion s of bot h tes h eDuncan client Davidson br ow ser an d ser ver sof t w are t hat w ou ld st ar t t he Wor ld Wide Web. By Jam NEXTSTEP evolv ed t h r ough m any r eleases and w as adop t ed b y m any gov ern m en t s and Pub lish er: O'Reilly com panies as t h eir p lat for m of choice. I t m ade inr oads int o t he m ilit ar y , b ank in g, h ealt h car e, Pub Dat e: Decem ber 2 00 3 and t elecom m unicat ions in dust r ies and receiv ed glow in g rev iew s f rom t he p ress. Becau se it w as 6- 005 -8 , av oid ing t he m ist akes of t h e desig n of t he or iginal Macin t osh an d y et creat edI SBN: as a0-f59 r esh st00art Pages: 32 6 bu ild in g on it s id eas, it w as able t o ju mp f ar ahead of any t hing else.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o On Spelling and Capitalization cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Ov er y ear s, tnot here' s been uitru e awbit as book t o h ow Coponce lan dyou was'v esprelled, syst emt.he You m ay be a Macq gu henofyconf ou stusion ar t t his , b ut ead it , you 'll b e w it h man y using t he sp elling " Cop eland " . How ever , a q uick Google sear ch w it h t he w ell on you r w ay. t er m copland +site:apple.comt ur n s up m any old docum ent s on App le' s w eb sit e t hat set t he recor d st r aight . I t 's Copland w it hout an " e" . Ther e' s also b een quit e a bit of con fusion about how t he w or d NEXTSTEP is capit alized , w it h cam ps of rab id cur m ud geons gat hered ar ound t he var iat ions of NeXTSTEP, NeXTSt ep , and NEXTSTEP—each claim ing t h eir capit alizat ion is corr ect . Well, t he t r u t h of t he m at t er is t hey ar e all r igh t . NeXT v ar ied t he capit alizat ion ov er t he var ious r eleases of t he sy st em . This book u ses t h e all- cap s for m of t h e w or d as t hat 's h ow App le refer r ed t o t he op er at ing sy st em in t he pr ess r elease dat ed Decem ber 2 6, 1 996 , annou ncing t he m er ger of Apple an d NeXT.

Figu r e 1 - 3 . The NEX TSTEP de sk t op



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru OS X Pant t het oult im Iat iss ar Archit my ect Knife( ; for uent powly er, user h o swwant I n nning 199 3, Mac NEXTSTEP w asher porist ed t he nteelSw x 86 u re.TM) Su bseq ot hers w p ort er et o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac per for m ed f or t he Sun SPARC, D igit al Alph a, and Hewlet t - Pack ard PARI SC ar ch it ect u res. LatOS er , X's e, r evealing t heew innorerk swand ork ing s ofwPant herised f or tthoose h oot wher ant op t o er g et t h e sy most of t heir t he cor developm ent fr am t ools ere rev r unwon at ing st emout s, such as syst . You ay not be a Mac gu ru fwram henew y ou st ar t t hisebook , n b ut 'v .e The r eadNeXT it , you 'll b e Windem ows andmSolaris. Th ese r evised or ks b ecam k now asonce Op enyou St ep t eam w ell on qu you gained it er w a ay. b it of exp er ience in im plem en t ing it s t ech nology on m ult iple p lat for m s. From NEXTSTEP, Mac OS X dir ect ly in herit s t he f ollow ing :

The M ach k ern el Descend ed f rom a r esear ch p roj ect at Carn eg ie Mellon Univ er sit y and fir st d esign ed by Avi Tevan ian ( Ap ple's cur r en t Chief Sof t w ar e Tech nology Of ficer) in t he m id- 1 980 s, t he Mach k er nel p er f orm s t he cr it ical f unct ions of abst r act in g t h e har dw ar e of t h e com p ut er fr om t he soft w ar e t h at r un s on it . I t pr ov ides sym m et r ic mu lt ip r ocessin g, pr eemp t ive mu lt it ask ing, pr ot ect ed an d v ir t ual m em ory , an d su ppor t for r eal- t ime applicat ions. Becau se t he k er nel is t he gat ekeeper t o har dw ar e and cont r ols each app licat ion' s v iew of mem or y, indiv idual app licat ions can 't cr ash or corr up t t he syst em .

The BSD lay er Der ived fr om Fr eeBSD, t he BSD layer pr ov ides t he " user visible" par t of t he Unix lay er : t he pr ocess m od el, t h e concep t of u ser s, basic secur it y policies, n et w or k ing, and su ppor t for filesyst em s. This layer allow s m any Unix ap plicat ion s, su ch as t he Apache w eb ser v er , t o be easily por t ed an d ru n on Mac OS X.

The NEXTSTEP p r ogram m in g f ram ew or ks Now k now n as Cocoa, NEXTSTEP d ef ined a r ich set of obj ect - or ient ed API s, a set of libr ar ies, a ru nt im e, and a d ev elop m en t env iron m en t f or bu ild in g ap plicat ion s. I t pr ov ides m ost of t h e infr ast r uct ur e needed t o bu ild g rap hical user applicat ions an d t o insulat e t hose app licat ions fr om t he in t ern al w or king s of t he cor e sy st em . •

Table of Content s

•You don' t necessar Review sily hav e t o ever see t his lay er if you don 't open up t he Ter m in al, bu t it ' s t her e non et h eless, and knRev owiew leds ge of it is de r igeu r t o becom in g a pow er user . Thr oug h t he cour se of • Reader t• his b ook, you 'r e g oin g t o get quit e f am iliar w it h t h is lay er ; m ast er y of t h e BSD Unix cor e of Mac Er r ata OS X is essent ial t o gain in g com plet e m ast ery of y our sy st em. • Academic •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.5 Rhapsody At t he 19 97 Wor ld W id e Developer Confer en ce ( WWDC) , Apple d em on st r at ed an ear ly bu ild of Rh apsody , a v er sion of NEXTSTEP t hat r an on Macint osh har dw ar e. Wit h NeXT' s exp er ience por t ing t h e sy st em t o mu lt ip le har dw ar e ar ch it ect u res, it w as easy enoug h for Ap ple t o g et a r un ning on a ssing le mod el Mac m odel in t im e for t he conf er ence. The dev elop ment •bu ild up an d Table of Content com mu nit y w as inv igor at ed as an amb it iou s pr oj ect plan w as annou nced t hat w ould supp osedly • Review s lead t o a r elease in 19 98 of a new Mac OS for t h e Pow er PC and I nt el p lat for m s. • Reader Rev iew s •

Er r ata

As par t of t he p roj ect plan, t hr ee m ajor com ponent s w er e an noun ced: The Yellow Box , w hich • Academic w ould r un OpenSt ep- b ased app licat ions on t op of Rh apsody ; t h e Blue Box , w hich w ould ru n a •fu t ur e v ersion Ten I Dig About ofThings t he classic Mac Pant OS her as a Rh apsody pr ocess; and t he Red Box , w hich wou ld allow •Op en St ep app Scheduling Tasks in Pant licat ions t o r un on ther op of Window s w it h a sim ple r ecom p ile. Running Ma c O S X P ant he r

Rh apsody br ouDavidson ght t he in t eg rat ion of t h e follow ing t ech nologies int o t he cur r en t Mac OS X: By Jam es Duncan Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

ClassicI SBN:

0- 59 6- 005 00 -8

Pages: 32 6

Wit h t he ou t gr ow t h of t he Blue Box, Classic allow s older Mac ap plicat ion s t o ru n un mod ified u nder t h e new op er at ing syst em . Essent ially an op er at ing sy st em r u nning w it hin a p rocess, it doesn't conf er all t he ad van t ages of a p rot ect ed- m emor y p reem pt iv e syst em t o t he ap plicat ion s r unn in g wit h in it . I f an app licat ion crashes in side Classic, it can corr u pt an y ot her ap plicat ion s also r unn in g in Classic. Howev er , Classic allow s t he old and Ru nning Mac OSatX Pant her Swwiss mysam Knife( TM) ; for pow h o w antoft o new op er ing sy st emiss tt he o ruult n im at at onece it h Ar t he e scr een, m ou se,eranuser d a smwodicum cust omcrossize, t plat w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side f or m applicat ion ut ilit y. I t 's n ot a perf ect solu t ion, b ut it allow s user s t oMac contOS inu e X's corusing e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir t heir older Mac OS ap plicat ion s as t h ey m igr at e t o t he new syst em . syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Jav a From t he b eg in ning , t he Rhapsody t eam mad e it a pr ior it y t o im plem en t good Jav a supp ort on t he p lat for m . This sup por t w ou ld allow Jav a applicat ions and ap plet s t o r un and oper at e w it hou t m odif icat ion. As w ell, a layer of f unct ionalit y —k now n as t he Jav a Br id ge—w as im plement ed , allowin g Jav a and Obj ect iv e- C t o w or k t oget her . Wit h t his fu nct ionalit y , Cocoa ap plicat ion s can b e bu ilt using Jav a. Sever al pr oblem s ar ose t hat w ould keep Rhapsody f r om ever seein g t h e light of day as a consum er syst em . The f irst pr oblem w as get t ing Rh apsody t o r un on Apple's ent ir e p rod uct line. Each m odel of Macint osh w as ver y dif fer en t f rom ot her m odels, and clev er en gineer ing h ack s had been put int o place over t im e in ear lier v er sions of t he Mac OS so it w ou ld r un on all Macs at t he t ime ( in clu ding Pow er PC and 68 0x 0- based Macs) . This v ariat ion of har dw ar e m ade it har der t o por t t h e Mac OS as each n ew Mac m odel r equir ed it s own p ort of t he OS. This led t o t h e r ed uct ion in t h e num b er of old er Macs t hat t he n ew OS w ou ld be su ppor t ed on as w ell as t o t h e int r odu ct ion of m any chan ges t o t he har d war e p lat for m t o ease t h e m arr iage of sof t w are and har dw ar e. The second m ajor p rob lem t o f ace Rhapsody was t he lack of comm it m ent by t he maj or Mac soft w ar e v en dor s, such as Adobe an d Micr osoft , t o r ew rit e t heir pr oduct s u sin g t he Ob ject iv e- C langu age an d t he fr am ew ork s d er iv ed fr om OpenSt ep. W it hout a com plet e r ew r it e, t heir app licat ions wer e doom ed t o liv e as second - class cit izen s in t he n ew OS b y r unnin g in t h e Blu e Box ( t h at is, Classic mod e) . I t b ecam e clear t o App le t hat wit h out t he sup por t of t h e m ajor

soft w ar e v en dor s shipp in g fir st - class app licat ions, t h e new OS w ould not su cceed. App le r et houg ht it s st r at egy an d decided t o post pone t he new OS as a consum er sy st em. This delay gav e App le m ore t im e t o m ake it s next - generat ion OS r un on mor e h ard w are as w ell as t o dev elop a com pat ib ilit y lay er t hat w ould m ake it easier for older Mac soft w ar e t o be p ort ed t o r un on t he n ew sy st em. This lay er w as called Carb on, w h ich w as int r odu ced at W WDC 199 8 along w it h t he r est of t he plan f or Mac OS X developm ent aft er Rh apsody . Ev en t houg h Rhapsody w asn' t wid ely r eleased, it w asn 't a f ailu re. I t repr esen t ed an im por t ant •ph ase of t he Table t r ansit of ion Content of tshe old NeXT- b ased oper at ing syst em int o som et hin g t h at could be t he nex t g en er at ion of t he Mac OS. Wit h out Rhapsod y, all t hat follow ed could not hav e hap pened. I n • Review s fact , t he m ajor dist inct ion b • Reader Rev iew s et w een Rhapsody and Mac OS X is t h e nam e chan ge and t h e int egr at ion of • ErCar r atabon. •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.6 Continued Development of the Classic Mac OS Aft er Ap ple bou ght NeXT, not all it s dev elop ment eff ort s w er e spent creat ing Rh apsody and event u ally Mac OS X. While d ev elop m en t pr oceed ed w it h t he n ew operat in g sy st em , sev er al r eleases of t he classic Mac OS b ridg ed t h e gap bet w een Sy st em 7 an d Mac OS X. •

Table of Content s



Review s



Reader Rev iew s

• • •

Er r ata Academic Rhapsody, Mac OS X, and Intel Ten Things I Dig About Pant her

• Ov er t he y ear Scheduling Pant s it h as Tasks been inr um orher ed t h at t h er e w ou ld b e an official Mac OS X release Running Ma x c 86 OS X P ant for I n t el har dwhe arr e.

These ru mor s st ar t ed fr om t h e day Ap ple pur chased NeXT as NEXTSTEP h ad lon g r u n on x 86 har d war e. They w er e fu r t her fu eled by App le' s early con fusion about w hat it w as g oin g t o do w it h t he r aft of Pub t ech lishnologies er: O'Reillyacquir ed f r om NeXT. And all t he t alk about box es—red, yellow, and blue—d id n' t h elp m at t ers.

w ere wellDavidson f ound ed Byand Jam es Duncan

Pub Dat e: Decem ber 2 00 3

0- 59 005ains 00 -8 D arw in ( t he under lyin g Unix lay er of Mac OS X) t o r un on x 86 WhileI SBN: Ap ple m6-aint Pages: 32 6 pr ocessor s, t her e are con t inued r um ors t hat Apple is secr et ly w or king on a ver sion of Mac OS X t o r un on I nt el- based har d war e. This p r oject , r ep ort edly cod en amed Mar k lar ( aft er t h e aliens in t h e Sout h Par k car t oons) is su pposedly being dev elop ed som ew her e deep in sid e Apple's Cuper t ino lab s. How ev er, not hin g h as ever seen t h e light of day an d Ap ple neit her conf irm s n or denies t hat such a pr oj ect ex ist s. I n f act , App le isMac comOS m it X t ed t o her t h e is RI SCPC Ar plat m ( atTM) least forpow t heern ex t few Ru nning Pant t he based ult im atPower e Sw iss myforKnife( ; for user s w h o w ant t o y ear s) ize, w it ht wt he t he new erPCMac. 75 0 This ( akabtook he G5) cust om eakadopt , and ion g enof er ally r ev uPow p t heir t ak ,esd esigned reader s and deep in side Mac OS m anuf act ur ed b y ItBM. X's cor e, r evealing he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e t ison alwyou ay sr w possible, how ever , t hat App le may one day ch ange t o a d iff er ent ch ip wIell ay. ar ch it ect u re. An d it ' s not out side t he r ealm of possib ilit y t h at t h er e m igh t on e day b e an I nt el chip at t h e hear t of a Macin t osh. For now t hou gh, it seem s App le is put t in g eff ort int o m ain t aining t he x 86 por t of Dar w in in or der t o pr eserv e t h e cross- plat f orm abilit ies of t he Unix cor e of Mac OS X.

Mac OS 8, w hich m ade it s appear ance on July 22 , 19 97, w as t he f irst of t hese releases. Hailed at t he t ime as t he " Most sig nificant Macint osh operat in g sy st em sin ce 1 984 , " it br ough t a new plat inu m - based look and f eel t o t he desk t op ( based on t h e look and f eel f rom Coplan d) , com plet e w it h spr ing - load ed f olders t hat popp ed up w hen a f ile w as dr agged ont o t hem , and cont ex t ual m enus act iv at ed by hold in g d ow n t he Con t r ol k ey w h ile clicking an icon. Mac OS 8 also m ade it easier for user s t o connect t o t he I n t er net w it h an I nt er net Set Up Assist ant and bu ndled Net scape Nav igat or an d Micr osoft I nt ern et Ex plor er. Fin ally , Mac OS 8 m ar ked t he int r odu ct ion of t h e Macin t osh Runt im e f or Jav a, allow in g applicat ions w r it t en in t he Java cr ossplat f or m langu age t o ru n on t h e Mac. Mor e im por t ant t o t he m igr at ion t o Mac OS X, Ap ple w as bu sy mak ing t h e m odifi- cat ion s r eq uir ed so it w ould ru n well b ot h as it s ow n operat in g sy st em and in Mac OS X' s Classic mod e. I n addit ion, a lot of w or k w ent int o t he Car bon libr ar y so t h at d ev elop er s could st ar t w r it ing app licat ions t hat wou ld r un on bot h t h e old and new syst em s. This t u rn ed out t o be a pr ot r act ed exer cise in ident ify ing t h e sy st em calls t hat developer s w er e u sing an d r esu lt ed in sev eral v er sions of t h e Car bon libr aries being r eleased f or t he classic Mac OS. Aft er sev er al r eleases of Mac OS 8 ( 8. 5, 8. 5. 1, an d 8 . 6) , t h e dev elopm ent of t he or iginal Mac OS

m oved int o it s fin al phase w it h t he release of Mac OS 9 on Oct ober 2 3, 1 999 . This r elease int r odu ced: an upd at ed d esk t op look and feel, as show n in Figur e 1- 4 ; t he Keych ain app licat ion, allow in g all of you r passw ord s t o b e held in one place; aut om at ic soft w ar e u pdat in g ov er t he I nt er net ; an d t he Net w ork Brow ser, allow ing easy br ow sin g of t h e ser v er s an d com pu t er s connect ed t o t he local ar ea n et w or k . This r elease cam e w it h an u pdat ed Car bon libr ar y for dev elop er s t o w rit e against an d m an y m ore chan ges t o t he cor e of t he OS t o en able it t o r un un der Mac OS X as Classic. Mac OS 9 also spor t ed m any perf or man ce en hancement s; aft er all, for a consider able am ount of t im e it w as st ill t h e OS t hat sh ip ped b y defau lt on ever y new Mac. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Figu r e 1 - 4 . The M a c O S 9 De sk t op

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Dev elopm ent of Mac OS 9 w rap ped u p wit h t h e r elease of ver sion 9. 2 .2 on Decem ber 5 , 20 01. This v er sion ship s as Classic in ev er y new Macin t osh . At WWDC 2 002 , St eve Job s r ead a eu logy t o Mac OS 9, d ram at izing t h e m essage w it h a fog- shr ou ded cof fin.

1.6.1 The Introduction of the iApps Oct ober 1 999 did n't ju st br ing Mac OS 9 , it also b rou ght t o lig ht iMovie, t he fir st of t he so- called iApps. Using t he Mac' s bu ilt - in FireWir e por t , iMov ie w as t h e fir st p rod uct of it s k ind t o allow hom e u ser s t o con nect a h andh eld cam cor der t o a Mac and edit an d p rod uce t heir ow n m ovies. Follow ing t h e success of iMov ie, Ap ple m oved for w ar d in Jan uar y 20 01 w it h it s iAp ps st r at eg y.

iMov ie w as soon f ollow ed by iTun es, f or m anag in g digit al m usic, and iDVD for t akin g t he m ovies creat ed in iMov ie and cr eat in g D VDs t h at could t hen be u sed on any hom e D VD p lay er . The r elease of t h ese t h ree ap plicat ion s m ark s a t ur ning p oin t f or App le. Not only w as t h e Mac OS being conceiv ed of as an op er at ing sy st em t hat w ou ld h elp sell Macs, it w as also being conceiv ed of as t h e cent er of a lar ger st rat eg y w hereby t he Mac w ou ld enab le t he so- called Digit al Hub. I nst ead of j ust b ein g a pr ov ider of har dw ar e and t he operat in g sy st em t hat ran on it , Ap ple posit ioned it self as a p r ovider of solut ions t hat pulled t oget her t he var ious d igit al dev ices t h at •y ou m igh t h ave Tableand of Content mak e st h em mor e u sef ul. •

Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.7 Mac OS X 10.0 App le sh ip ped Mac OS X Pub lic Bet a in Sept em ber 2 000 . Mor e t han 1 00, 00 0 p eop le boug ht t he bet a, an d Ap ple r epor t ed t h at t h er e w er e m ore t han 75, 0 00 feed back subm ission s. Not only d id t he Public Bet a ser ve t o indicat e t h at Ap ple w as going t o ship Mac OS X, it h elped App le id en t ify at user need ed •t he issues t h Table of sContent s t o hav e add ressed in ord er t o r eplace t he or iginal Mac OS. •

Review s



Scheduling Tasks in Pant her

Aft er f our year s in d ev elopm en t , t h e fir st f ull r elease of Mac OS X, k now n t o t he engin eer s w ho • Reader Rev iew s w or ked on it as Ch eet ah an d t o t h e pub lic as v er sion 1 0. 0, f inally shipped on Mar ch 24 , • Er r ata 20 01—1 7 year s and 3 m ont hs aft er t he in t r oduct ion of t he or iginal Macint osh. People g at hered • at st or es everAcademic y wh er e t o w elcom e it s int r od uct ion. The fusion of Mac OS and Unix w as comp let e, •and App le finally Ten Things About Pant her h ad t Ih Dig e nex t - gener at ion op er at ing sy st em t h at it w ant ed. Running Ma c O b S rou X P ant This r elease ghthet rhe

f ollowin g f eat ur es:

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Car bon

Decem ber 2 00 3

I SBN: 0- 59 6- 005 00 -8

A sub 32 set6 Pages:

of t he or iginal Mac OS Toolbox API s t h at could be safely t r ansit ioned fr om t h e old Mac OS t o t he n ew one, Car bon w as t h e lif elin e for old er Mac OS applicat ions, allow in g t hem t o be p or t ed t o t he n ew sy st em. This m eant t hat applicat ions essent ial f or at t r act ing users t o t h e new sy st em , such as Micr osof t Off ice an d Ad obe Phot osh op, could be p ort ed t o Mac OS X and t ake adv ant age of p r eem pt iv e m ult it asking an d p rot ect ed mem or y.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's corz e, Qu art 2Dr evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e f ul im aging lay er of Mac OS X, Quar t z 2D han dles all t he d raw ing on t he sy st em w ell onThe youp row w er ay. and deliver s a rich imag ing mod el based on PDF ( replacing t he D isp lay Post Scr ipt used by NEXTSTEP) , on- t h e- f ly r en derin g, an d an t ialiasing—all m anaged by Color Sy nc t o en sur e gr aph ics look t heir best .

Qu art z Com posit or The w in dow ing sy st em for t he OS and pr ov ider of low - lev el ser v ices such as event han dling and cur sor man agem en t , t he Quar t z Com posit or is based on a " vid eom ix er " m odel w her e ever y pix el on t he screen can be sh ared am ong w in dow s in r eal t im e. Th is m odel allow s for sm oot h t r ansit ions b et w een t he st at es of a GUI ; on e of t he t rait s of t he Aqu a exp er ience.

Aqu a Mor e t h an a color , an d mor e t h an som et hing t h at br ing s t o mind t h e pr oper t ies of wat er , Aqu a is an at t it ud e. When Apple set ou t t o desig n t he int er face f or Mac OS X, it wan t ed t o t ak e all t h e good par t s of t h e pr evious Macin t osh an d m ix t h em w it h n ew feat ur es m ade possible by m od er n com p ut er har dw ar e. Aqu a br ing s t he u ser in t er f ace t o life w it h dept h , t r anspar ency, t r anslucen ce, an d m ot ion.

Aqu a also r ecog nizes t hat it is m anag in g a t h orou ghly m ult it ask ing machin e. I n st ead of pop ping up dialog box es in t h e m iddle of t h e scr een , Aqu a pr ov ides sheet s t hat are at t ached t o t h e w indow t hat t hey per t ain t o, allowin g ot her t asks t o be perf or med w it hout hind r ance and clear ly comm u nicat in g f un ct ion t o t he u ser . The Aq ua in t erf ace is pict ur ed in Figur e 1- 5 .



Table of Content s

• •

Figu Reviewrs e 1 - 5 . The M a c O S X 1 0 .0 D esk t op an d t he Aqu a user Reader Rev iew s in t e r f ace



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Mail An easy - t o- use m ail clien t com pat ible w it h I nt er net - st andar d m ail ser v er s t h at u se t he SMTP, I MAP, and POP p r ot ocols, Mail sh ip ped wit h a built - in config ur at ion t o seam lessly access iTools- based Mac. com m ail.

iTunes and iMov ie Cr it ical t o Ap ple's D ig it al Hub st r at eg y, t he f irst release of Mac OS X also included por t s of t he iTu nes and iMov ie applicat ions, w hich fir st app ear ed on Mac OS 9. I m pr essive as it w as, by all measur es t he f irst r elease of Mac OS X w as not qu it e r ead y for m ost of t he Mac fait h fu l. I t lacked DVD playb ack, an d t he m ajor applicat ions lik e Adobe Phot oshop and

Micr osof t Off ice w er en 't released y et . St ill, it w as m or e t han usable f or t he Un ix geek s, w ho wer e am ong t he ear ly adop t er s. Man y imp r ovem en t s w ere t o com e, but Mac OS X's fir st consum er r elease sig naled t h at it w ould not be anot her failur e lik e Copland .

1.7.1 Darwin and Open Source w as of developed, •As Mac OS X Table Content s Apple m ade sur e t he Op en Sour ce fou ndat ion s of Mac OS X r• em ained open by st Review s ar t ing up t he Dar win pr oj ect . D arw in is essent ially t he non- GUI par t of Mac OS X and is a com pRev let eiewop • Reader s er at ing sy st em in it self . I f you ar e int er est ed in ru nning Dar w in sep arat ely , y ou can dow n load it for f r ee f r om App le' s Dar w in Sit e ( dev eloper .ap ple. com / dar w in/ • Er r ata ) and hav e a f ull w or k in g operat in g sy st em . I t w on't hav e t h e Mac OS X Aq ua d esk t op, but you • Academic can use Dar w in j ust lik e y ou w ou ld Lin ux , fr om t he com man d lin e and using t he X1 1 win dow • Ten Things I Dig About Pant her m anager . •

Scheduling Tasks in Pant her

Running Ma c S XofP ant r The m ain t rOee Darhewin

is k ept u nder p ret t y car eful con t r ol, aft er all, Ap ple bu ild s t he b ase t o an oper By Jamat esing Duncan syst em Davidson t hat it dist ribu t es t o m illions of people f r om t his t r ee. I n or der t o pr ov ide a place f or ex per im en t at ion, App le and t he I n t er net Soft w ar e Con sor t ium r un t he Op en Dar w in pr ojPub ectlish . You can find t h e OpenD arw in sit e at w w w . opend arw in. or g/ . er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

1.7.2Pages: Developer Tools 32 6 When App le released Mac OS X, t hey m ade a gr eat d ecision b y also decid ing t o p rov ide dev elop ment t ools t o ev ery Mac user for fr ee including t h e Proj ect Builder I DE and t h e I n t erf ace Builder GUI lay out applicat ion. Th ese ar en't j ust sim plified t ools t o learn d ev elop m en t w it h; t hey ar t he sam t ools t h at her Ap ple o develop t heAroper at ing syst self er as user well sas var ious Ruenning Mace OS X Pant is tuses he ultt im at e Sw iss my Knife( TM) ;em forit pow w hitos w ant to app licat ions. Th ese t ools allow d ev elopm en t of Carb onand Cocoabased ap plicat ion s, sy st cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac em OS libr ar com m and - lin iliting ies,s hofarPant dw arher e device dr ivw erhs,o and k ert n ex t ensions X's cories, e, rBSD evealing t he inn ere wutork f or t h ose w antevt oeng et h el e most out of t heir (syst k now n as KEXTs) . em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The D ev eloper Tools ar en 't inst alled by d ef ault becau se Apple doesn' t t h ink m ost u ser s w ill w ant t hem an d wou ld p rob ably w ant t he alm ost 5 00 MB of d isk sp ace f or som et h ing else. But dev elop er s, as w ell as pow er u ser s w ho wan t t o comp ile pr ogr am s available in sour ce code for m on t he I nt er net , can easily f ind t hem and inst all t h em fr om a var iet y of sour ces. And , since t hey ar e fr ee, any u ser w ho w ant s t o t r y dev elop in g sof t w ar e can d o so p ur ely b y inv est ing t h e t ime it t ak es t o lear n.

1.7.3 Command-Line Access I t is d iff icult t o say w h at k ind of su ccess Mac OS X w ou ld enj oy w it hout hav ing access t o t he com man d line. Accor ding t o legend , as Rh apsody d ev elop ed int o Mac OS X, t h er e w er e m any w it hin Apple w h o did n't w ant t o ship t h e Ter m inal com m and- line t ool—or at t he v er y least on ly w ant ed it inst alled as par t of t h e dev eloper t ools. Af t er all, t he com m and lin e w as seen as t he ant it h esis of t h e Mac exp er ience. How ev er, t hose w ho w ant ed t he com man d line t o b e pr esent pr evailed and t he Ter m in al shipp ed in t he / App licat ions/ Ut ilit ies d irect or y. This w as a for t u nat e m ov e indeed as a lar ge p er cen t age of t h e early ad opt er s of Mac OS X w er e not t r adit ional Mac OS user s, bu t w er e swit cher s f rom Linux and ot her f lav or s of Unix including Solar is and Fr eeBSD . Wit hou t easy access t o t he com man d lin e, t hese u ser s—a m ar k et m any at App le in 2 000 pr obab ly didn 't ex pect t o sell t o—w ould hav e never m ov ed t o t he p lat for m .

1.8 Mac OS X 10.1 The n ex t r elease of Mac OS X, v er sion 1 0. 1 ( kn ow n t o App le en gineer s as Pum a) , w as r eleased in Sep t em b er 2 001 , ju st six m ont hs aft er t h e init ial r elease of t he sy st em . W it h Pu ma, Apple focu sed on perf or man ce and en su rin g t hat t he cr it ical Carb on lay er w as r obust en ough f or anofd Content Ad obes Phot osh op t o be r eleased. Pu m a, along w it h t he lar ge inf lux of •Micr osof t Off ice Table app licat ions t hat cam • Review s e w it h it , m ade it clear t h at Mac OS X w as going t o be a success and t hat t• he st r at egy Reader f or m igr at ing fr om t he old Classic Mac OS t o t he new OS w as going t o w ork . Rev iew s •

Er r ata

The q uick r elease cy cle of Pum a also in dicat ed t hat App le w as m oving r apidly t o im pr ove t he OS • in w ays t hat Academic w er e m ean ingf ul f or bot h Classic Mac OS users as w ell as t hose sw it ch ing fr om •ot her p lat for m Ten Things I Dig About her s like W in dow s. AsPant a maint en ance r elease, it w as r eleased as a no- char ge •up gr ade—t heScheduling Tasks in Pant her on ly ver sion of Mac OS X t o d at e t hat didn 't hav e a pr ice t ag associat ed w it h it . Running Ma c O S X P ant he r

Wit h es Pum a cam e t h e r elease of t he last of t h e or ig inal iApp s t o mak e t h e ju mp f rom OS 9 : iDVD. By Jam Duncan Davidson App le' s Digit al Hu b st r at egy w as now f ully on Mac OS X, signalling t hat Apple's applicat ion dev elop ment eff ort s w er e now en t ir ely f ocu sed on Mac OS X. App le fur t h er st r engt hened t he Pub lish er: O'Reilly iApps st r at egy in Jan uar y 200 2 wit h t h e r elease of iPhot o f or m anag in g digit al p hot os, and Pub Dat e: Decem ber 2 00 3 cont inu ed in July 20 02 w it h t he r elease of iTunes 3 as an u pdat e t o t h e pop ular m usic ju kebox I SBN: app licat ion. 0- 59 6- 005 00 -8 Pages: 32 6

Also r ev ealed in July w as . Mac ( pr onoun ced " dot - Mac" ) , a suit e of I nt er net ser vices, in clu ding t hose t h at u sed t o b e par t of t he older iTools serv ice, and sof t w ar e. The new p ay ser v ice in clud ed t he McAf ee Virex v iru s scan ner and t h e new Backu p sof t w ar e for m ak ing safe b ack up s of cr it ical dat a t o .Mac. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.9 Mac OS X 10.2 Jaguar The n ex t r elease t ook Mac OS X t o t he next lev el. Un lik e p rev ious v er sions of Mac OS, App le decided t o pu t t h e codenam e, Jaguar , int o t he nam e of t he p r oduct it self. On t he box and at it s w eb sit e, it is k now n as Mac OS X Jagu ar. I t is also t h e fir st r elease of Mac OS X t o com e as t he defau lt b oot Table OS onof ev ery sy • Content s st em Apple sold, mar k ing an im p ort an t st ep in t h e t r ansit ion bet w een t h e classic Mac OS and Mac OS X. Th e Jagu ar desk t op is show n in Figur e 1- 6 . • Review s •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Jagu ar int r odu ced t he f ollowin g f eat ur es:

Qu art z Ex em Running Matcr O S Xe P ant he r By Jam es Duncan Davidson

Building on t he alr eady p ow er f ul Qu art z Com p osit or , Qu ar t z Ext r em e perf or m s m ost of it s w or k in OpenGL, allowin g it t o t ake ad van t age of t h e enor mou s pot ent ial of mod er n Pub gr lishaph er: O'Reilly ics p r ocessor s—and of floading t h e t asks fr om t he com pu t er' s CPU. Wit h Qu art z PubEx Dat Decemall berap 2 00 3 t re:eme, plicat ion s on t he sy st em hav e easy access t o 3D capabilit ies, and t his pav es tIhe lat00er-8 u ser int er face im pr ov em ent s. SBN:way 0- 59for 6- 005 Pages: 32 6

Figu r e 1 - 6 . The Ja gua r de sk t op w i t h iCha t an d i Sy nc Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Add ress Book Pr ev ious v er sions of Mac OS X had a r udim en t ar y cont act d at abase. Jaguar int r oduced a new sy st em - w ide cont act dat ab ase, along w it h a m anag em ent app licat ion, called sim ply t he Addr ess Book. W it h it s sim ple an d elegant API , t he Ad dr ess Book can be in cor por at ed int o any ap plicat ion , and all t h e built - in app licat ions on Jag uar , such as Mail and iCh at , supp ort it . •

Table of Content s



Review s

Rend ezv ous Reader Rev iew s • •

Er r ata

Built on t h e w or k of t he I ETF Zer o Conf ig ur at ion ( Zer oconf ) eff ort , Rendezv ous enab les Academic m achines t o d iscov er each ot her w it hou t u ser int er v en t ion. Th is let s y ou shar e ser v ices • Ten Things I Dig About Pant her w it h ease b et w een m achines on t he sam e n et w or k an d allow s y ou t o seamlessly conn ect t o • Scheduling Tasks in Pant her m achines by set t ing up a local n et wor k an d j ust hook in g up cab les or set t ing u p an ad hoc Running Ma c O S X P ant he r w ireless net w ork . You can find out m or e about ZeroConf at w w w .zer oconf. or g . •

By Jam es Duncan Davidson

Pub lish er: O'Reilly

iChat

Pub Dat e: Decem ber 2 00 3 I SBN:h06- 005 -8 s series of iApps, iChat is an eleg ant AI M- ( AOL I nst an t Messeng er ) Anot er59in Ap 00 ple' app licat ion t hat also lever ages t he st r engt h of Ren dezvou s t o allow chat s bet w een user s on t he local net w or k . This is h andy f or ad hoc n et wor k s such as t hose at conf er ences and ot her event s.

Pages: 32 6 com pat ible

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Window s- Com pat ible Net w ork ing cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's corLev e, rer evealing t hecapabilit inn er wies ork of ingSamb s of Pant heropen f or tsou h ose h o tw g et t he efor most agin g t he a, an rcewsof want are tpoackag w orout k ingofwtitheir h syst emt he . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Window s SMB file shar ing pr ot ocol, Jagu ar can sh are it s filesy st em s w it h Wind ows w ell onclient you sr w asay. w ell as m ount Window s- based filesy st em s. Jag uar also int rod uced t h e cap abilit y t o in t egr at e w it h Window s Act iv e Dir ect or y t o ease t h e m ig rat ion of Macs int o Wind ow sdom inat ed net w or ks. Ev en t houg h Jag uar ship ped w it h enoug h f eat ur es t o m ak e m ost people h appy , Ap ple didn 't st op t her e. Aft er Jag uar w as r eleased, Ap ple r eleased t h e follow ing pr oduct s f or it :

iCal This p er sonal calendar ing app licat ion han dles mu lt ip le calend ars and en ables shar in g of t hose calendar s v ia t h e I nt ern et . Calendar s can be p ublished eit her t h rou gh . Mac or t o any ser v er t hat suppor t s t he WebD AV pr ot ocol.

iSy nc A t ool for sy nchr onizing t h e add ress book an d calendar s on a Mac t o mob ile phon es, PDAs, and t h e iPod. iSy nc allow s inf orm at ion t o b e k ep t on m ult iple m achines by sy nchr onizin g dat a against t he . Mac ser vice.

iLif e iLif e is a b undle of n ew ver sion s of iPhot o 2, iMov ie 3, and iDVD 2 along w it h alr ead y av ailab le iTunes 3 as a sh rink - w r app ed , box ed p rod uct av ailable for sale in st or es. Even t hou gh iLife has a cost associat ed w it h it , iPhot o, iMovie, and iTun es rem ained fr ee dow n load s. Only iDVD is av ailab le ex clusively t hr oug h iLife.



Table of Content s

Safar i •

Review s

• • • • •

Reader Rev iew s

A b r and new br ow ser wit h a high ly - t u ned r ender ing engine, Saf ari r ep laces Micr osof t 's Er r ata I nt er net Exp lor er as t h e br ow ser of choice on Mac OS X. Th is br ow ser f ul- f illed a r eal n eed Academic as ev id en ced by t he fact t hat t her e w er e 5 00, 00 0 dow nloads of t he pu blic bet a b et ween Ten Things I Dig About Pant her Janu ary 7 an d 9, 20 03. Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.10 Mac OS X Panther Pant h er , t h e nam e giv en t o v er sion 10. 3 of Mac OS X an d t he syst em t h at t h is book cov er s, br ing s anot h er h ost of im pr ovem ent s t o t he sy st em and con t inues in t he Mac OS X t r adit ion of " I t 's get t ing bet t er all t h e t im e. " A f ew of t he im pr ov em ent s m ade t o t h e syst em ar e: •

Table of Content s



Review s



Reader Rev iew s

• n ew Find erEr r ata A •

Academic

The Find erThings t hat sh ip ped witPant h Mac Ten I Dig About her OS X 10. 0 t hr ou gh 10. 2 w as a sim plified in t erp ret at ion of t he classic Find erTasks fr omin tPant h e or • Scheduling herig inal Mac OS t h at w as d esign ed t o w ork on a sin gle- user syst em t he Running Ma c O S. XOn P ant he rmu lt iuser Mac OS X, t his m eant t he f iles t h at t he t y pical user cared abou t —t hose in t heir Hom e dir ect or y —w er e locat ed t hr ee lev els away fr om t h e filesy st em By Jam es Duncan Davidson r oot . •

Pub The lish er:n O'Reilly ew Fin der

in Pant her , show n in Figur e 1- 7 , int rod uces a new Sid eb ar on t he left - h and w indow t hat giv es you qu ick access t o t he var ious d isk s at t ached t o yI SBN: our com put y our d irect or y, and any ot h er locat ions t hat you pu t t here. Wh en y ou 0- 59 6005er 00, -8 select32a6 disk or a f older f rom t he Sidebar , it becom es t h e st art of w hat you see in t he Pages: w indow view . And , chang in g a par adig m in place since 1 984 , r em ov able disk s can b e eject ed or d isconn ect ed by click ing on an ej ect icon in t he Finder 's Sid eb ar, rat her t han hav ing t o dr ag d isk s t o t he Tr ash.

Pubside Dat e:of Decem 2 00 3 everber y Fin der

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Ex posé X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst emBuilding . You m on ay not Mac gu ru tw oue,stEx ar posé t t his int book b ut once 'v et o r ead be t he be powa er of Quar z hen Ex t r yem r od, uces a newyou w ay w oritk, wyou it h'llt he w ell ondozens you r wofay. win dow s t hat ar e open on t he t y pical Mac OS X user ' s deskt op . I nst ead of h aving t o dig t hr ough t h e open win dow s one by one, y ou can u se eit her a k ey st rok e or a m ouse gest ur e and p er for m on e of t hr ee act ions: Show all t he w ind ow s open in m iniat u re so you can see all of t h em at on ce. Show all t he w ind ow s belonging t o a p art icular applicat ion. Clear all t h e w indow s of f t he screen so y ou can see t he deskt op. These act ions can be set t o a v ar iet y of k eyst r ok es and mou se gest ur es b y using t he Ex posé p refer ence panel in Sy st em Pr efer ences.

Figu r e 1 - 7 . Pa n t he r 's D esk t op an d t he n e w Fi nde r



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r it wch ay.in g Fast User Sw Built on Unix , Mac OS X has alw ay s allow ed m ult iple users and allow s t here t o b e mu lt iple users logged in at once v ia t h e com m and line. Pant her t ak es a cue f rom Window s XP and int r odu ces t h e capabilit y f or m ult iple users t o b e logged in t o t he GUI at t h e same t im e. When y ou chan ge u ser s, t he n ew desk t op r ot at es int o place giv in g a v er y clear indicat ion t hat y ou are ent er ing int o anot her u ser 's desk t op; an ex am ple of t h e m any w ay s in wh ich t he gr aphics abilit ies giv en t o t he sy st em b y Qu art z Ex t r em e h ave been pu t t o use.

Fast App licat ion Sw it ching You can q uickly sw it ch b et w een ap plicat ion s using t he - Tab k ey st r oke. This feat ur e w as pr esent in pr ev ious ver sion s of Mac OS X, bu t in Pant h er it w or ks t he sam e w ay it d oes in Wind ows, f eat ur ing an elegant t r anspar ent w in dow t h at ap pears on scr een t o allow y ou t o see wh at ap plicat ion y ou are sw it ching t o.

Secu rit y Pant h er int r oduces a h ost of secur it y f eat ur es design ed t o m ake dat a saf e. The new FileVault feat ur e can en cry pt t he con t en t s of y our hom e d irect or y so even if som ebody get s ph ysical access t o you r disk, t he cont ent s of you r files ar en 't exp osed. When it ' s t im e t o

emp t y y our Tr ash, y ou can choose t o ov er w r it e t he d elet ed files wit h r and om dat a so t he old files can not be r ecov ered. I n addit ion, all t he GUI ap plicat ion s in Pant her , and m ost of t h e comm an d- line ones, ar e aw ar e of t he Ker ber os secur it y ser v ices t h at Pan t her m ak es av ailable. Kerb er os is a cry pt ogr aphic secu r e net w ork aut hent icat ion pr ot ocol t h at enables single sign - on. Af t er ent er in g you r passwor d w hen you log in, all of y our net w ork ap plicat ion s, such as Mail, can aut om at ically log in t o Ker beros- enabled ser v er s. •

Table of Content s



Review s



Reader Rev iew s



Er r ata

Font Book •

Pant h erAcademic ' s Font Book applicat ion b uilds ad van ced fon t m anag em ent int o Mac OS X. I nst ead Ten Things her em , Font Book let s y ou act ivat e and deact iv at e f ont s on of m anagin g f ontI sDig v iaAbout t he fPant ilesyst • Scheduling Tasks in Pant her t he fly , or ganize t h em int o collect ion s, and pr ev iew fon t s. I t also allow s y ou t o t ak e Running Maant c OS r ur es, ker ning , and m any ot h er fon t f eat u res. adv agX eP ant of he ligat •

By Jam es Duncan Davidson

Pub lish er: O'Reilly

iDisk Syn chr onizat ion Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59on 6- 005 00 -8 Building t he .Mac online serv ice, iDisk is now a perm an en t f ix t u re in t h e Fin der. As a in Pant her , y ou can opt t o hav e you r iDisk sy nchr on ized w it h you r comp ut er . This allow s y ou t o w or k t r anspar ent ly w it h t he sam e f iles on m ult iple m achines w het her or not y ou ar e on lin e at t he t im e y ou w an t t o w ork wit h t h em . Th e only cat ch is t hat you hav e t o dedicat e as m uch sp ace on y our local h ar d d riv e as y ou hav e on you r iDisk, wh ich w it h a b asic .Mac accou nt is 1 00 MB.

new f eat Pages: 32 6 ur e

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor Tools e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Xcode syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell onAsyou ay. parr t wof Pant h er , Ap ple r ev am ped t he d ev elop er t ools, replacing Pr oject Builder w it h a new I DE called Xcode an d d ubb in g t he ent ir e t oolset Xcode Tools. I ncluding t h e Xcode I DE, I nt er face Builder , gcc 3 . 3, u pdat ed docum ent at ion, and perf or m ance t ools. Xcod e pr ov id es ever yt hing y ou n eed t o d ev elop ap plicat ion s on, and for , Mac OS X.

Installing the Xcode Tools You can q uickly check t o see if you h ave Xcode Tools in st alled by seeing if y ou hav e a / Developer f older on y our har d dr iv e. I f so, y ou are ready t o go. I f n ot , y ou' ll need t o inst all t h e t ools eit her fr om t h e Xcode Tools CD t h at cam e w it h y our cop y of Mac OS X or fr om a disk imag e t hat y ou can dow nload f rom t he App le Developer Con nect ion ( ADC) w eb sit e. I f y ou b ough t y our Mac w it h Mac OS X inst alled on it , y ou' ll fin d t h e Xcode Tools d isk im age on y our h ard d riv e. A special not e: Apple p rov ides r egular u pdat es ( t w o t o t hr ee t im es a year ) t o t he Xcode Tools t h rou gh t he AD C w eb sit e. Th ese r eleases int r odu ce n ew feat ur es, fix bu gs, and im pr ove t he av ailable docum ent at ion. I f y ou don 't w ant t o dow n load t h e r at her lar ge f iles, App le w ill send y ou a copy on CD for a n ominal char ge. Log in t o t he ADC Mem b er w eb sit e and go t o t h e Pur chase sect ion.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

1.11 What Does the Future Hold? Wit hou t a doub t , App le has m any mor e f eat ur es in st or e for fut ur e ver sion s of Mac OS X. Th er e ar e m any at Apple w h o say bu ild in g on t op of Unix has allow ed t he com pany t o inn ovat e fast er t han ex pect ed—and w it h f eat ur es lik e Ex posé b uilding on t op of Quar t z Ex t rem e I 'd hav e t o gh nobod y out side Ap ple' s headq uar t ers in Cuper t ino h as a clue as t o w hat •agr ee. So, even Tablet hou of Content s m ay be com ing up nex t , it is cer t ain t hat Mac OS X w ill cont inu e t o b reak n ew gr ound . App le' s • Review s choice t o u se Unix —a well u nder st ood, st able, and t im e- t est ed desig n—as t he fou ndat ion of t h e • Reader Rev iew s syst em m eans App le can f ocus on innov at ing abov e Unix and cont in ue t o br ing imp rov em en t s in • Er r ata t he way t hat w e use t he sy st em . •

Academic

•What ev er plans Ten Ap Things Dig About ple Ihas, it hasPant surher ely not iced t h at Micr osoft adopt ed sev eral of Jaguar ' s •feat u res int o Scheduling Tasks in Pant her Wind ows XP and t h at t h e nex t v ersion of Window s—codenam ed Lon ghor n—has a Running S X Pbor antrow he r s feat u re Ma listc O t hat

m an y m ore f eat ur es fr om Pan t her. What ev er Apple has up it s sleev e, it 'sJam saf t o say Davidson t hat t he com pany is awar e of t h is and fu lly in t en ds t o leap fr og Long hor n ev en By eseDuncan befor e it finally show s u p. Pub lish er: O'Reilly

En ough abou t t h e past and t he f ut u re. Let ' s look at w hat you can do w it h Pant h er t oday ! Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 2. Lay of the Land When y ou f irst log in t o Mac OS X y ou see a user int erf ace t hat is t he end r esu lt of 20 y ears of dev elop ment ; qu it e a b it of w or k has g one int o m aking it an elegant and usable in t er f ace for y our com put er . Pan t her' s new Find er goes ev en fur t h er , b en ding t he com pu t er' s v iew of t he •w or ld t o y ourTable of allow Content s y ou t o v iew t he f ilesy st em an y w ay y ou w an t t o. Un dern eat h it all, ow n, ing •how ev er , Mac Review OS Xs is a st r uct ur ed en vir onm ent based on Unix and t o t ru ly m ast er it you 'll n eed •t o kn ow how Reader s her . it all f Rev it s tiew oget •

Er r ata

he sy st em , you use t w o pr ogr am s: The GUI - based Find er , an d t he com m and- lin e•To n avig at e tAcademic Each of t hese ogr her am s giv es access t o d iffer ent lay ers of t he sy st em . For som e •based Ter m inal. Ten Things I Dig AboutprPant is t h eTasks bestint ool •t ask s, t he Finder Scheduling Pantfor her t h e job . For ot her s, using t he Ter m in al is a w ay of lif e. Running Ma c O S X P ant he r

This chap t er ex plains how t h e filesy st em in Mac OS X is pu t t oget her and show s y ou how t o By Jam es e Duncan nav igat y our Davidson w ay t hr oug h it using t he Find er an d t he Ter min al. Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

2.1 Filesystem Hierarchy Lik e m ost ot h er filesy st em s, t h e Mac OS X f ilesyst em is concept ually a hierar chical t r ee- b ased st r uct ur e t hat br anches f r om a r oot . I n t h e case of Mac OS X, t he f ilesyst em is r oot ed on t he dr iv e par t it ion t hat t he sy st em b oot ed f r om. I n t h e t y pical case w h er e y ou boot off t he sin gle h ard d riv e st hat is in you r m ach ine, y our f ilesyst em is r oot ed t here. I f y ou hav e •par t it ion of t he Table of Content m or e t han one d isk d • Review s r iv e, t hen t he filesy st em is root ed fr om wh ich ev er par t it ion you boot ed fr om . Likew ise, if y ou boot f r om an ex t er nal d isk d riv e or ev en a disk imag e on a net w or k ser v er, • Reader Rev iew s t he filesy st em w ill be r oot ed f r om t her e. Figur e 2- 1 sh ows a Finder w ind ow display in g t he boot • Er r ata disk 's f ilesy st em . •

Academic

•The st r uct u reTen I Dig About Pantst her of Things t he Mac OS X filesy em at t h e r oot level is v er y st rict , an d alm ost ev er y f ile t hat •Mac OS X need Scheduling Tasks in Pant her s t o r un h as a specif ic place w it hin it . Som e of t he folder s at t he r oot of t h e Running Ma car OS ant hein r filesyst em e Xv P isible

t he Find er w hen y ou click on y our boot dr iv e, ot her s are not .

By Jam es Duncan Davidson

Pub lish er: O'Reilly

Figu r e 2 - 1 . The Fin der sh ow i ng t h e boot disk

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

2.1.1 The Filesystem through the Finder The f older s at t h e r oot of t h e filesy st em t hat ar e v isible in t he Find er are:

App licat ions This f older cont ains ap plicat ion s t hat ar e av ailab le t o all u ser s on t he sy st em . Most

app licat ions t hat Apple ships for Mac OS X ( such as iCal, iPhot o, an d Safar i) ar e locat ed her e. I n ad dit ion, a larg e nu mb er of usef ul u t ilit y pr ogr am s, su ch as t h e Term inal and Act ivit y Monit or , ar e inst alled in t he Ut ilit ies sub folder .

Develop er I f you hTable ave of in Content st alled st he dev elop er t ools on you r sy st em, m ost of t he ap plicat ion s, docum ent at ion Review s , exam ples, and ot her f iles n eeded for building app licat ions for Mac OS X ar e locat ed her e. Reader Rev iew s

• • • •

Er r ata



Academic

•Libr ar y

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running This Ma cf O older S X P ant cont heains r

ap plicat ion - an d sy st em - specific r esou rces, su ch as f ont s and app licat ion pr eferences, t hat ar e needed b y all t he user s on t he sy st em. I n som e r espect s, By Jam es Duncan Davidson t his f older is like it s nam esak e in t hat it h old s a lot of useful in for m at ion for t h e v ariou s par t s of t h e syst em . Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Sy st em Pages:

32 6

This f older cont ains t he r esou rces used b y t he op er at in g sy st em it self. Mac OS X is v er y par t icular abou t t he files in t his dir ect ory and w ill pr ev ent you f rom messin g w it h t h em . I t 's best t o con sider t h is dir ect or y st r ict ly Ap ple's d omain . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e and the Finder wFile ell onExtensions you r w ay. By def ault , f ile ex t ensions, t he p ar t of a filen am e t hat com es af t er t he d ot , ar e hidd en in t he Find er . Th is m ean s a f ile nam ed DialUpNum ber s. t x t w ill ap pear in t he Finder , by d ef ault , as DialUpNum ber s. Som e f olks, especially old- t im e Mac OS 9 users, p r ef er t his app r oach as t h ey wish t o look at t he icon t o det er m ine w hat k ind of file it is. Ot her s, how ever , includin g m ost of u s w ho cu t ou r t eet h on Unix, pr ef er t o see t he f ile ex t ensions int act . To m ak e f ile ex t ension s v iew able all t he t im e, use t h e Fin der Pr ef erences m en u ( , ) , click on t h e Adv anced b ut t on in t he t oolb ar, and t hen click on t he checkb ox nex t t o " Show all f ile ex t ensions" .

User s This f older cont ains t he Hom e fold er s f or t he user s on t he sy st em. Wit hin a Hom e fold er , a user is t he mast er of his d om ain . Ou t sid e a u ser 's Hom e f older, t he ab ilit y t o m ake chang es is gr eat ly lim it ed an d depends on t h e t y pe of user t hey ar e. I f t he Classic Mac OS 9 en vir onm ent is inst alled on you r m achine, y ou' ll also see t h e follow ing fold er s:

App licat ions ( Mac OS 9) This f older cont ains ap plicat ion s t hat ar en 't desig ned t o r un on Mac OS X.



Table of Content s

• Review s Desk t op Folder • • • •

Reader Rev iew s Er r atacont ains all t he f iles an d f olders t hat are par t of t h e Mac OS 9 desk t op . This This f older fold er is Academic usef ul w h en y ou boot back and for t h bet w een Mac OS 9 and Mac OS X and need t o get tTen o t he f ilesI Dig t hatAbout y ou Pant lef t her on t h e Mac OS 9 deskt op . Things



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Docum en t s Pub lish er: O'Reilly

t he ber t r adit PubThis Dat e:is Decem 2 00 ional 3

folder in Mac OS 9 for st or ing y our d ocu ment s and is placed h er e f or conv en ien ce. I n Mac OS X, y ou sh ould alw ay s u se t he Docum ent s f older in you r Hom e I SBN: 0- 59 6- 005 00 -8 fold er in st ead of t his f older .

Pages: 32 6

Sy st em Folder Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o This f older cont ains t he Mac OS 9 syst em and sup por t ing files. cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir These fold er s ar en't par t of Mac OS X b ut ar e locat ed at t h is lev el of t he f ilesy st em f or ease of syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e use w hen y ou b oot int o Mac OS 9 fr om t he dr iv e. w ell on you r w ay.

2.1.2 The Filesystem Under the Hood The Find er ' s view of t h e filesy st em doesn' t r eveal ev er y t hing t h at 's t here. Th e Fin der is ju st one v iew , an d f or m ost u ser s it is su fficient b ecau se it k eeps h idden sy st em files, ot her wise k now n as dot files, f r om view . The Ter m inal ( / App licat ions/ Ut ilit ies) , h ow ev er, let s y ou div e beneat h t he pr et t y GUI v iew and see ev ery t hin g in t he filesy st em . Ex am ple 2- 1 sh ows t he ou t put of t he ls com man d.

I am going t o g ive y ou a lit t le b it m or e gr ound ing in t he Term inal in t h e nex t chap t er . For n ow, just play along .

Exa m pl e 2 - 1 . Th e com m a nd- li ne v ie w of t h e f il esyst e m r oot

$ ls /

total 8457



Applications

Network

Volumes

etc

private

Desktop DB

SalesBackups

automount

mach

sbin

Desktop DF

System

bin

mach.sym

tmp

cores

mach_kernel

usr

dev

mypants

var

Table of Content s Developer Temporaryn Items



Review s



Library Reader RevUsers iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

As y ou can see, hishe isr a mu ch dif fer en t v iew of t he f ilesy st em t han you 'll see in t he Finder . Som e Running Ma c O S X Pt ant of t he folder s—App licat ions, Libr ar y, Net w ork , Sy st em , an d User s—ar e t he sam e as t hose in t he By Jam es Duncan Davidson Finder , bu t m any ar en' t ex posed . You' ll see t his k ind of diff er ence t im e and again in Mac OS X. The GUI gives y ou a f ilt er ed v iew of t he sy st em , and most of t he t im e t h is filt ered v iew is ex act ly Pubyou lish er: w hat w O'Reilly ant . The Ter m in al, on t he ot h er hand , giv es t he r aw v iew of t he sy st em givin g y ou Pub Dat e: access Decem ber 3 d ep t hs of t h e sy st em. un fet t ered t o2 00 t he I SBN: 0- 59 6- 005 00 -8

The f older and Pages:s 32 6 files v isible u sin g t h e comm an d line at t h is lev el but hid den in t he Find er are:

Desk t op DB Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Deskem t op. You DF m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e syst w ell on you r w ay. These ar e t he h idden files behind Mac OS 9' s desk t op. Th e Desk t op fold er in t h e Fin der v iew uses t hese f iles t o pr esen t y our Mac OS 9 d esk t op t o y ou w hile you ar e boot ed int o OS X.

Net w ork This v ir t ual f ilesy st em allow s y ou t o b row se t h e filesy st em s sh ared fr om serv er s on you r net w or k.

Volu m es This d irect or y con t ains all t he disk s, ot her t han t h e boot disk, t hat are at t ach ed t o y our com put er . For exam ple, ex t er nal Fir eWire disk s ( in clud ing an iPod ) as w ell as CDs, w ill show u p here.

aut om ou nt

This d irect or y con t ains link s t o any f ilesyst em s m ount ed fr om net w ork f ile ser v er s u sing net w or k pr ot ocols such as AFP, NFS, an d SMB.

bin This d irect con t ains Tableorofy Content s m any of t he execut ab le Un ix pr ogr ams t hat you r syst em needs.

• •

Review s



Reader Rev iew s



Er r ata

• cores

Academic



Ten Things I Dig About Pant her

This d irect or y con t ains ash Scheduling Tasks in cr Pant herf iles f or t he var ious Unix p rog ram s. Th is is t he t r adit ion al locat w hich Running Ma c ion O S XinP ant he r Unix p r ogr ams wr it e ou t t h eir cr ash d at a. •

By Jam es Duncan Davidson

Pub lish er: O'Reilly

dev Pub

Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

This d irect or y con t ains t h e v arious device nod es for t h e syst em . One of t he cor e ideas of Unix is t hat t he var ious d ev ices can be t reat ed as a f iles—includin g som e dev ices t h at y ou nor m ally w ouldn' t t hink of as b ein g a file. The dev t ree cont ain s t he " f iles" t hat repr esent ever yt hing at t ached t o t h e oper at ing sy st em.

Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS et c cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir X's syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e This d irect or y con t ains conf igur at ion files used b y t he v ar ious Unix com ponent s of t he w ell on you r w ay. syst em .

m ach, m ach. sy m , an d m ach_k ern el These files m ake up t he k ern el, t he cor e par t of t he oper at ing syst em t hat m anag es ever yt hing else.

pr ivat e This is t he dir ect or y t h at act u ally cont ain s t he et c, v ar, an d t m p d irect or ies. Th ese dir ect or ies act ually don 't liv e at t his level of t he f ilesyst em bu t ar e link ed in t o t h e r oot ( / ) dir ect or y .

sbin This d irect or y con t ains sy st em ex ecu t ables need ed at st art u p as w ell as som e conf igur at ion ut ilit ies for t he sy st em .

tm p This is a place for t he t em por ar y files t hat some Un ix pr ogr ams cr eat e. •

Table of Content s



Review s

• usr

Reader Rev iew s



Er r ata

This d irect or y con t ains t h e Un ix t ools and libr ar ies t h at ar e int en ded f or all u ser s on t he Academic syst emTen . Things I Dig About Pant her

• • •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

v ar Pub lish er: O'Reilly

This d irect or y con t ains d at a t h at chan ges fr equent ly such as m ail spools an d log files. The disk f iles t h at im plement t he backing st or e f or vir t ual m em or y ar e also held here.

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Pages: 32 6

2.1.2.1 More hidden files Ther e' s act ually anot her layer of h id den files beyon d w h at y ou see w it h t he ls com m and. I f y ou chang e t he com m and and add an - a op t ion ( t o show all files) , you 'll see t he ex t r a f iles show n in Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Ex am ple 2- 2. cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Exa m pl e r 2w-ay. 2 . Hid den f il es in t h e r oot d ir e ct or y w ell on you

$ ls -a / .

.vol

Network

bin

mach_kernel

..

Applications

System

cores

private

.DS_Store

Desktop DB

Temporary Items

dev

sbin

.Trashes

Desktop DF

Users

etc

tmp

.hidden

Developer

Volumes

mach

usr

.hotfiles.btree

Library

automount

mach.sym

var

The . DS_St or e f ile cont ains t h e Fin der set t in gs an d t he com ment t ext f or t he v ar ious f iles w it hin t he folder . The r est of t h ese f iles ar e, w ell, f iles t hat you r eally d on't need t o see. Th ey are hidd en f r om t he com m and- line view w hich indicat es t hat you shou ld on ly mess w it h t hem if y ou r eally n eed t o an d y ou k now w h at y ou are doing.

2.1.2.2 Opening hidden directories in the Finder Ev en t houg h t h e Fin der hid es t hese d irect or ies f r om y ou, t h er e is an easy way t o g et t o t hem. Sim ply use t h e Go To Fold er com m and ( Go Go t o Folder or Sh if t - - G) and ent er t he pat h t o t he folder y ou w ant t o see. An ex amp le of t his is show n in Figur e 2- 2 . •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Figu r e 2 - 2 . The Go To Fol der dia log

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

I f you w ant t o see ev er y f ile on y our sy st em all t he t im e, y ou can do so by t yp ing t he f ollow in g com man d: $ defaults write com.apple.Finder AppleShowAllFiles YES

Then, eit h er log out and log back in, or just giv e t he Find er a few m inu t es t o p ick u p t he chang e. This seem s cut e at f irst ( and some people m ay fin d it useful) , but it can quick ly becom e ir rit at in g, so y ou m ight find y our self pr efer r in g t he Finder 's r egu lar view inst ead. To r ev er se t his set t in g, u se t he f ollow ing com m and: $ defaults write com.apple.Finder AppleShowAllFiles NO

This com m and uses t he d ef ault s sy st em w h ich I 'll t alk about in Ch apt er 9, Pr ef erencesand Default s.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

2.2 The Many Roots of the Finder Pant h er ' s new Finder allow s y ou t o ign ore t he w ay t h e filesy st em is st r uct ur ed at t he com m andline level an d look at it in a var iet y of w ays t hat are mor e r elev ant t o ev er y day t ask s. By select ing one of t h e it em s in t he Sid eb ar ( show n in Figur e 2- 3 ) , t h e v iew t o t h e rig ht of t he ges tof o Content rev eal st hat folder 's con t en t s, or specif ic det ails about a select ed file. •Sidebar chanTable •

Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Figu r e 2 - 3 . The Fin der ' s si de bar

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

The m ost usef ul f eat ur e abou t t h is new t ool in t h e Fin der is t hat it g iv es y ou quick access t o you r Hom e fold er ( wh ich is usually t h e cen t er of act iv it y on y our com put er ) , or t o any ot her fold er t hat y ou place in t h e Sidebar .

2.2.1 The Home Folder All t h e files, applicat ions, pr efer en ces, and r esou rces t hat ar e y our s and y our s alone ar e locat ed w it hin you r Hom e fold er . Th is is w here y ou should m ake all you r m odificat ions an d addit ions. I f y ou ar e an old- school Mac OS 9 u ser , t h is is w here y ou should feel like cu st omizing y our sy st em . And , even bet t er, if y ou play b y t he r ules, y ou'll be able t o m ov e t o a new m achine sim ply by copy ing you r Hom e folder . The f older s you 'll f ind inside y our Hom e f older ar e:

Desk t op Con t ains all t h e files and fold er s t h at ap pear on t he Mac OS X deskt op f or t he u ser .



Table of Content s



Review s

Docum en t s Reader Rev iew s • •

Er r ata

I nt end ed t o con t ain y our docum en t s. Of cour se, you can sav e y our d ocu m en t s any w her e in Academic y our Hom e f old er , b ut t his is t h e r ecom m en ded locat ion. I t is also t he default locat ion t h at Ten Things I Dig About Pant her w ill be p rop osed for you w hen y ou sav e a d ocu m en t f rom an ap plicat ion .

• • •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Libr ar y

Pub lish er: O'Reilly PubCon Dat e:t ains Decem ber licat 2 00 3ionapp

and user - sp ecific r esour ces t h at b elong t o a sing le user only. This I SBN: s 0- you 59 6- 005 -8 e fon t s on t he sy st em t hat nobod y else can use. I t also allow s y our allow t o 00 hav app licat Pages: 32 6ions t o sav e you r pr efer en ces separ at e fr om t hose of ot her user s.

Mov ies Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust omI nt ize, andt ain g enyer allymov r evies. u p This t heir isMac. b ook t ak esesreader deepf iles. in side Mac OS endt wedeak t o, con our w herThis e iMov ie cr eat it s prsoject X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Mu sic I nt end ed t o con t ain y our mu sic. Th is folder is w her e iTun es k eep s it s dat a f iles as w ell as y our MP3 an d AAC f iles.

Pict u res I nt end ed t o con t ain y our digit al p hot ogr ap hs. iPhot o keeps it s d at a h er e—including ph ot os y ou u pload fr om a cam er a.

Pub lic I nt end ed t o con t ain t he files t hat y ou are w illing t o shar e w it h ot her u ser s, eit her on t he sam e mach in e or acr oss t he net w or k .

Sit es I nt end ed t o hold you r per son al w eb sit e, w hich can be ser ved by Mac OS X' s bu ilt - in w eb ser v er. When p er sonal web shar ing is t ur ned on, t h ese d ocu m en t s can b e accessed by passing a p at h of t he pat t er n ~ usern am e. For ex amp le, a user w it h t he user nam e nor m an could access t hese docum ent s f rom his m achine w it h t he URL ht t p: / / localhost / ~ nor m an/ . Ev en if y ou don' t ru n a w eb serv er on t he p ublic I nt er net , t h is is a h andy w ay t o pu blish files t o ot her people on t h e net w ork . •

Table of Content s



Review s

Rev iew s 2.2.2 The Reader Command-Line View of a Home Folder • •

Er r ata



Academic

Unlike t he base of t h e filesy st em, t he com m and- line v iew of t he Hom e f older look s pr et t y m uch • Things I Dig About Pant her t he sam e as Ten w h at y ou see in t he Find er . Th e only d if fer en ce is, usin g t he com man d lin e you can •see t he hid den Scheduling Tasks in Pant " dot " files t hat youher can' t ( b y defau lt ) see in t h e Fin der , as show n in Ex am ple 2- 3. Running Ma c O S X P ant he r By Jam es Duncan Davidson

Exa m pl e 2 - 3 . Th e com m a nd- li ne v ie w of t h e Hom e f olde r Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

$ Pages: ls -a32 6 .

Desktop

Music

..

Documents

Pictures

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o .CFUserTextEncoding Library Public cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f orSites t h ose w h o w ant t o g et t h e most out of t heir .Trash Movies syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

These dot files ar e eit h er self- ex planat or y or are f iles t hat you usually d on't need t o w or ry about . The on e t hin g y ou should not ice is t he ~ sym b ol w hen you fir st op en a Ter m inal. Th is sy m bol is a shor t han d f or y our Hom e d ir ect ory . Fr om any w her e on t he sy st em y ou can con st r uct a p at h using t he ~ sym bol, and t he op er at ing sy st em w ill au t omat ically use t h e fu ll pat h t o you r Hom e dir ect or y .

2.3 Filesystem Domains I n our discussion abou t t h e filesyst em , you 'v e no dou bt id en t ified a cer t ain am ount of r ed und ancy. There' s a Libr ar y f older at t he r oot of t he f ilesyst em , one in y our Hom e f older, and one in t h e Syst em f old er . An d if y ou creat e an App licat ions f older in you r Hom e folder t o st or e hat aren' t f or suse b y ot her s, you 'll n ot e t hat it au t om at ically g et s t he sam e folder •app licat ions tTable of Content icon as t he App licat ions f older at t he r oot of t he f ilesyst em , as show n in Figur e 2- 4 . • Review s •

Reader Rev iew s



Er r ata



Academic



Figu r e 2 - 4 . The Loca l an d Use r d om a in s in t he Fin der Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Where to Put Your Applications The v ar ious f ilesy st em d omain s giv e you a ch oice as t o w h er e t o put y our app licat ions. I f y ou are t he only u ser on a sy st em t hat is going t o be u sing an app licat ion, you should consider pu t t ing it int o an App licat ions f older in you r Hom e fold er . Th is w ill keep t hem sep er at e f r om all of t he applicat ions t hat com e on t he syst em in t he / App licat ions f older . How ev er, t her e ar e man y app licat ions—t y pically older app licat ions t hat hav e been m igr at ed fr om Mac OS 9 , t hat hav e t o be inst alled in t he / App licat ions f older . Ther e' s no w inning som et im es, but at least f or m any app licat ions, w h at dom ain y ou p lace t hem int o is you r choice.

This is t he r esult of a concept kn ow n as Filesy st em Dom ains an d is st r uct ur ed in such a w ay as t o allow mu lt iple users t o shar e t h e sam e sy st em or t o b e host ed on a ser v er so t hey can use m ult iple sy st em s and y et p rov ide a consist ent exp er ien ce.

Ther e ar e fou r dom ains in Mac OS X:

User Con t ains t h e resour ces for a user logged in t o t he sy st em . As you w ould exp ect fr om t h e similar Table it y ofofdescr ipt ion s, t his dom ain is cont ained wit h in t he user' s Hom e f old er . Content s

• •

Review s



Reader Rev iew s



Er r ata

• Local

Academic



Ten Things I Dig About Pant her

Con t ains t h e resour ces hather user s of a par t icu lar syst em shar e w it h each ot her . The local Scheduling Tasks in tPant dom con sist Running Ma cain OS X P ant hesr of t h e App licat ions an d Libr ar y folder s at t he r oot of t he f ilesyst em . These r esour ces ar e available t o user s of t he sy st em b ut are not available t o users on n et w or k ed By Jam es Duncan Davidson com put er s. •

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Net w ork

Pages: 32 6

Con t ains t h e resour ces available t o all users of a local ar ea net w or k. Applicat ions, docum ent s, an d ot her r esour ces locat ed in t his dom ain are available on any machin e t hat is par t of t he n et w or k . The f older s t hat hold t his d omain v ary accor ding t o net w ork set up bu t t y pically appear as a Net w ork folder in t he Finder . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Sy st em w ell on you r w ay. Con t ains t h e resour ces requ ir ed for t he syst em t o r un. Th ese r esour ces ar e par t of t he oper at ing syst em inst allat ion an d can only b e m odified by adm inist r at iv e user s. When a r esour ce is requ est ed by an app licat ion, Mac OS X sear ches t h ese dom ains—in t he or d er abov e—t o sat isfy t he r eq uest . For exam ple, w hen an applicat ion r equest s a par t icu lar fon t , t he syst em w ill sear ch t he Font s dir ect or y in t he User dom ain f irst . I f it doesn 't find t h e fon t t h er e, it w ill look in t he Local dom ain . I f it d oesn' t f ind it t h er e, it will look in t h e Net w or k d omain, and fin ally it w ill look in t he Sy st em d om ain . This h ier ar ch ical sear ch allow s a user ' s con figu r at ion f ile t o ov err ide a syst em - w id e pr efer en ce. Fur t her mor e, t h e con sist ency in nam ing of dir ect or ies bet w een t he d om ain s, su ch as t he Libr ar y dir ect or y t h at ap pears in each dom ain , allow s for easy m anag em ent of resour ces.

2.4 The Library I 'v e m ade lot s of refer ences t o t h e Libr ar y d irect or y and hav e ind icat ed t hat it is f or t he st or ag e of r esour ces. Any k ind of resour ce t hat an applicat ion n eeds can be locat ed in t he Lib rar y . Here' s a list of som e of t h e most comm on dir ect or ies y ou'll find in t he Lib rar y an d t he k inds of r esour ces ( and ofr em em ber •t hey cont ain Table Content s , y ou can cr eat e on e of t hese dir ect or ies in a dom ain in w h ich it doesn' t ex ist ) : • Review s •

Reader Rev iew s



Er r ata



Academic

• Ten Things I Dig About Pant her App licat ion Supp ort •

Scheduling Tasks in Pant her

Con t ains ir dRunning Ma c O S X tPhant hepar r ty

plug - ins, helper app licat ions, t em plat es, and even dat a for t he app licat ions on y our sy st em . You'll usually find t h e r esour ces for an app licat ion in a By Jam es Duncan Davidson subd irect or y nam ed af t er t he ap plicat ion . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Aud io

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Con t ains dr iv er s, plu g- ins, and soun ds f or Mac OS X's audio su bsyst em s.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Caches cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Con t ains t em por ar y dat a used by t he ap plicat ion s on you r sy st em. For ex am ple, Safar i w ill syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e k eep w eb p age dat a her e so w hen you r evisit a page, y ou don 't hav e t o d ow nload all t he w ell on you r w ay. cont ent on it again.

Calen dar s Con t ains t h e I CS f iles u sed t o st or e t h e calend ar dat a for a user. This dir ect or y is u sed by iCal an d only app ear s in t he User dom ain.

Color Syn c Con t ains pr of iles an d scr ip t s used by Mac OS X' s Color Syn c color man agem en t subsy st em .

Docum en t at ion Con t ains docum ent at ion f or v arious par t s of t he sy st em. Also, t he Help ap plicat ion uses t his f older t o hold files t hat it display s.

Favor it es Con t ains aliases t o fr equ en t ly accessed folder s, files, or w eb sit es. This dir ect or y on ly app ear s in t he User dom ain.



Table of Content s

• Font s

Review s

• • •

Reader Rev iew s

Con t ains Er r ata f ont s f or app licat ions t o use. This f ont s in t h is dir ect or y ar e easily m anag ed using Font Book ( / App licat ions) . Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam ew es Duncan Fram or ks Davidson

the Pub Con lish er:t ains O'Reilly

fr am ew or k s and shar ed libr ar ies t hat applicat ions need t o op er at e.

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

I n t ern et Plu g- I n s Con t ains t h e var ious h elp er applicat ions, such as t he Flash Play er , t hat ex t end t he fu nct ionalit y of y our w eb br ow ser s. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst Mailem . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. On ly appear in g in t h e User dom ain, t his dir ect ory con t ain s t he mail for a user .

Pr ef erence Pan es Con t ains app let s t hat will ap pear in t he Sy st em Pref er ences applicat ion.

Pr ef erences Con t ains t h e pr ef erences for an ap plicat ion .

Pr in t er s Con t ains pr int er d riv ers and pr int er defin it ion ( PPD ) f iles. The d r iv ers are org anized b y v en dor n ame.

Script ing Addit ion s Con t ains script s and scr ipt in g r esou r ces t o ex t end App leScr ip t 's cap abilit ies.

St • ar t up I t em sTable of Content s • • •

Review s

Con t ains script s and pr ogr am s t hat ar e r un at b oot t im e. This on ly appear s at t he local and Reader Rev iew s syst em level. Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

WebSer verc O S X Running Ma

P ant he r

By Jam es Duncan Davidson

App ear ing in t he Local dom ain, t h is dir ect or y cont ains t he cont ent and CGI scr ipt s f or t h e syst em 's w eb ser v er . Wh en y ou t ur n on web shar ing on y our m ach in e, you can access t he Pub docum lish er: O'Reilly ent s f r om y our local m achine u sing t h e URL ht t p: / / localhost / . Pub Dat e: Decem ber 2 00 3

Man y ot her 0-dir or 00 ies-8 m ay app ear in y our Libr ary , b ut as you can see, t h e files t hat y ou f ind I SBN: 59ect 6- 005 her e aff ect , con t r ol, and config ur e you r exp er ience on Mac OS X. Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

2.5 Further Explorations A g r eat r esour ce for ex pan ding y our un der st an ding of t he way in w hich t he sy st em is put t oget h er is in st alled on y our har d dr ive w h en y ou in st all Xcod e Tools. I t 's a 191 - page PDF book t it led Sy st em Over view an d is locat ed at at ion/s M acOSX/ Concep t ual/ Syst em Ov er v iew / Sy st em Ov erv iew . pd f . •/ Developer/ Docum Table ofent Content •

Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 3. The Terminal and Shell The Ter m inal ap plicat ion ( / App licat ions/ Ut ilit ies) is t he p ort al t o t h e int er nals of Mac OS X. You can use, and becom e p rof icient w it h, t h e syst em w it hou t ev er t ouching t he Ter m inal. But if you t r uly w ant t o dig deep and learn h ow t o unleash t h e fu ll pot ent ial of t he un derly ing Unix •capabilit ies of Table t he ofsyContent st em , st h e comm an d line is essen t ial. And once y ou k now how t o use it , t he •Term inal becom Review es sa t ool so v aluable t hat m an y pow er users keep it in t heir Dock or in t he •Finder 's sidebar Reader f orRev quiew icks access. •

Er r ata

it may b e t o t hink of t h e Term inal as t he Unix p art of Mac OS X, it ' s simp ly an •Temp t ing as Academic he uThings nder lying Unix oper at ing syst em , and specif ically t o t hose pr og ram s t h at g iv e •int er face t o t Ten I Dig About Pant her s Unix char act er •t he sy st em itScheduling Tasks in .Pant her Running Ma c O S X P ant he r

I 'm going t o m ak e t h e assum p t ion t h at y ou hav e at least a passing fam iliar it y w it h t he id ea of By Jam es Duncan Davidson t he com m and line. May be y ou r em em ber using a shar ed sy st em at a sch ool somew her e. Or m ayb e y ou h ad a DOS- based m achine t h at r equir ed y ou t o go sleut hing int o t he dept hs of t he C:\Pub w or lishld. er: IO'Reilly n any case, t he aim of t his chap t er is t o f amiliar ize you w it h t he Ter m inal, t he sh ell, andPub som e of t he ber ot h2er Dat e: Decem 00 3t ools y ou'll need t hr ou gh t he r est of t he book . I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

I f t his chap t er goes over y our head an d you need mor e of a gr ound ing on t he su bject , y ou sh ould pick up Lear ning Unix f or Mac OS X Pan t her , b y Dav id Taylor , et al. ( O'Reilly & Associat es, I nc., 200 4) . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.1 Terminal Overview When y ou lau nch t he Term inal applicat ion, show n in Figur e 3- 1 , y ou ar e gr eet ed w it h a sin gle, r at her plain- look ing w indow . What you see here is essen t ially t he sam e com m and - line in t er f ace t hat Unix users hav e been seein g since t h e day s w hen 8- t r ack t apes w ere en v ogue. Th e sy st em it h a of f r iend ly "sWelcom e t o Dar w in ! " m essag e and t hen giv es you a pr omp t f or t h e •gr eet s you w Table Content bash sh ell, ind icat ed by t h e dollar sign ( $) . This is y our cue t hat y ou ar e int er act in g w it h t he • Review s com man d line. At t his p oint , y ou hav e dir ect access t o t he int er nals of Pant her, and if you hav e • Reader Rev iew s adm inist r at or pr iv ileges an d a lit t le bit of k now - h ow , y ou can do ev er yt h in g you ever w an t ed t o, • Er r ata and m or e. •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Figu r e 3 - 1 . The Ter m i na l w ind ow

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

The p r omp t t h at is b ein g d isp lay ed in t h e Ter m inal is t he out put fr om a pr ogr am k now n as t h e shell. Th e sh ell is t he m ediat or b et w een y ou and t he in t ern als of t he Unix sy st em . Th e sh ell' s job is t o in t erp ret t he com m ands y ou t y pe an d in vok e t he var ious p r ogr ams on y our sy st em t o sat isfy t hose inst r uct ions. Each com m and you ent er t y pically con sist s of a pr ogr am n ame and som e par am et er s t o pass t o t hat pr ogr am . When t he sh ell ex ecu t es t he pr og ram , it s result ar e display ed in t he Ter m inal w ind ow. Ex am ple 3- 1 sh ows t he u se of t h e dat e com m and, w hich r et ur ns t h e cu r rent dat e and t ime.

Exa m pl e 3 - 1 . Usi ng t h e dat e com m an d

$date Mon Dec 8 18:25:05 PST 2003

Aft er t he dat e com m and exit s, t h e shell resum es cont r ol of t h e display and out p ut s an ot her pr om pt en abling y ou t o ent er y our n ex t com m and .

3.1.1 Essential Filesystem Commands •

Table of Content s

I• n t he FinderReview , it ' s easy t o fin d y our way arou nd; aft er all, it w as desig ned t o be easy . The s com man d line isn' t quit e ssuch a w alk in t he par k. I t ' s j ust y ou and t he p r omp t . So, h ow do you • Reader Rev iew fin d y our w ay arou nd? Qu it e sim ply b y using a set of com m ands at t he pr omp t . Table 3 - 1 list s • Er r ata t he com m and s t hat you w ill m ost of t en u se t o nav igat e you r w ay ar ound . •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Tab le 3 -1 . Com m on she ll n av iga t i on com m an ds

By Jam es Duncan Davidson

Pub lish er: Command

O'Reilly

Description

Pub Dat e: Decem ber 2 00 3

pwd

I SBN: 0- 59 6- 005 00 -8

Displays the current working directory

Pages: 32 6 ls [options] filename

Lists the files in the given directory

cddirectory

Changes directory

mkdirdirname

Makes a directory

directory rmdir dirname Ru nning Mac OS X Pant her is t he ultRemoves im at e Swaiss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Copies a file cpfrom X's cor e, rto evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You w hen ay ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e file mvfrom to m ay not be a Mac gu ruMoves w ell on you r w ay. Removes a file rmfile sudo [command]

Invokes the command as the superuser

3.1.2 Wildcards Qu it e oft en w hen y ou use t h e com m and line, y ou will w an t t o per for m oper at ions on g rou ps of files at one t im e. For inst ance, you m ay w ant t o cop y all t he files in a dir ect or y t h at st ar t w it h a par t icular pr efix . Or , y ou m ay ju st w ant t o see all t h e files in a dir ect or y t h at end w it h t he . jp g ext ension. For t u nat ely , t he shell pr ov ides a p ain less w ay t o accom plish t his w it h t he h elp of some w ildcard s. Table 3 - 2 list s t h e m ost comm on w ildcard s.

Tab le 3 -2 . Com m on w il dca r ds

Wildcard Matches ?

Any single character

*

Any string of characters

[set]

Any character in the set

[!set]

Any character not in the set



Table of Content s



Review s



Reader Rev iew s By f ar t he m ost wid ely u sed w ild car d is t he ast er isk ( * ) . As an ex amp le, t o f ind all t he f iles •ending w it h .Er r ata in t h e ~ / Libr ar y/ Pr efer en ces d irect or y, use t he f ollowin g: plist •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

$ ls Ma ~/Library/Preferences/*.plist Running c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly e: Decem 3 erisk by it self as an ar gum ent . Th is select s ev er y file in a dir ect ory . For YouPub canDatalso u se ber t he2 00 ast I SBN: 6- 005 00 exam ple, t h0-e 59 follow ing-8 comm an d can be d anger ous ind eed: Pages: 32 6

$ rm * Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir This com m and is dang er ou s as it w ill r em ove ev er y f ile in a dir ect or y . Ev en m or e dan ger ous is syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e com bining w ildcard s w it h t he r m com man d' s - r op t ion, w h ich pu t s r m int o recur siv e m ode and w ell on you r w ay. r em ov es ev er y dir ect or y as w ell as ev er y f ile in a dir ect or y . Ex ecu t e t his com m and at t h e r oot of t he filesy st em and you could lose ev ery t h in g. Wildcar ds ar e p ow er fu l, so use t h em w it h car e.

3.1.3 Searching for Files While Pan t her' s n ew Find er has m ade g r eat pr ogr ess in m ak ing it easy t o f ind files using t he GUI , t her e w ill be t im es w hen it is easier or mor e conv enient t o use t h e comm an d- line t ools find , gr ep , an d locat e.

3.1.3.1 find The ap t ly nam ed find is one of t he origin al Unix file- sear ching t ools and allow s y ou t o sear ch for files based on t h eir filen am es an d ot her at t r ibut es such as w hen t hey w ere last m odified. Th e basic syn t ax f or using find is:

find pathname options

w her e t he p at hnam e ar g um en t ind icat es w her e in t he f ile sy st em hierar chy t he sear ch sh ould occu r , and t he con dit ions ar gu ment indicat es t he at t r ib ut es a file should hav e t o mat ch t h e sear ch. Th er e ar e m or e t han 4 0 t yp es of cond it ions y ou can pass, som e of t he m ost com m on of w hich are list ed in Table 3 - 3, b ut t he opt ion y ou' ll pr obab ly find y our self using m ost is - nam e.



Table of Content s



Review s



Reader Rev iew s

• Condition Er r ata • • •

Tab le 3 -3 . Com m on ly u se d f i nd cond it i ons Description

Academic

-group Find files belonging to the specified group Ten Things I Dig About Pant her groupname Scheduling Tasks in Pant her

Running X P ant he r -mtimeMa +nc O|S -n Find By |Jam n es Duncan Davidson n

-namepattern

files that were last modified more than n (+n), less than (-n), or exactly n days ago

Find files with names matching the given pattern

Pub lish er: O'Reilly

files that have been modified more recently than the given -newer Pub Dat file e: Decem ber 2Find 00 3 file I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 -user username

Find files that belong to the specfiied user

Ex am ple 3- 2 sh ows how t o fin d all t he f iles t h at hav e a . t x t ex t ension in t he ~ / Docum en t s dir ect or y . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Exaem m .pl e 3m-ay 2 . not Usibeng t h egufiru ndw hen comy ou m astnd h t he - na m eyou ar'vge um syst You a Mac ar t tw hisitbook , b ut once r eadeitnt , you 'll b e w ell on you r w ay.

$find ~/Documents -name *.txt /Users/duncan/Documents/Financial/Planning.txt /Users/duncan/Documents/ToDo.txt /Users/duncan/Documents/Weather.txt

When r un, t he find com m and looks at ev er y f ile in t h e ~ / Docum en t s d irect or y, in clu ding r ecur sing t hr oug h t he sub direct or ies, an d t h en list s each f ile wit h a nam e m at ching t he p at t ern *.txt. Anot h er usef ul op t ion is - m t im e, w hich let s you search for files t hat w er e m odif ied in a par t icular t im e fr am e. Ex am ple 3- 3 sh ows how t o fin d all t he f iles t h at w ere mod ified in t he last day in t he ~ / Docum en t s d irect or y.

Exa m pl e 3 - 3 . Fi ndi ng docu m en t s ba sed on m od if ica t i on t im e

$find ~/Documents -mtime -1 /Users/duncan/Documents/ToDo.txt



Table of Content s



Review s



Er r ata

3.1.3.2 grepReader Rev iew s • While find sear ch es for f iles b ased on t heir filenam e, gr ep look s w it hin a f ile, wh ich allow s y ou t o • Academic sear ch for som et hing based on t h e cont ent s of t h e file inst ead of ju st by it s f ilen ame. You can • Ten Things I Dig About Pant her eit her sear ch for a st rin g w it hin a sing le file or a w hole gr oup of f iles. I t s basic sy nt ax is: •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

grep pattern file Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

w her e pat t er n is w hat g r ep w ill look for and file is t h e file, or list of files, t o look in . By it self , t his com man d w ill on ly sear ch t h e files y ou g ive it . Quit e of t en, h owev er , you 'll w ant t o sear ch an ent ir e dir ect or y . To do so you can use t he - r op t ion, w h ich w ill put gr ep in t o r ecur siv e m ode. Ex am ple 3- 4 sh ows how t o fin d a docum ent in t h e Docum ent s d ir ect ory t hat has t h e w ord " t h under " in it . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's t he innng er wdocu ork ingm s of her sed f or t hon ose cont w h o wen antt tw o igtet h e emost Exacor me,plr eevealing 3 - 4 . Fi ndi enPant t s ba h tgr p out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. $grep -r thunder ~/Documents /Users/duncan/Documents/Weather.txt:The thunder struck loudly and shook the house

I n addit ion t o t elling y ou t h e filenam e t hat t h e t er m is foun d in , t he com m and show n in Ex am ple 3- 4 also gives y ou t he line of t ex t t hat t he t er m is in, w h ich is a way t o m ak e sur e t hat it h as fou nd t he docum en t y ou r eally w ant .

3.1.3.3 locate On e of t he f ast est way s t o fin d f iles—and q uit e a b it easier t o use t h an find —is t o use t he locat e com man d. Unf ort unat ely, on most Macs t his t ool w on't r et ur n an y r esult s becau se it depend s on a d at abase ( locat ed in t he file / v ar / db/ locat e. dat abase) t hat only get s cr eat ed if you r m achine is r unn ing at 4 : 00 a. m. on a Sun day m or ning. Ch apt er 8 w ill show you h ow t o resch ed ule t hese t ask s t o a bet t er t im e, but it 's possib le t o cr eat e t his dat ab ase man ually w it h t he f ollow ing com man d:

$ sudo /usr/libexec/locate.updatedb &

When y ou issue t h is com m and , y ou w ill b e pr om pt ed for y our p assw or d. Because y ou' re u sin g sudo, y ou m ust b e an ad m in ist r at iv e user t o ex ecu t e t he com m and. I f y ou' v e not iced, t h er e's an •am per san d ( &) Table at of t hContent e en d sof t hat st r ing . When y ou ad d t he am per san d t o t he en d of a comm an d •st r in g, it t ellsReview t he shell s t o ru n t he com man d in t h e backg r ound, w hich m eans y ou get y our t bRev ackiew r igh •com man d p r omp Reader s t aw ay w h ile t h e shell r uns t he com man d u nder t h e hood . Since it creat e t h e locat e dat abase, it ' s alw ays b est t o r un t h is com m and in t he •t ak es a w hileErt roata •back gr ound . Academic •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

On ce t he dat ab ase has b een cr eat ed, y ou can u se t he locat e com m and w it h t he f ollow ing sy nt ax : Running Ma c O S X P ant he r By Jam es Duncan Davidson

locate pattern Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ex am ple 3- 5 sh ows how t o fin d a file nam ed icon .p sd t hat you can' t r emem ber t h e locat ion of .

Exa m pl e 3 - 5 . Usi ng t h e loca t e com m a nd Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o $ locate icon.psd cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir /Users/duncan/Work/Code/Backdrop/icon.psd syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.1.4 Terminal User Interface I n man y w ays, t he com man d- line env iron m en t an d t h e GUI ar e as diam et r ically opp osed as possible. One st r esses exact n ess w hile t h e ot her em phasizes ease- of- u se. How ev er , Ap ple has pr ov ided sever al f eat ur es in t h e Ter m inal ap plicat ion t o help it w or k bet t er w it h t he Aqu a side of Mac OS X. On e of t hese feat ur es is t he abilit y t o d rag and d rop f iles f rom t he Finder t o t he Ter m inal. Wh en y ou d o so, t h e fu ll pat h nam e of t h e file is inser t ed on t he com m and line. This m eans in st ead of t r y in g t o r emem ber a lon g pat h t o a file, y ou can qu ick ly find it in t h e Fin der , comp ose a com man d in t h e Ter m inal, an d t h en d rag and d rop t h e file or f older icon int o t he Ter m inal w indow . Also, w hile using t he Ter m inal, t her e's a plet hor a of k eyst r ok es y ou can u se t o w hiz t hr oug h t ask s w it h ease. Table 3 - 4 list s t h e m ost comm on ly used ones.

Tab le 3 -4 . Com m on ly u se d Te r m in al k e yboa r d sh or t cu t s.

Key

Description

-N

Create a new Terminal window

Shift-

-N

-.

Send a break character (equivalent to Control-C)

Shift-

-V

• • •

• •

Paste selected text (like a middle button mouse in X Windows)

Table of Content s

-Home -End

• •

Connect to server via SSH, SFTP, FTP, or Telnet

to the top of the scrollback buffer ReviewJump s Reader Rev iew s

Jump to the bottom of the scrollback buffer

Er r ata

-Page UpAcademic Scroll one page up in the scrollback buffer Ten Things I Dig About Pant her

-Page Down

Scroll one page down in the scrollback buffer

Scheduling Tasks in Pant her

Running c O S X P ant he r -Up Ma Arrow Scroll

one line up in the scrollback buffer

By Jam es Duncan Davidson

-Down Arrow

Scroll one line down in the scrollback buffer

Pub lish er: O'Reilly

-Left Pub Dat e: Arrow

Switch to the next Terminal window when you have multiple windows open

Decem ber 2 00 3

I SBN: 0- 59 6- 005 00 -8

-Right Pages: Arrow

32 6

Switch to the previous Terminal window when you have multiple windows open

On e key st rok e t h at shou ld b e m en t ion ed in par t icular —once y ou st ar t usin g it , y ou'll never Ru nning Sh Mac hercauses is t he ult e Sw iss Knife( TM) s wt oh obew in ant t o t ly st op—is if t -OS -XV,Pant w h ich whim atat ever t ex t yAr oumy hav e high lig;htfor ed pow in t here user buf fer st an cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS copied an d hen p ast ed at t he p rom pt . I f you 'v e ever u sed an X Wind ows applicat ion, y ou' ll X's cor e, t heequiv inn er w ork s of ing Pantt ex hert wf or osemwou h osewan antd tusin o g et hem most of se t heir r ecogn izer evealing t his as t he alen t ofing select it ht ht he g tthe iddleout m ou syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll be bu t t on t o copy an d past e t he t ex t . w ell on you r w ay. Anot h er feat ur e of t h e Ter m inal t hat is usef ul is t he abilit y t o sp lit t he w in dow , as show n in Figur e 3- 2 , an d u se t he t op par t t o scr oll back t hr oug h t he b uff er w hile w ork ing in t he b ot t om par t . You act iv at e and deact ivat e t his f eat u r e by using t h e but t on d irect ly abov e t he scr ollbar .

Figu r e 3 - 2 . The Ter m i na l' s sp li t w in dow



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

You can chan ge t h e color s u sed by t h e Term inal, in clud ing t he b ack gr oun d and for egr ound colors, as well as t he t r anspar ency of t he Ter m inal w ind ow. When you ar e st ar in g at n ot hing bu t t ext , it 's nice t o b e able t o set it up w it h color s t h at ar e m ost com for t ab le for y ou t o u se. Ju st use Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o t he Ter m inal Wind ow Set t ings menu it em and t w eak aw ay . cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.2 Mac-specific Shell Commands Alt hou gh Mac OS X is a Un ix sy st em, it s filesy st em cont ains som e f eat u res ov er and bey ond w hat t h Unix cp an d m v com m ands can han dle. App le has m ade it a p rior it y t o in t egr at e t he GUI and com man d- line w or lds b y inclu ding sev er al t ools. •

Table of Content s



Review s

• 3.2.1 openReader Rev iew s •

Er r ata

•The open comAcademic m and is t he Ter m inal v ersion of doub le- click ing a file or an app licat ion. I t s sy nt ax is: • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

open -a application filename

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 005 00 -8 For exam ple, t o6-open t he ~ / Sit es/ index .h t m l f ile in t he def ault b row ser on t he sy st em ( t yp ically 6 f ollow ing : Safar i)Pages: , u se32t he

$ open ~/Sites/index.html Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e When y ou ex ecut e t his com m and, t he syst em w ill f in d t he ap pr opr iat e applicat ion t o op en index .h t m w ell on you r w ay. w it h. How ev er , if w ant t o sp ecify an ot her app licat ion t o open t h e file w it h, su ch as BBEdit ( w w w .b ar eb ones. com ) so t hat you can ed it t h e HTML, you can use t he - a opt ion as show n:

$ open -a Safari ~/Sites/index.html

On e t hing t o keep in m ind abou t t h e open com m and is t hat t he applicat ion is f r ee t o int er pr et t h e files passed t o it h ow ev er it w ant s t o. For exam p le, if y ou use t he f ollowin g com m and:

$ open -a Safari ~/Sites

Safar i will lau nch, see t hat ~ / Sit es is a dir ect or y , and t h en u se it s default behav ior for local dir ect or ies, w hich is t o cause it t o be op en ed up in t he Find er . I f you w ant t o open an ap plicat ion fr om t he com man d lin e, you don 't hav e t o sp ecify a filenam e. Ju

execut e t h e comm an d lik e t his:

$ open -a Safari



Table of Content s

I• f you h ave Saf ar i sset t o op en a w eb sit e at st ar t u p, t h at p age w ill load if y our Mac is connect ed t o Review t• he I n t er n et Reader aft er Saf i launches. Revar iew s •

Er r ata



Academic

3.2.2 dittoTen Things I • •

Dig About Pant her

Scheduling Tasks in Pant her

Running Madc m O Sv Xcom P antm he r The cp an ands

kn ow how t o d eal wit h p lain f iles, bu t because t hey w er e desig ned f or Unix, By Jam es t hey Duncan donDavidson 't kn ow abou t som e of t he sp ecial at t r ibu t es t hat Mac app licat ions can associat e w it h files. Most of t h e t im e, t hese at t r ib ut es, k now n as r esour ces, ar e st or ed in a f older w it h t he appPub licat t hat creat ed t he f ile, icons, an d ot h er pieces of supp lem ent al in for m at ion. Wh en y ou cop lishion er: O'Reilly a f ile w it h cp, all t he special at t r ib ut es associat ed w it h t h at f ile are lost . Pub Dat e: Decem ber 2 00 3 0- 59 6- 005 00 -8 The dit tIoSBN: com m and copies eit h er files or, recur siv ely, dir ect or ies and w ill pr eserv e t h e special f ile Pages: 32 at t r ibut es t hat6 can be associat ed w it h files on t he Mac. For ex amp le, t o copy t he cont ent s of t he ~ / Docum en t s d irect or y t o an ot her dir ect ory y ou w ould use t he follow in g com m and :

ditto Ru$nning Mac~/Documents OS X Pant her~/DocumentsCopy is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.2.3 CpMac and MvMac I n addit ion t o d it t o, App le pr ovid es t he Cp Mac an d Mv Mac t ools, w h ich also un derst an d h ow t o pr eser v e Mac- sp ecif ic file at t r ibut es, as p art of t he Xcod e Tools. Un for t un at ely , since t hese com man ds ar en't inst alled in t he locat ions t he shell usually uses t o find t ools, y ou hav e t o u se t he fu ll pat h of t h e pr ogr am . You use Cp Mac t he sam e w ay you u se cp. For ex am ple, t o copy t he f ile foo. t x t t o bar . t x t , y ou w ould use t he f ollowin g:

$ /Developer/Tools/CpMac foo.txt bar.txt

To m ov e t h e file inst ead, y ou w ould use t he f ollowin g:

$ /Developer/Tools/MvMac foo.txt ../foo.txt

3.2.4 osascript The osascr ip t com m and allows you t o ex ecut e App leScr ipt f r om t he com m and line j ust as easily as y ou can execut e shell scrip t s. To ex ecut e t he App leScr ipt con t ain ed in t he file / Libr ar y/ Scr ipt s/ URLs/ Dow nload Weat her M ap. scpt , y ou w ould use t he f ollowin g com m and: • •

Table of Content s Review s $ osascript MyScript.applescript "/Library/Scripts/URLs/Download Weather Map.scpt



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

•When execut Scheduling ed, t he App Tasks leScr in ip Pant t f her et ch es t he cur r en t w eat her m ap for you r cou nt r y and op en s it in Pr ev iewMa Running . You c O Scan X P ant also he rex ecut e one liners of AppleScr ipt w it h t he - e opt ion . For ex am ple, if y ou w t o r un Davidson a scr ipt in t h e back gr ound an d h ave it ann ounce w hen it w as d one, y ou could insert Byant Jamed es Duncan t he follow in g lin e int o t he script : Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: osascript 0- 59 6- 005-e 00 -8'say

"hello"'

Pages: 32 6

OS her X pris ovides sever com man ds t Knife( o int erTM) act ; wfor it h pow Open heant t o Ru nning Mac OSMac X Pant t he ult im atal e Sw iss Ar my er Direct user s or w y, h o tw un, derly ab ase con t ains conft ak igur ion infor m at ion. These cust om ize, t w eak and ing g en dat er ally r ev tuhat p t heir Mac. syst Thisem b ook esatreader s deep in side Mac OS t ools ar e dscl, nidum , nifind, niload , an il ant od gare Chof aptt heir er X's cor e, r evealing t he inn er wnicl, ork ing s of pPant her f or t h ose w dh oniut w ant et tcov h e ered most inout 11 not , Op en ect or y.ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e syst em . You m ay be Dir a Mac gu w ell on you r w ay.

3.3 Configuring and Using bash As m ent ioned pr ev iously , w it h t he Pant her r elease of Mac OS X, bash is t he def ault shell. App le mad sw it ch f rom t csh t o bash b ecau se of it s su ppor t for Unicode t ex t , som et h ing t hat ' s v er y im por t ant in int er nat ional mar k et . Anot h er log ical reason for sw it ching t o bash is t hat it is t he default shell for m and is •dist r ibut ion s Table of easier Content st o scr ipt wit h t h an t csh. Because bash is now t h e defau lt shell, t he b ook w on it s use w it h an occasional n od t o t he ot her shells wh er e ap pr opr iat e. • Review s •

Reader Rev iew s



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

The d ef ault con figu rat ion of bash is perf ect ly ad eq uat e f or casu al usage, b ut you 'll inev it ably w ant t • Er r ata it t o y our ow n liking . This sect ion t ak es a look at t h e var ious con figur at ion files f or bash, it s env ir on • Academic v ariab les, how t o set u p com m and aliases, and how t o u se bash' s hist ory t o y our ad van t age.

Running Ma c O S X P ant he r

3.3.1 Environment Variables By Jam es Duncan Davidson

Ev ery pr ogr am on t he sy st em ru ns in an env ir onm ent . Th e en vir onm ent con sist s of a set of nam e- v Pub lish er: O'Reilly k now n as env ir onm ent var iables, w hich comm un icat e a v ar iet y of conf igur at ion set t in gs t o a p rog ra Pubple, Dat e: ber uses 2 00 3 t he PATH env ir onm ent v ar iable t o find a pr ogr am t o ex ecu t e in response t o exam t hDecem e shell I SBN: 0- 59get 6- 005 -8 com man d. To an00idea of w h at k inds of dat a ar e st or ed in env iron ment v ar iab les, ex ecut e t he se com man Pages: d, as 32 6show n in Ex am ple 3- 6.

Exa m pl e 3 - 6 . Ex a mi ni ng e nv ir on me n t v ar i ab le s w i t h set Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS $set X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e BASH=/bin/bash w ell on you r w ay. BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="powerpc-appleda BASH_VERSION='2.05b.0(1)-release' COLUMNS=80 DIRSTACK=() EDITOR=/Users/duncan/bin/usebbedit EUID=501 GROUPS=() HISTFILE=/Users/duncan/.bash_history HISTFILESIZE=500 HISTSIZE=500 HOME=/Users/duncan HOSTNAME=Incognita.local

HOSTTYPE=powerpc ...

•When y ou exTable Content ecut eoft he set scom m and, you 'll see qu it e a b it of out p ut —p rob ably ar ound 40 lines. Som • env iron ment Review v ariabs les m ay m ak e sen se wh en y ou fir st look at t hem , and som e w on't . Table 3 - 5 list

t• he mor e comReader m onlyRev used iew s env iron ment v ar iab les y ou ar e lik ely t o u se on occasion . •

Er r ata

To of a single env ir onm en t v ar iable such as PATH, y ou can u se t he ech o com m and as • see t he value Academic Ex am ple 37. • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Exa m pl e 3 - 7 . Usi ng t h e echo com ma n d t o ex a m ine a n e nv ir onm e n t v ar i ab By Jam es Duncan Davidson Pub lish er: O'Reilly Pub Dat e: Decem ber $echo $PATH

2 00 3

I SBN: 0- 59 6- 005 00 -8

/bin:/sbin:/usr/bin:/usr/sbin Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS . Com lyher u se ash enw vi v ar i out abl of es. X's cor e, r evealingTab t he le inn3 er-5 w ork ing s m of on Pant f or dt hb ose who antr onm t o g etet nt h e most t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Variable Description BASH

Location of the bash shell program

BASH_VERSION

Version of bash that is being run

COLUMNS

Number of columns that are being used in the terminal view

DIRSTACK

List of directories being used by the pushd and popd commands

GROUPS

Various groups that the user is associated with

HISTFILE

File containing the shell history

HOME

Home directory for the user

HOSTNAME

Name of the system that the shell is running on

LINES

Number of lines currently being used by the shell

PATH

List of directories used by the shell to resolve commands

PS1

String used as the primary prompt

PS2

String used as the secondary prompt

SHELL

Shell program being used

SHELLOPTS

Options that are in effect for the shell

TERM

Type of terminal that the shell is displaying its content to

UID

User id of the currently logged-in user

USER

Username of the currently logged-in user

_ (underscore)

Previously executed command



Table of Content s



Reader Rev iew s



Er r ata



Academic



Scheduling Tasks in Pant her

The d ollar sig n in f ron t of PATH m eans y ou ar e r ef er r ing t o an env ir onm en t v ar iable. Ot her w ise, if y • Review s hav e j ust ent er ed ech o PATH, t h e shell w ould ret ur n PATH, as sh own in Ex am ple 3- 8.

Exa m pl e 3Ten - 8Things . Re su lt of usi ng t h e ech o com m a nd w it hout a dol la r sign . • I Dig About Pant her Running Ma c O S X P ant he r By Jam es PATH Duncan Davidson $echo Pub lish er: PATH

O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

To set or ch ange an env ir onm en t v ar iable for t he lifet im e of t he sh ell, u se t he exp ort com m and. For t o ch ange t he PATH v ar iable so t h at y ou can r un y our ow n com man ds in ~ / bin, y ou cou ld u se t he f o com man d: Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's$cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir export PATH=$PATH:~/bin syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

This set s t h e PATH v ar iable t o t he cur r ent ly exist ing PATH w it h t h e ~ / bin d irect or y append ed t o it . I f w ant ed t o in clud e t he / Developer/ Tools d irect or y on you r pat h so t h at y ou hav e access t o Cp Mac an y ou w ou ld inst ead use t he follow in g:

$ export PATH=$PATH:/Developer/Tools:~/bin

The im por t an t t h ing t o r emem ber h er e is t h at y ou need t o use a colon ( : ) as a d elim it er bet w een co pat h s. These com m and s w ill last for t he lifet im e of t he cu rr ent sh ell, w h ich is as long as t h at Ter m in is open. I n or der t o per man en t ly add t hese pat h s t o t he shell, you 'll h ave t o edit one of bash' s con fi files, descr ibed next .

3.3.2 Configuration Files Thr ee files in t he Hom e dir ect ory , if t hey ex ist , are used t o con figu re bash:

. bash_p r ofile



Con t ains env iron ment v ar iab les an d com m ands t hat are read and execut ed ev ery t ime you cr Term inal w in dow an d a shell is creat ed for it , or w hen you SSH in t o y our m achine and are pr e w it h a pr om pt . This allow s y ou t o cust om ize t he shell t o you r liking . I f bash d oesn 't find t h is f for . bash_login an d . pr Table of Content s ofile r espect iv ely t o f ill in f or it .



Review s



Reader Rev iew s

•. bashr c

Er r ata



Academic

• •

Tenenv Things Dig About Pantles heran d com m ands t hat are only r ead an d ex ecut ed w hen you cr e Con t ains ironI ment v ar iab subshell b y t y ping bash in an Scheduling Tasks in Pant her alr ead y ru nnin g shell.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

. bash_logout Pub lish er: O'Reilly

com PubCon Dat e:t ains Decem ber 2man 00 3 ds

t h at ar e r ead an d ex ecu t ed w hen y ou log out of a shell. You could use t h up f iles bef ore you log out . I SBN: 0- 59 6- 005 00 -8

Pages: 32 6

By def ault , t h ese f iles d on't exist as par t of a user' s Hom e dir ect or y u nt il y ou cr eat e t h em . Th e m ost t hese t hr ee f iles is . bash_p r ofile, w hich is used t o cust om ize t he shell. For exam ple, if y ou w an t ed t o per m anent ly m odify t he PATH t hat t he shell uses t o resolve com m ands, y ou could cr eat e a . bash_p r y our Hom e dir ect ory an d add t he f ollow in g line: Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X'sPATH=$PATH:~/bin:/Developer/Tools cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

This causes t he PATH env ir onm ent v ar iable t o be set t o t he g iven st ring each t im e y ou open a new T w indow . Because . bash_p r ofile is only r ead w hen t he shell is cr eat ed , any chan ges y ou m ak e t o it w eff ect unt il you st ar t t h e nex t shell. I f you don 't w ant t o close you r shell and st art a new one, y ou ca sour ce com m and t o load t h e con t ent s of t h e . bash_p r ofile f ile:

$ source ~/.bash_profile

3.3.3 Aliases I n addit ion t o sear ch in g t he PATH f or com m ands, t h e bash sh ell also let s y ou define a set of aliases. com mon ly used t o cr eat e a sh ort er com m and nam e f or long comm an d st r ings so t hat t hey 'r e a bit m m anageable or t o r enam e com mon ly used com man ds.

Shell History The f ir st Un ix shell, k now n sim ply as sh, w as w r it t en by St even Bour ne in t h e 197 0s an d spaw ned t he d ev elopm en t of d ozen s of sh ells ov er t he last 30 year s. The f irst of t he alt er nat iv e shells t o achieve pr omin en ce was t he C shell ( csh ) , w r it t en by Bill Joy at Ber k eley as p ar t of t h e • Berk eley St andar Table of d Content Dist ribsut ion. Th en cam e t he Kor n Shell ( k sh ) , w r it t en by Dav id Korn at AT&T, • Bell Labor atReview or ies, st hat com b in es t he best f eat ur es of t he Bou rn e and C sh ells. Lat er , as p ar t of • t he GNU pr oject Readerb y Rev iewFr s ee Soft w ar e Found at ion, bash—a fr eely av ailable shell licensed t he • accor d in g t oErtrhata e GNU Pub lic License—w as creat ed by Br ian Fox . As p art of t he GNU pr oject , bash • becam e t he Academic d ef ault sh ell on Lin ux an d b ecam e possibly t he most pr ev alent of t he shells. Just as pr etThings ed sh,I Dig t cshAbout w asPant wr ither t en as a d er iv at ive of t he C shell . And m ost r ecent ly , t h er e's • bash r eint erTen zsh) , w r itTasks t en by Paulher Falst ad w hile at Pr incet on, wh ich com bines m any of t h e • t he Z Shell (Scheduling in Pant int er estMa ing r esheof Running c OfSeat X Puant r bash, ksh, an d t csh. By Jam es Duncan Davidson

Ev en t houg h t h er e ar e so man y shells t o choose fr om , sever al of t he cor e Unix u t ilit ies st ill depend on t he fun ct ion alit y of t he or iginal sh. So m uch so t hat desp it e t he f act t h at t h e or ig inal O'Reilly sh Pub sh lish ell er: d oesn' t sh ip w it h Mac OS X, t h er e is a ver sion of bash inst alled as / bin/ sh so t hese Pub am Dat e: Decem 2 00 3 When r un as / bin/ sh, bash t ries t o mim ic t h e behav ior of t he or iginal shell pr ogr s can exber ecu t e. as m uch t o main t ain com pat ibilit y . I SBN:as 0- possible 59 6- 005 00 -8 Pages: 32 6

Mac OS X sh ip s w it h sh, b ash , t csh , an d zsh. Th e Korn shell has also been p ort ed t o Mac OS X and can be obt ain ed f rom t he of ficial w ebsit e at w w w .k or nshell.com .

To d ef ineMac an alias a her comis m and use t hee Sw follow sy nt ax: TM) ; for pow er user s w h o w ant t o Ru nning OS Xf or Pant t he ,ult im at iss ing Ar my Knife( cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e alias name=command w ell on you r w ay.

Wher e nam e is t he nam e of t h e com m an d alias y ou ar e definin g, and com m and is t he com m and t ha execut ed by t h e sh ell w hen y ou inv oke t he alias. One com m on use of aliases is t o accom m odat e f at of comm an ds. For exam ple, if y ou ar e alw ay s t y ping sl in st ead of ls, y ou cou ld d ef ine t h e follow ing t hat y ou don' t g et scolded by t he shell again:

$ alias sl=ls

Anot h er use for aliases is t o cr eat e a sim ple com man d for a longer one. For ex amp le, if y ou ar e alw t o ch ange d irect or ies t o somew her e deep in t h e hierar chy , y ou can set up an alias t hat w ill allow yo t her e qu ick ly:

$ alias fdocs='cd ~/Documents/Corporate/Master/Forecasts'

Not ice t he u se of quot es ar oun d t h e comm an d. Th is is requ ired w hen a comm an d consist s of m or e t w or d. To g et a list of all t he aliases cu rr ent ly d ef ined, use t h e alias com m and by it self as sh ow n in Ex am pl •

Table of Content s

• Exa m pl e 3Review - 9 . sEx a mi ni ng t h e cu r r en t l y def i ne d a li ases •

Reader Rev iew s



Er r ata

• •

Academic

$ alias Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

alias Running sl=ls Ma c O S X

P ant he r

By Jam es Duncan Davidson

alias fdocs='cd ~/Documents/Corporate/Master/Forecasts' Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6m ak e aliases t o GUI applicat ions. For exam ple, if y ou wan t ed t o creat e a qu ick shor t c You can ev en t he Safar i br ow ser w hile on t he com man d lin e, you could define t he f ollow ing alias:

$ alias safari='open -a Safari' Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Wit h t his alias in place, t o laun ch Saf ar i y ou sim ply need t o t y pe saf ari in t o t he com man d line. An d t o mak e an alias per man en t y ou' ll need t o cr eat e a . bash_p r ofile f ile and place t he alias in t o it or ed exist ing . bash_p r ofile f ile and t hen sour ce it so t h e ch ange t akes eff ect .

3.3.4 History As bash r u ns, it k eep s a h ist or y of t h e comm and s t hat y ou' ve ex ecut ed . This f eat ur e is quit e hand y a y ou look at and r euse comm and s t hat y ou' ve p rev iously en t ered. Where t he shell's h ist or y is p art icu is w hen you n eed t o inv ok e a com m and t hat has a len gt h y set of par am et er s t hat y ou can 't rem emb The sim plest w ay t o use t he h ist or y is t o use t h e Up an d D own ar r ow s on you r k ey boar d. This w ill s and f ort h t h rou gh t he com m ands t hat you 'v e execut ed and display each in t ur n at t he pr om pt . To g out of t he h ist or y , y ou can u se t he hist ory com m and, w hich d isplay s a list of pr ev iously execut ed co Ex am ple 3- 10 sh ows som e ou t put fr om h ist or y .

Exa m pl e 3 - 1 0 . Usin g t he h ist or y com m a nd

$history

1 cd Documents 2 ls 3 open -a Safari 4 history •

Table of Content s



Review s



Reader Rev iew s

ands is in t h e or der in wh ich t h ey w er e execut ed. To r eu se a par t icular com man d, t •The list of com Er rm ata point —also called " b ang" by Unix g eek s) , follow ed by t he n um ber of t he com m and y o •( exclam at ionAcademic 11 shI ows how tPant o use •r eu se. Ex am ple Ten3Things Dig About her t h is com m and . •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Exa m pl e 3 - 1 1 . Usin g a comm a n d f r om t he h ist or y By Jam es Duncan Davidson Pub lish er: O'Reilly Pub $ !2

Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

ls

Pages: 32 6

Adobe SVG 3.0 Installer Log

Music

Desktop

Pictures

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Documents Public cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Library Sites syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Movies Work

Not e t h at t h e shell t ells y ou w hich com m and is r unn in g as it r un s t he com m and. This is usefu l becau t ell w hat ar gum ent s ar e b eing used. An ot her w ay t o nav igat e t h e hist or y list is t o u se t he f ir st few l t he com m and inst ead of t he com man d num ber . Ex am ple 3- 12 sh ows how t o qu ick ly ex ecut e t h e las t hat st ar t ed w it h an 'o' char act er.

Exa m pl e 3 - 1 2 . Exe cu t i ng a com m an d fr om t he h ist or y ba sed on cha r a ct e r

$!o open -a Safari

Whenev er you ex it bash, it w rit es it s h ist or y t o t he ~ / . bash_h ist or y f ile. Likew ise w henever y ou st ar

pop ulat es it s hist or y w it h t he cont ent s of t he ~ / . bash_h ist or y f ile. This allow s you t o quit and r est ar and st ill hav e y our h ist or y av ailable t o you . By defau lt , t he hist ory file is set t o r et ain up t o t he last com man ds. To chan ge t h is valu e, set t he HISTFILESIZE env ir onm ent v ar iable t o t he n um ber of line w ant t o k eep . For exam ple, t o chang e it t o rem emb er 966 com man ds inst ead of 500 , y ou w ou ld u se follow ing :



$ export Table HISTFILESIZE=966 of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.4 Using Other Shells Essen t ially , all t he shells on t he sy st em ( sh, b ash , t csh , an d zsh) do t h e same t hing : t h ey t ake inpu t f r om y ou an d t ran slat e it int o com m and s t hat ar e r un on t he sy st em . How ever , each shell dif fer s in t he specif ics of h ow y ou in t eract w it h it and t he sp ecial f eat u res t h at it off er s. I f y ou'v e e Unofix Content sh ell, sy ou' ll do ju st fin e st ick ing w it h t he defau lt bash sh ell. But if y ou'v e •nev er used t hTable becom e accust om ed • Review s t o t h e t csh sh ell t h at w as t he def ault on pr ev iou s v er sions of Mac OS X, or if y• ou ar e an oldh and Un ix user w ho sim ply pr efer s anot h er sh ell, y ou m ay w ant t o chan ge t he Reader Rev iew s defau lt shell t o su it y our p r ef er ences. •

Er r ata



Academic Becau se a shell is a p r ogr am like an y ot her , all y ou hav e t o d o t o use a diff er ent sh ell •t em por arily is Ten I s Dig Aboutat Pant t oThings t y pe it n ame t h her e comm and line. For ex amp le, if y ou w ant t o use t h e t csh •shell, ex ecu t e Scheduling Tasks in Pant her t he follow ing: Running Ma c O S X P ant he r By Jam es Duncan Davidson

$ tcsh

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

The p r omp t w ill chan ge t o a per cen t sign ( % ) , w h ich is t he default pr om pt for t h e t csh sh ell, and w ill be in eff ect unt il you exit out of it .

Ru nningChanging Mac OS X Pant herShell is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o 3.4.1 the cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir To ch ange t h e defau lt shell used by t he Ter m inal w h en it lau nches, sim ply op en t h e Ter m inal syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e pr efer en ces ( Ter m in al Pr ef erences) , t hen sp ecif y t he shell y ou w ant t o execut e in t he " Ex ecut e w ell on you r w ay. t his com m and" t ext f ield, as sh ow n in Figur e 3- 3 . Now , w h en ev er y ou op en a Ter m inal w ind ow , y ou' ll get t h e shell t hat you w ant .

Figu r e 3 - 3 . Ch an gin g t he sh el l u sin g t he Ter m i na l Pr ef e r en ces p an e

Not e t h at t h is set t in g d oesn' t ch ange y our default shell w hen y ou r em ot ely log in . To chan ge y our d ef ault sh ell at t he sy st em lev el r at her t h an on ly in t h e Term inal applicat ion, y ou' ll need t o m odify you r user accou nt u sin g Net I nf o as show n in Ch apt er 5.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.5 Shell Scripts On e of t he t r ue pow ers of t he shell is t hat y ou d on' t h ave t o alw ays t yp e in you r com m and s by han d t ed iou sly on e aft er t he ot her . Wh en y ou find a set of t ask s t h at y ou do all of t he t im e, y ou can con solidat e t hem int o a shell script . A sh ell scr ipt is not hin g m or e t han a collect ion of shell at isofsav ed ins a f ile on t h e filesyst em . The shell scrip t is m ade in t o an execut ab le by •com man ds t hTable Content chang ing it s file per m issions u sin g chm od + x. A sim ple shell scrip t is show n in Ex am ple 3- 13. • Review s •

Reader Rev iew s



Er r ata



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Exa m pl e 3Academic - 1 3 . A sim pl e sh el l scr i pt •

Running Ma c O S X P ant he r

#!/bin/sh By Jam es Duncan Davidson

echo Hello World! Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Colorizing File Listings Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o On e nift y feat ur e of t h e ls com m and t hat y ou can discover by readin g t h r ough it s cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS m anpag e it s abilit y t o color cod e it s out p ut . For ex am ple, dir ect or ies will b e pr int ed X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir in blue an d ex ecut able files w ill be p rin t ed in r ed . I f you 'd like t o enable t h is, sim ply syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e set t he CLICOLOR env ir onm ent v ar iable t o YES: w ell on you r w ay.

$ export CLICOLOR=YES

You can cust om ize t he color s used by set t ing t he LSCOLORS env ir onm ent v ar iable. See t he ls m an page f or m or e infor m at ion.

What Can I Execute? To q uickly list all t he com man d lin e ut ilit ies available, in ot her w or ds t h ose u t ilit ies t hat ar e in dir ect or ies list ed by y our PATH env ir onm ent v ar iable, hit Shift - Esc t w ice in a r ow . A m essage w ill app ear : •

Table of Content s



Review s

• •

Reader Rev iew s

Display Er all r ata 1024 possibilities? (y or n)



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Answ er yes an d y ou can p age t h rou gh all of t he com m and s.

By Jam es Duncan Davidson

Pub lish er: O'Reilly

The f ir st line of a sh ell scr ip t is special and ind icat es t o t he sy st em t hat it is t o be execut ed w it h Pub Dat e: Decem ber 2 00 3 t he / bin/ sh p r ogr am. The f irst lin e alway s st ar t s w it h t he # ! char act er s ( k now n t o Un ix hand s as I SBN: 0- 59 6- 005 00 -8 t he shebang line) follow ed b y t he n ame of t he t ool t o ex ecut e t he scrip t w it h. For ex am ple, if you Pages: w ant ed t o w32 r it6 e a sh ell scr ipt u sin g t csh, t h e fir st line w ou ld r ead #!/bin/tsch. For m ost pu rp oses it ' s best t o w r it e sh ell scr ipt s u sing eit her t h e sh or bash sh ells. Wr it ing t o t h e sh sh ell w ill r esult in scr ip t s t h at ar e por t ab le t o t h e gr eat est num ber of sy st em s. Wr it ing t o bash is alm ost as good d ue t o t he p opular it y of t he bash sh ell. When y ouMac cr eat y ouultshim ouldn 't scat t ermy t h em all TM) over; for t he pow filesyst em .sJust all of Ru nning OSe Xshell Pantscr heriptiss,t he at e Sw iss Ar Knife( er user w h oas w ant to y ourom apize, plicat s ,arand e gat her et her t heMac. App licat orreader y, you sshou lace all cust t wion eak g en ered allyt og r ev u p tin heir This ions b ookdirect t ak es deepld inp side Macy our OS shellcor scr s t oget her one The com m on cr eat shell scrofiptt heir s is X's e,ipt r evealing t heininn er place. w ork ing s of Pant her Un f orix t hcon osevent w hion o w for ant user t o g-et t h eed most out t o place t hemmint a ~be / bin d irect syst em . You ayonot a Mac guorruy. w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Wr it ing shell scr ipt s t h at ar e m or e t han j ust a collect ion of sim ple st at em en t s is incr ed ib ly usef ul. I t 's also som et hing t h at y ou can w r it e a book on—an d man y people hav e. See " Fur t her Ex plor at ions" at t h e en d of t he chapt er for b ook recom mend at ions t h at w ill h elp y ou ex plor e t he w or ld of shell pr og ram m ing.

3.6 Getting Help The bash sh ell p rov ides a help com m and t hat w ill giv e infor m at ion about all it s b uilt - in com man ds.Ex am ple 3- 14 sh ows how t o get in for m at ion ab out t he alias com m and. •

Table of Content s

Exa m pl e 3Review - 1 4 s. Ge t t i ng h el p a bout a li as • •

Reader Rev iew s



Er r ata



Academic

$ • help aliasTen Things I Dig About Pant her •

Scheduling Tasks in Pant her

alias: alias ... ] Running Ma c O S X [-p] P ant he [name[=value] r By Jam es Duncan Davidson

'alias' with no arguments or with the -p option prints the list Pub aliases lish er: O'Reilly of in the form alias NAME=VALUE on standard output. Pub Dat e: Decem ber 2 00 3

Otherwise, an is defined for each NAME whose VALUE is given. I SBN: 0- 59 6005alias 00 -8 Pages: 32 6

A trailing space in VALUE causes the next word to be checked for alias substitution when the alias is expanded. Alias returns true unless a NAME is given for which no alias has been defined. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. I f you w ant t o get a list of com m and s t hat help can help you w it h, use t he com m and by it self . To g et help about any ot her comm and in t he Unix shell, use m an, t h e all- pur pose, Sw iss Arm y Knif e for g et t ing infor m at ion for m ost com m ands on t he syst em in a f or m k now n as a m anpage. For exam ple, t o see t h e m anpag e for m an, t y pe t he f ollow ing :

$ man man

When y ou ex ecut e t his com m and you 'll see t he out pu t show n in Figur e 3- 4 . Not ice t hat t h er e's a colon ( : ) at t he b ot t om of t h e w in dow w it h t he cu rsor n ex t t o it . This indicat es t hat t her e's m or e cont ent t o b e seen in t h e m anpag e. At t h e pr om pt you can: Hit t h e Spacebar or t he F k ey t o p age dow n Hit t h e B k ey t o go b ack a pag e Ty pe a / ( slash) f ollowed by a w or d t o sear ch for w ar d f or t hat w or d Hit t h e Q key t o quit

Figu r e 3 - 4 . The m a n com m an d



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir When q uit ou tnot of vbe iewin g a gu m anpag e, tyhe ortmat goes anyou d you e lefitt , wit h 'll t hbee syst emy.ou You m ay a Mac ru w hen ou inf st ar t hision book , b aw ut ay once 'v e ar r ead you sam t ent s ay. in you r w indow as y ou h ad befor e y ou ex ecu t ed t h e m an com m and. This is w ell eoncon you r w becausem an act u ally u ses t he pr ogr am conf igur ed in y our en vir onm ent t o be t he p ager—a pr ogr am t hat can t ak e out p ut and st ep t h rou gh it a page at a t im e. By d ef ault t he p ager is t he less t ool, w hich is t h e app licat ion t hat allow s you t o use t he k eyst r ok es list ed abov e. I f y ou w ant , y ou can use t h e m or e p ager by set t ing y our PAGER env ir onm ent v ar iable as f ollow s:

$ export PAGER=more

The m or e p ager isn't as f ull- feat ur ed as less, b ut it does leave t he cont ent s of t he m anp age onscr een w hen y ou exit . All t hings being eq ual t h ough , I sug gest y ou op en a second Term inal w indow rat her t han chang e y our pag er t o b row se t h e m anpag e docum ent at ion. The r eal t r ick t o u sin g m an is kn owin g w h ich comm an d m igh t b e t he on e t hat y ou w an t inf orm at ion on. To help you f in d t he r ight m anpag e, use t he apr opos com m and. For ex am ple, if y ou w er e w ant ing t o find t h e m anpag es con t aining infor m at ion about pow er m anag em ent , y ou could use t he f ollow in g com m and:

$ apropos power

This r et ur ns six m anp ages, w it h on e for pm set t hat has a su mm ar y ind icat ing t h at it ' s for m odify ing pow er m anag em ent set t in gs.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.7 Editing Text Files While edit ing t ex t f iles in t he GUI is st raigh t for w ar d usin g t he bu ilt - in Tex t Edit ( / App licat ions) , edit ing files using t he com m and - lin e t ools hasn' t alw ay s been a w alk in t he par k u nless y ou ar e com for t able w it h old- school t ex t edit or s lik e v i or Em acs. Bu t t h ank s t o t he open com m and, comofmContent and- line •sev er al of t heTable s ed it in g t ask s t h at y ou need t o per for m can be don e in t he GUI . For exam ple, t o open up you r bash h ist or y f ile in Tex t Edit , use t he follow in g com m and: • Review s •

Reader Rev iew s



Er r ata



Academic $ open ~/.bash_history



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

For m ost t ex t f ile edit in g, how ev er , Tex t Ed it is a lit t le u nder pow ered. Also, it can' t be used as t h e comPub man d- line edit or p rog r am ( v ia t he EDITOR env ir onm ent v ar iable) , and it can 't be used t o lish er: O'Reilly edit f iles w h ile you ar e logged in rem ot ely . Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

3.7.1 pico

I f you d o need t o edit t ex t files on t he com man d line—say y ou are log ged in r emot ely or n eed t o edit a file ow ned by r oot —t he easiest t ex t edit or t o use on t h e sy st em is pico. To use pico t o edit a useMac t heOS f ollowin g her comismtand: Ruf ile, nning X Pant he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e $ picofilename w ell on you r w ay.

When y ou u se pico, y ou' ll see t he user int er face show n in Figur e 3- 5 . I n place of a t oolb ar, t her e is a ser ies of com m ands at t h e bot t om of t he screen. Th e car et ( ^ ) char act er pr ef ixin g all t hose lines st ands for t h e Cont rol key on y our k eyb oard . Sim ply pr ess t he Con t r ol k ey p lus t h e let t er of t he com m and t o perf or m some act ion . For ex am ple, t o sav e a file, w hich p ico r ef er s t o as " Wr it eOut , " hit Cont r ol- O. To open, or " Read" a f ile, hit Con t rol- R. And t o ex it , hit Con t rol- X. Aside fr om t he Con t r ol k ey com binat ion s, pico is fair ly st r aigh t for w ar d t o use. Ar r ow k ey s m ov e t he cu rsor u p an d dow n, an d wh at ever y ou t yp e is inser t ed w herev er t he cur sor is locat ed at .

Figu r e 3 - 5 . The pi co t ex t edi t or



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

By def ault , pico is not set as t he d ef ault com m and- lin e editor on t h e syst em . This m eans w hen a com m and- lin e t ool, such as cvs or cron t ab ( wh ich I 'll t alk about in Ch apt er 8) , w an t s y ou t o edit a file, it wOS ill pXop u pher t heissyt st efat ault ediss it orArofmy v i.Knife( To setTM) pico as pow you er r defau , simt oply Ru nning Mac Pant heem ultdim e Sw ; for user slt wedit h o or w ant set t he EDITOR env ir onm ent v ar iable: cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. $ export EDITOR=pico

And , as alw ays, t o m ak e t his chan ge per m anent you can put it int o y our . bash_p r ofile.

3.7.2 vi and Emacs Mac OS X also sh ip s w it h t he t w o vener able Unix pow er houses of t ext edit ing: v i an d Em acs. Each of t hese t ools has a long hist or y and feat u re set s t h at ar e ev en longer . Th ese t ools ar e pow er ful indeed an d up t o t h e t ask of any am oun t of t ex t edit ing t h at y ou w ant t o d o, including har dcor e dev elop ment , but in man y w ays t hey ar e m ore com plicat ed t han w hat y ou need f or ever yd ay t asks. How ev er , if y ou are alr eady a user of eit h er of t hese t w o edit or s, t hey ar e av ailab le for u se on t he syst em .

I n Mac OS X Pant her, t he def ault v i is now v im , a v i r eplacem ent t hat du plicat es all t he f unct ionalit y of t h e or ig inal v i an d ex t ends it in man y usefu l w ays, ad ding un lim it ed und o and sy nt ax hig hlight in g.

This isn' t t h e place for a f ull t u t orial on h ow t o use v i or Em acs, but you shou ld b e able t o ex it out of eit her of t hese sh ells if y ou find y our self in one. To ex it ou t of v i, t y pe t he f ollow ing :

:q!



Table of Content s



Review s

• ex it ou t ofReader Revtiew s Cont r ol- X, t hen Cont rol- C. To Em acs, y pe •

Er r ata



Academic

Ten Things I 3.7.3 BBEdit • •

Dig About Pant her

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

I f you ar e goin g t o be d oing a lot of t ex t ed it ing and w ant seam less int egr at ion bet w een t h e By Jamman es Duncan com d line Davidson and a GUI - based edit or , I su ggest t h at y ou t ak e a look at eit her BBEdit , sh own in Figur e 3- 6 , or it s lit t le br ot her , Text Wr an gler , w h ich shar es man y of BBed it 's f eat ur es. Bot h of t hese Pub ar lisheer:fr O'Reilly om Bar e Bon es Sof t w ar e ( w w w .b ar eb ones. com ) . Not only is BBEd it a gr eat t ex t editPub or , Dat bue:t itDecem int egr es3 w ell w it h t h e Un ix lay er of Mac OS X and t he com m and lin e. ber at 2 00 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 3 - 6 . The / et c/ h ost conf ig f ile l oad ed in BBEd it

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

The on ly dow nside t o BBEd it is t hat it d oesn 't com e w it h t he sy st em . I n st ead, BBEdit w ill set you back ab out $ 150 f or a sing le license. Tex t Wr ang ler , w hich also int egr at es w ell wit h t h e comm and line ( ev en t h ough it spor t s few er f eat ur es t han BBEd it ) , cost s about $50 . You can d ow nload dem os of eit her edit or t hr ou gh Bare Bones Soft w ar e's w eb sit e.

3.7.3.1 Command-line integration When y ou r un BBEdit f or t he fir st t im e, it pr om pt s you t o inst all it s com man d- line t ool, bb ed it . Aft er y ou do so, you 'll b e able t o open files w it h t h e follow ing comm an d:

• •

Table of Content s

bbedit filename Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

I f you ar e using Text Wran gler, t he com m and- line t ool is nam ed edit in st ead of bb ed it .

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Unlike ItSBN: he com man d- line edit or s t h at allow y ou t o specify a file t hat doesn' t alr eady exist , y ou 0- 59 6- 005 00 -8 hav e t o t ell bb ed it t o exp licit ly cr eat e a new f ile w hen n eeded. To do so, use t h e - c ar g um en t as Pages: 32 6 show n:

$ bbedit -c newfile.txt Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on BBEd it can you ev r wen ay.ser ve as you r ed it or , t ot ally r ep lacing pico, v i, or Em acs in t h is role. Ex am ple 315 sh ows a script t hat can be used as you r edit or . Sim ply creat e t he scr ipt and save it as ~ / bin/ edit w it h bbedit .

Exa m pl e 3 - 1 5 . A scr ipt t o use BBEdi t as a n EDI TOR on t he com m a nd li ne

#!/bin/sh /usr/bin/bbedit --wait --resume "$@"

This com m and launches BBEd it in such a w ay t hat it k eep s t he pr ocess t hat r eq uest ed t h e ed it or w ait ing unt il you close t he w ind ow, t hen it pop s t he Ter m inal w ind ow fr om wh ich t h e ed it or w as called back t o t he f or eg rou nd. Af t er y ou sav e t he scr ipt , m ak e it ex ecu t able w it h chm od + x edit w it hb bedit an d t hen set you r EDITOR env ir onm ent v ar iable t o point at t h is shell scr ipt . To m ake t he chan ge per m anent , ad d t he f ollow ing line t o y our . bash_p r ofile:

export EDITOR=~/bin/editwithbbedit

3.7.3.2 Writing and executing shell scripts •BBEd it allow sTable you oft oContent w rit e sand ex ecu t e shell scr ipt s w it h out ev er going t o t he com m and line. • s ipt in a BBEd it w indow , t hen u se t he Run Sim ply w r it e Review you r scr Ru n m enu . BBEdit r uns t he • ipt and t h en Reader scr pu t Rev it s iew oust put int o a n ew w in dow as sh ow n in Figur e 3- 7 . •

Er r ata



Academic



Ten Things I Dig About Pant her



Figuin rPant e 3her - 7. Scheduling Tasks

Ru nn in g a scr i pt in BBEdi t

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3.8 Further Explorations This chap t er' s aim w as t o giv e you enou gh kn ow ledg e of how t he shell w or ks t o successfu lly execut e t h e comm an ds t h at I 'll be cover ing t hr oug h t he r est of t he b ook. How ev er, t his chapt er has just scr at ched t he sur face of w hat is possible w it h t he shell. •

Table of Content s



Review s

The f ollow in g b ooks are recom mend ed t o lear n m ore about t he sub ject s in t his chapt er : • • • • •

Reader Rev iew s Er tr ata Lear ning he bash Shell, 2n d Edit ion , b y Cam eron New ham , et al. ( O'Reilly & Associat es, I nc. , 19Academic 98) Ten Things I Dig About Pant her

Lear ning t he v i Edit or , in6tPant h Edit Scheduling Tasks herion , b y Lind a Lam b , et al. ( O'Reilly & Associat es, 199 8)

Running Ma c O S X P ant he r

Lear ning GNU Em acs, 2nd Ed it ion , b y Debr a Camer on, et al. ( O' Reilly & Associat es, 19 96)

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Part PART II: Essentials This p art of t he book giv es you t h e t ools y ou need t o ex am ine how you r syst em is r un ning and how t o ad ju st m ost of t he kn obs behin d it s op er at ion . I 'll cov er t opics inclu ding pr ocess cont r ol, m anagin g sof t w are in st allat ion s, and for m ulat ing a b ack up st r at egy f or y our dat a. • • • • • • •

Table of Content s Review Ch apt ers in t hs is par t of t he book in clu de: Reader Rev iew s Er r ata

ChAcademic apt er 4, Sy st em St art u p and Login Ten Things I Dig About Pant her

Ch apt er 5, User s and Gr oup s Scheduling Tasks in Pant her

Running Ma cCh O Sapt X Per ant6, heFiles r

and Per m ission s

By Jam es Duncan Davidson

Ch apt er 7, Mon it or in g t h e Syst em Pub lish er: O'Reilly

Ch apt er 8, Schedulin g Task s

Pub Dat e: Decem ber 2 00 3 I SBN:Ch 0- 59 6-er 0059, 00Pr -8 ef erences apt

and Default s

Pages: 32 6

Ch apt er 10 , Disk s and Filesy st em s

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 4. System Startup and Login Usu ally w h en y ou sit dow n at y our com pu t er, t he f irst t hing y ou do is eit her h it t he pow er - on bu t t on on t he syst em , or —for t hose w ho leav e t heir m achines on all t h e t ime—log in. Most of t he t im e y ou p rob ably don 't t hink mu ch ab out wh at h appens b eh ind t he Ap ple logo and sp inner as •t he sy st em boot Table ofpContent s su or about t he ev ent s t h at h appen bet w een t he t ime y ou ent er a u ser nam e •and passw or d Review an d sw h en t h e desk t op app ear s. I n t his chap t er , h ow ev er, I ' m g oin g t o r emov e t h e •v eil of m y st erReader y an dRev sh iew ow show it all h appens. •

Er r ata

is not a sing le- st ep p r ocess; ov er 100 pr ogr am s t ak e par t in t he pr ocess of •Boot ing a Mac Academic y our m achine f r omPant an her in er t collect ion of p last ic an d met al in t o a ru nnin g sy st em . I n •t r ansfor m ingTen Things I Dig About gh, t he prTasks ocess be br oken dow n int o t w o m ajor st eps. Th e fir st is t h e har dw ar e •gener al, t houScheduling in can Pant her pow er inMa g cupO Sand or ganizing it self . The second is t he h ard w are lau nching t h e operat in g sy st em Running X P ant he r and t h e operat in g sy st em st art in g it self up. Fir st , let 's t ak e a look at w h at hap pens at t he By Jam es Duncan Davidson har dw ar e lay er . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.1 The Hardware Boot Process When y ou p ress t h e pow er- on b ut t on on you r Mac, a sm all h ard w are p r ogr am emb ed ded in t h e m a y our m achine, k now n as t h e POST ( Pow er - On Self Test ) , is act iv at ed . The f ir st t hing t h e POST does t hen init ialize t he CPU. Nex t t he POST perf or ms som e t est s on t he cor e sy st em com pon en t s, su ch as sy st can sboot . I f ev er y t hing checks out OK, t he POST st ar t s a pr ogr am called Op e •m ake su re t he Table ofem Content on a r epr ogr am mab le chip on t h e m ot her boar d. I t ' s at t his point in t he b oot pr ocess t hat you hear t • Review s chim e. • Reader Rev iew s •

Er r ata

Op en Firm w ar e' s f ir st job is t o f ind t he var ious h ard w are devices at t ached t o t he mot herb oard of t h • includes int erAcademic nal har dw ar e such as video car ds and har d dr iv es as w ell as ex t er nal har dw ar e connec •FireWir e, USB, Tenan Things I Dig heren Fir mw ar e discover s t he var ious h ar dw are devices, it or gan d SCSI buAbout ses. Pant As Op •dev ice t ree, w Scheduling Tasks in Pant her hich w ill m ak e it easier for t h e high er lev els of t he sy st em t o access t hose d ev ices. Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Dat e: Decem ber 2 00 3 Firmware? SoPubWhat's Open I SBN: 0- 59 6- 005 00 -8 32 6 t You' rPages: e no doub

f amiliar w it h t he t er m s soft w ar e an d har dw ar e. Bu t fir m war e? Well, w hen chip designer s m ake a m ist ak e in a h ard w are pr ogr am , t hey pr et t y m uch hav e t o t hr ow aw ay t h e chip st ar t ov er unlik e w it h sof t w ar e w here all you need t o d o is r eplace t he inst r uct ions w it h out t hr ow in aw ay a phy sical d ev ice. The solut ion t hat har dw ar e designer s came up w it h is t o creat e a chip t hat be r epr ogr am m ed . The in st r u ct ion s on t he chip ar e perm an en t ly st ored on it , so it ' s not quit e sof t w But t heyMac canOS be Xchan neit her e my nor Knife( sof t w TM) ar e,; t for hey pow set ter leduser on st he Ru nning Pantged. her Being is t he ult im at ehar Swdw issarAr w hnoame w antfirtmw o ar e cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Opcor en e, Firm w ar e is tt he he inn nam ening t os tof hePant I EEE st an forwah omwach dependent OSoft htat g rew X's r evealing ere wgiv ork her f ordar thd ose antin teo in g et t h e most BI out heir of t he boot cod e used in w ork st at ions an d ser ver s f rom Sun Micr osy st em s. What sep arat es it fr syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e om plem wBI ellOS onim you r wen ay.t at ions is t h at it uses a b yt ecode r epr esent at ion of t he For t h langu age. This allow s sam e cod e t o r u n on dif fer en t p rocessor s w it hou t chan ge, w hich let s h ard w are mak ers pr ovid e ondr iv er s t h at w ill w or k on Pow er PC, Spar c, and I nt el x 86 ar chit ect u res. I n addit ion, Open Fir m w ar e pr ov ides a m ech anism for each piece of har dw ar e t o d escr ib e it self so t h at t h e host sy st em can b es it . You can f ind out mor e in for m at ion ab out Open Fir m w are at w w w .op en fir m w are. or g/ .

Aft er Open Fir m war e f inds t he har d war e, it look s f or an oper at ing sy st em t o b oot . First it look s at it conf ig ur at ion for t h e boot device. Assu min g t he conf ig ur ed d ev ice is a d isk an d is at t ach ed , it w ill t h disk f or t he b lessed oper at ing syst em boot er and load an d st ar t it . I f a boot ab le oper at ing sy st em is conf ig ur ed d ev ice, Open Fir m war e w ill cond uct a sear ch of an y ot her d riv es at t ached t o y our sy st em boot dev ice can be f ound , y ou' ll be p resen t ed w it h a f older icon w it h a b lin kin g q uest ion m ar k indica syst em could be f ound .

4.1.1 Taking a Peek at Open Firmware Ev en t houg h y ou w ill rar ely ( if ev er ) need t o d eal direct ly w it h Open Fir m w are, y ou can t ak e a quick conf ig ur at ion usin g t he nv r am com m and- lin e t ool. Ex am ple 4- 1 sh ows t he u se of t h is comm and an d ( slig ht ly ab br ev iat ed) .

Exa m pl e 4 - 1 . Looki ng a t O pe n Fi r m w a r e 's con fi gu r at ion

$nvram -p oem-banner?

false



boot-scriptTable of Content s •

Review s

• Reader Rev-1 iew s virt-size •

Er r ata

• Academic screen output-device •

Ten Things I Dig About Pant her

• output-device-1 Scheduling scca Tasks in Pant her Running Ma c O S X P ant he r

input-device By Jam es Duncan Davidsonkeyboard input-device-1

scca

Pub lish er: O'Reilly

Pub Dat e: Decem ber mouse-device

2 00mouse 3

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 selftest-#megs

0

boot-volume

3

boot-device

mac-io/ata-4@1f000/@0:10,\\:tbxi

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o boot-screen cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir boot-args syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. default-server-ip default-gateway-ip default-router-ip default-client-ip default-subnet-mask default-mac-address?

false

screen-#columns

100

screen-#rows

40

scroll-lock

true

skip-netboot?

false

diag-switch?

false

boot-command

mac-boot

ram-size

0x30000000

Not ice t he b oot - dev ice line in t h e out pu t . This t ells Op en Fir mw ar e w hat dev ice it sh ould boot fr om . Firm w ar e is set t o boot f r om t he ATA- based disk dr iv e. This st r in g will b e dif fer en t depend ing on wh ( ATA or SCSI ) y our h ar d d riv e is at t ached t o and w hat p ar t it ion on t hat dr iv e y ou ar e u sing f or y our •

Table of Content s

The nv r am com m and • Review s can also b e used t o set t h ese v alues if you hav e an adm inist r at or account on t a p ar t icu lar value in Open • Reader Rev iew s Fir mw ar e, y ou w ou ld u se t he f ollow ing sy nt ax : •

Er r ata



sudo nvram name=value Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jamifesy Duncan And ou w anDavidson t t o set

a lar ge n um ber of v alu es at on ce, y ou can load t hem f r om a t ex t f ile. The file list of nam e= value st at em ent s. Th e sy nt ax for load in g t he cont ent s of t he f ile in t o Op en Fir mw ar e is Pub lish er: O'Reilly

sudo nvram Pub Dat e: Decem-f ber filename 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

4.1.1.1 Resetting Open Firmware IRu t shou g o wOS it hou t sayher in g isbut uckin g eabSw out y our Open e set t ingss can y our nningld Mac X Pant t hemult im at isswit Arhmy Knife( TM)Fir ; m forwar pow er user w h opwutant t o sy st odd om st atize, e. Lu ily,, and if you goerov er boar gs do get m u ck edesu reader p, t here's an easy ay t oOS reset t cust t wck eak g en ally r ev udpand t heirt hin Mac. This b ook t ak s deep in sidew Mac r ef err as " Zap ping t heer PRAM" . To doPant t his,her hold n Op g y our X's cored e, troevealing t he inn w ork ing s of f or dow t h ose w ht ion o w-ant- Pt oRg w ethile t h e boot mostin out of t machin heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.1.2 Updating Firmware Ev ery so oft en an upd at e t o Mac OS X is r eleased t h at r equir es a f irm w ar e up gr ade f or cer t ain m ach w or k corr ect ly . Since Open Fir mw ar e is p rim ar ily used at boot t ime, n ot h aving an up - t o- dat e fir mw m achine t h at w on' t boot —it ' ll get st uck at a g r ay scr een inst ead. You should be su re t o r ead t he r ele m ajor updat e t o Mac OS X t o see if y ou n eed a f irm w ar e up dat e b ef ore in st alling it . Anot h er place t o look f or docum ent at ion abou t f irm w ar e up dat es is on Apple's su ppor t w eb sit e at w w w .in fo. app le. com/ . To quick ly see t h e pages d ealing w it h fir m w are u pdat es r equir ed for Mac OS Firmware Update in t h e " Sear ch Apple Su ppor t " box . These pages w ill t ell y ou how t o det er mine w need a fir m w are upd at e for you r Mac b ef ore you inst all a new oper at ing syst em . Ther e ar e t w o w ay s t o det er m ine t h e fir m w are ver sion y ou hav e. The f ir st is t o use t h e Sy st em Pr of ( see Ch apt er 6 f or d et ails on Sy st em Pr of iler ) . The second is t o access Open Fir m w are d irect ly.

4.1.3 Accessing Open Firmware I f t he nv r am com m and doesn't giv e y ou en ough access t o t he f irm w ar e of t he sy st em , y ou can d irec holdin g d ow n t he Op t ion- - O- F key s as y ou b oot y our machin e. This w ill dr op you d ir ect ly in t o t he com man d line. You shou ld b e gr eet ed by som et hing t hat looks lik e Ex am ple 4- 2.

Exa m pl e 4 - 2 . Th e O pen Fir m w a r e com m an d- li ne in t e r f ace

Apple PowerBook3,1 4.1.8f5 BootROM built on 03/21/01 at 11:49:53 Copyright 1994-2001 Apple Computer, Inc. •

Table of Content s



Review s



Reader Rev iew s



Er r ata

All Rights Reserved

•Welcome to Academic Open Firmware, the system time and date is: 22:51:00 09/21/2003 • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

To continue booting, type 'mac-boot' and press return. By Jam es Duncan Davidson To shut down, type 'shut-down' and press return. Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

ok

Pages: 32 6

0 > _

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS The cor f ir st of out pt he ut tinn ellsery ou t he of you com ut erw h follow ed tboy gtet he t ver y our irm w ar X's e, line r evealing w ork ingmsod of elPant her rf or t hpose o w ant h e sion mostofout of tfheir comem put.erYou is an App le be Powa erMac Book and f irm w ar v er sion, is 4 . once 1. 8f5 .you 'v e r ead it , you 'll b e syst m ay not gu3,ru1 w hent he y ou st ar t tehis book b ut w ell on you r w ay. Aft er t he ban ner is pr int ed, you ar e at t he Op en Fir mw ar e pr om pt ( > ) , a pr et t y limit ed place un less w hat you ar e d oin g. Table 4 - 1 list s a few of t h e com m and s t hat y ou can use. I f you get you r self in a Ex am ple 4- 3 sh ows how t o r eset y our fir mw ar e an d r est art t he sy st em.

Tab le 4 -1 . O pe n Fir m w a r e com m an ds. Ke y

De scr ip t ion

printenv

Print s all the var iables held in fir m war e

setenvname=value

Set s a v ariable to t he giv en v alu e

password

Set s an Open Firm ware password

reset-nvram

Clear s th e v ar iables in fir mw ar e and r eplaces t hem with def au

reset-all

Causes th e m achine t o r eboot

mac-boot

Causes th e m achine t o cont in ue boot ing in to t he conf igur ed s

shut-down

Shut s down t he m achine

Exa m pl e 4 - 3 . Re se t t i ng O pe n Fi r mw a r e an d r e st a r t in g t he sy st e m

0 > reset-nvram •

Table of Content s

0 > reset-all • Review s •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

Scheduling in Pant her 4.1.4 Setting the Tasks Boot Disk •

Running Ma c O S X P ant he r

ToJam By setest he Duncan diskDavidson t h at y ou w ant t o boot fr om , u se t he St ar t up Disk pr efer en ce panel in Sy st em Pr efer e launch t his t ool, as show n in Figur e 4- 1 , it w ill find all t h e syst em fold er s on t h e har d dr iv es at t ache andPub oflish ferer: t hem as opt ions t o choose fr om . As w ell, t her e' s an it em labeled " Net w or k St ar t up" . This s O'Reilly bootPub fr om a Net Boot serv er on you r net w or k, if available. Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 4 - 1 . The St ar t up Di sk pr e fe r en ce pa ne l

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Macintosh Model Names When y ou see y our Mac' s m odel nam e in Open Fir m w ar e or in Syst em Pr ofiler as som et h ing lik e " P y ou m igh t w on der how t hat map s t o it s mor e w ellkn own n ame of " Power Book G3 ( FireWir e) " . I t r e m achine using t h e lat t er nam e w hile Op en Firm w ar e and t h e sy st em int er nals k now it as t he sh ort • nam e—and Table of Content s t her e's n o dir ect m appin g b et ween t he t w o nam es t o b e fou nd on t he App le w eb sit e. T • how ev er , onReview y our sh ard d riv e at • / Sy st em / Libr Reader Rev iew ar y / Syst emsProf iler/ SPPlat for m Repor t er .spr epor t er / Cont ent s/ Resour ces/ English. lp roj / L • t hat giv es t he Er r ata m app ings b et ween t hese nam es. I t ' s a Unicode f ile, so you 'll n eed t o open it in Tex t E • open - e f ilenAcademic am e com m and, w hich f or ces a file t o be opened in Tex t Ed it ) or som e ot her edit or t hat encoding • Unicod e t extTen Things I .Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

When By Jam esy ou Duncan select Davidson an op er at ing sy st em t o boot fr om in t h e St ar t up Disk pr eference p anel, t w o t h ings Op en Firm w ar e is pr ogr am m ed w it h t he locat ion of t he b oot d ev ice. Second, a sm all bit of in for m at t he Pub boot block s of t h e har d disk t hat cont ain t he sy st em in dicat in g wh er e on t h e dr ive t he boot pr og lish er: O'Reilly operPub at ing syst em is locat ed . This second st ep, kn ow n as blessin g t h e syst em , allow s m or e t han one Dat e: Decem ber 2 00 3 on a h ard dr iv e or par t it ion. This w hich means you can boot in t o eit her Mac OS X or Mac OS 9 even I SBN: 0- 59 6- 005 00 -8 inst alled on t he sam e p hy sical dr iv e. Pages: 32 6

4.1.4.1 Blessed system disk To look at t h e st art u p set t ing s for you r m ach in e fr om t he com man d lin e, u se t he bless com m and. Fo Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o w ant ed t o t ake a look at t he v ariou s set t in gs of t h e dr ive y ou ar e cur rent ly ru nning f rom , you w ould cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS show n in Ex am ple 4- 4. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4 -4 . Exe cu t i ng ble ss t o e xa m in e boot se t t i ng s

$sudo bless -info -bootBlocks finderinfo[0]:

2483 => Blessed System Folder is /System/Library/CoreServices

finderinfo[1]:

0 => No Startup App folder (ignored anyway)

finderinfo[2]:

0 => Open-folder linked list empty

finderinfo[3]:

0 => No OS 9 + X blessed 9 folder

finderinfo[4]:

0 => Unused field unset

finderinfo[5]:

2483 => OS X blessed folder is /System/Library/CoreServices

64-bit VSDB volume id: 0x1BD7BA028DDA6A89

Tr y chang in g t he set t ings ar ou nd in y our St art up Disk pr ef erence pan el and execut ing t h is com m an

chang es. You m ay hav e t o swit ch out of t he St art u p Disk p r ef er ence pan el for it t o sav e y our chan g bit m ore y ou can d o w it h t he bless com m and such as blessing a p art icular folder or p art it ion on y ou bless m an page f or det ails.

4.1.5 Changing the Boot Disk at Boot Time ou will w an t t so boot fr om som e ot her d ev ice t han t he default . Usually t h is happ en s w h •Som et im es yTable of Content boot fr om a CD or a • Review s Fir eWire d r iv e t o r ep lace or repair y our pr imar y OS inst allat ion. You can use t h t• o ch oose t heReader boot Rev diskiewy sou wan t t o use: • • • •

Er r ata

To b oot Academic f r om a CD, h old dow n t h e C key as y ou boot . Ten Things I Dig About Pant her Tasks Pantvher To b oot Scheduling f r om a Net Bootin ser er , h old d own t h e N k ey as y ou b oot .

Running Ma c O S X P ant he r

To see t he local dr iv es t hat cont ain a b oot able par t it ion, hold dow n t he Op t ion key as y ou boot Op en Firm w ar e pr ogr am called t h e OS Pick er , as sh own in Figur e 4- 2 .

By Jam es Duncan Davidson

PubI lish er: O'Reilly f you h ave on e

disk t hat cont ains Mac OS 9 an d on e disk t hat cont ains Mac OS X, y ou can boo k ey w hile t he sy st em boot s. I f y ou h ave mor e t h en on e Mac OS X sy st em i t his I SBN: t rick 0- 59w 6-on' 005t00w-8or k .

Pub Dat e: g Decem 00 3X holdin d owber n t2he Pages: 32 6

Figu r e 4 - 2 . The O S Pick e r Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

OS Pick er dup licat es som e, but not all, of t he f unct ionalit y of t he St ar t up Disk pr efer en ce panel. I t i can only see t he blessed oper at in g sy st em on a par t it ion. I f y ou hav e bot h Mac OS X and Mac OS 9 sam e par t it ion, OS Picker w ill show on ly t he on e t hat w as config ur ed f or boot in t he St ar t up Disk pr y ou w an t t o boot int o t he non - blessed operat in g sy st em on a par t it ion, you 'll h ave t o m ake t he chan and not w it h t he OS Picker .

4.1.6 Locking Down Open Firmware Since Op en Firm w ar e cont r ols t he b oot p rocess and w ill accept inpu t f rom t he k eyb oard d ur ing sy st t im e—eit h er in t h e for m of boot - key com binat ions or by accessing t he Open Fir m w are p r omp t —it is t o mak e y our Mac boot fr om an y ot her dr iv e. For most per son al users, t h is isn 't a p rob lem . I n fact , flex ibilit y in st ar t ing up y our sy st em wit h m ult iple v er sions of Mac OS. I n corp or at e or academ ic lab

y ou m ay n ot w an t people t o be able t o m u ck ab out w it h t h e set t in gs of t h e comp ut er , or t h e dat a it easily . Ther e ar e t w o w ay s t o en able an Open Fir m w ar e passw or d. The f irst is t o d own load t he Op en Firm w ut ilit y f rom Apple t h r ough it s sup por t w eb sit e at docs. in fo. app le. com/ art icle.h t m l?ar t n um = 120 095 is at t he Op en Fir mw ar e com man d lin e using t he f ollowin g p rocess: • 1. • •



- O- F) .

Review s

2 . At t he Op en Firm w ar e pr om pt , t yp e y our password. You w ill be p r omp t ed t o ent er y our passw Reader Rev iew s

• 3. • •

Boot in tTable o Open Fir mwsar e ( Opt ionof Content

Er r ata Set a secur it y m ode f or Op en Firm w ar e by t yp in g setenv security-mode full or setenv se Academic command. Th e fir st opt ion w ill t ot ally lock dow n y our m achine an d r equ ir e a passwor d t o be en I Digopt About syst em .Ten TheThings second ion Pant w ill her let t he sy st em boot as con figu red bu t w ill r equir e a p assw or d t Scheduling Tasks in Pant her key op t ions. Op en Firm w ar e or use an y boot

Running Ma c O S X P ant he r

4 . Rest ar t t h e m ach in e using t he reset-all com m and.

By Jam es Duncan Davidson

To t ur n of f passw ord pr ot ect ion, b oot int o Op en Firm w ar e and t y pe setenv securitymode none. Y er: O'Reilly for Pub youlish r passw ord , if one is set , t o mak e t h is change. Pub Dat e: Decem ber 2 00 3

I f you IhSBN: ave 0-a 59 passwor d - pr ot ect ed m ach ine t hat y ou' ve f or got t en t he p assw or d f or , t her e is a way t o 6- 005 00 -8 passwPages: ord : op 32 6en t h e mach in e and chang e t he t ot al am ount of RAM in you r sy st em. Then reset t he P Op t ion- - P- R at boot t im e. I t shou ld b e not ed t hat being able t o lock d ow n t he syst em w it h an Open Fir m w are passw or d is not feat u re. I f som eb ody can open u p t he m achine an d r eset t he m em ory in it , t hen t he passw ord p rot e not h ing. Su r e, you can padlock deskt op m achines, bu t t h er e is n o w ay t o keep p eop le out of t he m e Ru Pantmher is t he im at einSw isspuArt er mysecur Knife( TM) ;som for ebody pow er huser s who w slotnning s on aMac laptOS op .XThis at ches a ult t r uism com it y—if as access t oant a mt oachine cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS t he F can gain access t o t h e dat a on it . The only r eal w ay t o pr ot ect t h e dat a on a m ach ine is t o use X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir discussed in Ch apt er 10 , Disk s and Filesy st em s. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.2 The Operating System Boot Process When Open Fir m w ar e boot s Mac OS X, it d oes so t hr ough Boot X ( locat ed in / Sy st em / Libr ar y / Cor eSe I t 's im p ort an t t o not e t hat Open Fir m w are doesn 't kn ow t hat it ' s boot ing Mac OS X, n or does it hav e concep t of t h e filesy st em t hat cont ains Boot X. All it k now s is t hat t here is a pr og ram at a par t icu lar it can load sand r un. I t is t he j ob of Boot X t o t ak e care of t he r est . •on a d riv e t hat Table of Content •

Review s



Ten Things I Dig About Pant her

The f ir st t hing Boot X does is dr aw t he " boot in g" im ag e on t he screen. Th is is t he m onochr om e g ray • Reader Rev iew s scr een w it h t he sp in ner on it t h at y ou see af t er y our com put er chim es. I t t hen loads t h e k er nel f r om • Er r ata and t h e essent ial k er n el- level d ev ice dr iver s ( such as t hose f or accessin g d isk d r iv es) necessar y t o g • Academic t hin gs r un ning. Once loaded, t he k er n el' s init ializat ion p rocedur e is called . •The k er nel loads Scheduling Tasks in Pant d ev ice dr iver s forherall t he d ev ices con nect ed t o t he com put er an d t hen f inds t he boo Running Ma c O SaXbit P ant he r t hat I t m ay seem odd

t h e ker nel has t o f ind t he d riv e t hat it was load ed f rom , but r em em ber t w as fr om t h e dr ive and t hen st ar t ed. I t has t o f in d t he dr iv e it w as load ed f rom by consult ing By Jamloaded es Duncan Davidson Firm w ar e. Once it find s t he b oot d riv e, it m oun t s it at t he Un ix filesy st em root ( / ) , st ar t s it s in t ern a ser v er, wh ich allow s pr ocesses t o com m unicat e w it h each ot her , and t h en st ar t s t he BSD / sbin/ in it p Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

4.2.1Pages: BSD Initialization 32 6 The BSD init p r ogr am is t he fir st Unix pr ocess t o st art up in t he sy st em , an d it ow ns ev er y ot h er pr o t he sy st em. I t carr ies out fou r job s: Ru1nning Macines OS Xw Pant her is ttoheboot ult im Swhiss Knife( TM) user s w h oultwiuser, ant t o" or t h . Det erm h at m ode intato;e eit er Ar t hemy n orm al m od;e,for whpow ich er is called "m cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS " single- user" m aint enance m ode. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst You not be ainit Mac gu ru hen y,ou st ared t tin hist he book once e r ead you 'll ot b eh er p 2 . em Ru. ns t hm e ray c sy st em ializat ionwscript locat / et,cbdutirect or y,you wh'vich st ar tits, m any w ell on you r w ay. t hat ar e v it al t o t he sy st em . 3 . Lau nches t he loginw indow ap plicat ion so u ser s can log in t o t he sy st em . 4 . Cleans u p af t er all pr ocesses as t h ey t er m inat e so sy st em resour ces ar e n ot w ast ed.

4.2.1.1 The rc script The r c scr ipt lau nches a v ar iet y of pr ogr ams t hat perf or m t he follow in g sy st em init ializat ion t ask s: Mou nt t he local filesy st em. St ar t t he k er nel ex t ension loader , allow ing t he k ern el t o load dev ice d riv ers dy nam ically . Load t h e Mach b oot st r ap- based k er nel ser v ices list ed in t he / et c/ m ach_ in it . d d irect or y. These pr ov ide som e of t he essent ial fu nct ions of Mac OS X su ch as t h e Apple Ty pe Ser v er ( ATS) , Op e Dir ect or y , Kerb er os, an d t h e w indow ser v er , allow ing pr ogr am s t o dr aw t o scr een. St ar t t he local Net I n fo ser v er . St ar t t he up dat e b ackg rou nd pr ocess, w hich m ak es sur e t hat t he f ilesy st em cache in m emor y r eg ular ly sy nchr on ized w it h t he disk .

St ar t t he v irt u al m emor y sy st em an d en su re t hat t he sw ap file is pr oper ly creat ed. The last t hing t hat t h e rc scr ipt s d o is laun ch t h e Sy st em St ar t er p r ogr am, w hich t ak es care of t he f in st ages of syst em st ar t up .

4.2.1.2 Single-user mode •

Table of Content s

Single- user m ode is a special Unix sy st em st at e in w hich syst em st ar t up is st opped and a log in p rom • Review s off ered, allow ing f or adm inist r at ive an d main t en ance act ivit ies t o b e per for m ed . Hist orically t his m o • Reader Rev iew s been u sed w hen a sy st em b ecom es unst ab le and need s crit ical ar eas t o b e fix ed. I n t he last few v er •Mac OS X, t hEr ataim ary , alb eit rar e, use f or t his mod e w as t o r epair a disk dr ive wit h cor ru pt ed files. e rpr •t hat Pant h er Academic has b uilt - in f ilesy st em j our naling , w hich g uar ant ees t he in t eg r it y of files on t he har d d •need f or a sinTen Pant gle-Things u ser ImDig od About e is all buher t gon e. St ill, if y ou' d lik e t o use it , h old d own - S as you b oot •t he sy st em has Scheduling Tasks in Pant her b oot ed , y ou' ll be p resen t ed w it h a sim ple com man d- line p rom pt . To ex it single- user Running S Xoot P ant he r w ill cause t h e syst em t o go m u lt iu ser an d com plet e t h e boot in t o t he GUI t y pe exitMa orc O r eb ; exit env iron . Davidson By Jam es ment Duncan Pub lish er: O'Reilly

4.2.1.3 Verbose Pub Dat e: Decem bermode 2 00 3 I SBN: 0- 59 6- 005 00 -8

I f you Pages: ar e r eally in t er est ed in all t he t hings t hat ex ecu t e du rin g t his ph ase of t h e boot pr ocess, y ou 32 6 dow n - V as you b oot . I nst ead of t h e gr ay - on- gr ay Ap ple logo and sp inner , y ou'll see a plain- t ex t of t he var ious t h ings g oing on as you b oot y our sy st em . I f y ou wan t t o see t his ever y t im e y ou b oot syst em , execut e t h e follow ing comm an d: $ sudo nvram boot-args="-v" Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w onn you wbose ay. b oot ing, u se t he f ollow ing : Toellt ur of f vr er $ sudo nvram boot-args=""

4.2.2 SystemStarter The Sy st emSt art er p rog ram t ak es car e of t he final st ag es of t he b oot pr ocess wh ich t u rn t h e sy st em ju st anot her Un ix var iant int o Mac OS X. I t d oes so by st ar t ing up syst em d aem ons lik e Rend ezv ous Apache w eb ser v er , an d t he App leSh are ser ver . When Sy st em St ar t er r uns, t h e boot scr een chang es t he gr ay- on - gr ay app le t o a blue b ack gr ou nd w it h t h e Boot Pan el imag e show n in Figur e 4- 3 .

Figu r e 4 - 3 . The Boot Pan el



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Sy st em St ar t er det erm ines t h e ser v ices it sh ould st ar t by scanning t h e / Sy st em / Libr ar y / St art upI t em tRu henning / Libr arMac y/ StOS art X upI t emher s d irect or ult iesim f oratit t o Ar b emy st art ed wTM) hen; for t he pow sy ster emuser st arst w sh uo p,wan d tthen Pant is t he e em Swsiss Knife( ant o lau tcust hemom . To help r educe b oot t im e, Sy st em St ar t er at t emp t s t o ru n as m any st ar t up it ems as possib ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS le i par allel. m ean st he st ar t up t hat t ake a her lit t le t owcom plet t in g out u p tof het heir net w or X's cor e, This r evealing inn er twasks ork ing s of Pant f orw hile t h ose ho w ante,t osuch g et as t h eset most st op all t he ot hers f r om st ar t ing. Th is par allel pr ocess let s t he b oot p rocess t ak e adv ant age of syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b edualp mell achines. w on youSome r w ay.of t he serv ices st ar t ed are list ed in Table 4 - 2.

Changing the Boot Panel I f you ar e f eeling lik e spicing up y our sy st em a bit , y ou can chan ge t h e im age t hat is used for t he Boot Panel sh own in Figur e 4- 3 . Th e imag e is a sim ple PDF f ile locat ed at / Sy st em / Libr ar y / Cor eSer vices/ Sy st em St ar t er/ Quar t zDisp lay . bund le/ Resour ces/ Boot - Panel. pd f . You can r eplace it w it h an imag e of you r ow n or one f r om ResEx cellen ce' s boot panel libr ar y at w w w .r esex cellence. com / user_ X_boot . sht m l. Befor e r eplacin g t he im age, consider r en am in g t he orig in al as Boot Panel.p df .b ak so you can rest or e t he or igin al if you need t o. I f you h appen t o misnam e t h e Boot Panel.p df f ile, t he sy st em w ill st ill boot , and t he pr ogr ess b ar w ill be dr aw n on a blan k blue scr een. I f you op t t o use or cr eat e you r ow n im age for t h e boot pan el, j ust m ak e sur e y ou size t h e im age t o be 4 72 x 360 p ix els.

Tab le 4 -2 . Som e cor e sy st em st ar t u p it e m s.

St ar t up I t e m Secur ity Ser ver

Manages t he cor e system k ey ch ain, au thenticat ion, an d author ization

Net work

Act iv ates an d conf igur es t he n et wor k in terf aces of the sy stem sets t he m achine's host name



Table of Content s

• I PSer vices Review s • • •

De scr ip t ion

Star ts x in et d, t he I nt er net super - ser ver t hat can serv e as a f r o end for oth er serv ices

Reader Rev iew s Er r ata

m DNSResponder Academic



Star ts th e m ulticast DNS r esponder —a cor e com pon en t of Rendezvous

Ten Things I Dig About Pant her

StarintsPant thher e cr ash • Cr ashRepor Scheduling Tasks t er Running Ma c O S X P ant he r By Jam es Duncan Davidson

LDAP

r epor ter ser vice which cat ches application cr a and kern el pan ics to pr ovide in for mation about t hem Star ts th e LDAP serv ice w hich OpenD ir ect or y r elies on

Syn chr onizes the sy stem clock to Networ k Tim e Pr otocol ( NTP) Decem ber 2 00 3ser ver s

Pub lish er: O'Reilly Net work Time Pub Dat e:

SSH I SBN:

0- 59 6- 005 00 -8

Star ts th e sshd daem on t o pr ov ide secur e r emote login ser vice

Pages: 32 6

Apache

Star ts th e Apache w eb serv er

Print ingSer v ices

Star ts th e CUPS pr inting ser vice daem on , allowing local pr int e be shar ed

Ru nning Mac OS her istst he im at e Sw iss e Arser my vice Knife( TM) ; for pow er user s w h o w ant t o AppleShar e X PantStar th ult e AppleShar cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, inn er ts w ork s of Pant her t fporserv t h ose Postf ix r evealing t he Star th ing e Postf ix sm erw h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Star ts th e cr o n daem on wCr ellon on you r w ay.

As Sy st em St ar t er r uns, it launches as m an y of t he sy st em st ar t u p it em s in par allel as possible w h ic t o sp eed up t he boot p r ocess. Once Sy st em St ar t er is fin ished r unn ing, it han ds cont r ol ov er t o t he loginw indow ap plicat ion , w hich allow s y ou t o log in via t he GUI in t er f ace.

4.2.2.1 The hostconfig file Man y st art u p it em s need som e am oun t of inp ut as t o wh et her t hey should be lau nched or not . For e if Per sonal Web Shar ing is t u rn ed of f on y our m ach in e, t hen t he Apach e st art u p it em shou ld n ot act or der t o con t r ol t hese st art up it em s w it hou t m ov ing t hem ou t of t h eir St ar t up I t em s f older , Mac OS X pr ov ides t he / et c/ host config file—a sim ple f ile consist ing of a set of n ame- v alue pair s ind icat in g w h ic ser v ices shou ld b e r un and w hich on es sh ould not . Th is file is show n in Ex am ple 4- 5.

Exa m pl e 4 - 5 . Th e / et c/ host con f ig fi le

##

# /etc/hostconfig ## # This file is maintained by the system control panels ## •

Table of Content s



Review s

# • Network configuration Reader Rev iew s •

Er r ata

HOSTNAME=-AUTOMATIC• Academic •

Ten Things I Dig About Pant her

ROUTER=-AUTOMATIC• Scheduling Tasks in Pant her Running Ma c O S X P ant he r By Jam es Duncan Davidson

# Services Pub lish er: O'Reilly

AFPSERVER=-YESPub Dat e: Decem ber

2 00 3

I SBN: 0- 59 6- 005 00 -8

AUTHSERVER=-NOPages: 32 6 AUTOMOUNT=-YESCUPS=-YESRu nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o IPFORWARDING=-NOcust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir IPV6=-YESsyst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. MAILSERVER=-NONETINFOSERVER=-AUTOMATICNFSLOCKS=-AUTOMATICNISDOMAIN=-NORPCSERVER=-AUTOMATICTIMESYNC=-YESQTSSERVER=-NOWEBSERVER=-NOSMBSERVER=-NODNSSERVER=-NOCOREDUMPS=-NOVPNSERVER=-NO-

CRASHREPORTER=-YES-

• •

The Future Tableof of Content SystemStarter s Review s

• Past v ersions Reader Rev OS iew sX used Sy st emSt art er t o launch m ost syst em d aem ons. St ar t in g w it h Pant of Mac • how ev er , ApErple r atais m ovin g aw ay f r om Sy st em St ar t er t o u sin g socalled m ach b oot st rap serv ers, a n • w ay of st ar tAcademic ing up daem ons t h at is m uch m ore resour ce ef ficien t an d f ast er as w ell. Th e only p rob l

ist sPant at ther h is point for h ow t o pr operly cr eat e and set up Mach boost r ap • v er y lit t le d ocu Ten ment ThingsatI ion Dig ex About lit t le t hatTasks doesin exist is locat ed on Ap ple's w eb sit e at • ser v ers. Th eScheduling Pant her dev elop erc .Oapple. com Running Ma S X P ant he r/ d ocu ment at ion/ MacOSX/ Con cept ual/ BPSyst em St ar t up/ Concep t s/ Boot Process By Jam es Duncan Davidson

For now , if y ou need t o set up a d aem on y ou shou ld eit her u se St art u p I t em s or y ou should use x in Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

By look in g at t h is file y ou can see t hat man y of t he v ar ious serv er s available on t h e syst em ar en 't t o 0- 59 6- 005 00 -8 st ar t edI SBN: at boot t ime. I f y ou use t he Sy st em Pr ef er ences applicat ion t o enab le a ser v ice and com e b a Pages: 32 t his f ile, you 'll6 see t hat t he -NO- n ex t t o a ser v ice n am e w ill ch ange t o a -YES-.

The Sy st emSt art er d oesn' t u se / et c/ host config t o m ak e it s decisions about w hich ser v ices t o st art ; ind iv idu al ser v ices u se t his inf orm at ion t o d ecide t hat for Ru nning Mac OSt hem X Pant her t heex ult imple, at e Syst Sw iss Knife( fors pow wart h oup w ant selv es.isFor am emAr Stmy ar t er alw TM) ay s ;r un t he er Ap user ach es st it emt o, b ut cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac w hen t he Ap ach e st art u p it em is in vok ed, Ap ach e check s t h e / et c/ host configOS f ile t o X's cor e, r evealing inn er it w ork ing see t he wh et her shou lds rof unPant or nher ot . f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.2.3 Anatomy of a Startup Item So w h at d oes a st ar t up it em look lik e? At a b asic lev el, a st art up it em is a f old er w it h t h e nam e of t h st ar t up it em t hat cont ains t h e follow ing t w o f iles: A p r ogr am; t y pically a shell scr ipt , wh ose nam e m at ches t he n am e of t he st ar t up it em . A conf igur at ion pr oper t y list ( plist ) file nam ed St ar t up Param et ers. plist d eclar ing t he ser vices p by t he it em and it s d ep en dencies. Table 4 - 3 list s t h e key s t hat m ust appear in t he conf igur at io pr oper t y list .

Tab le 4 -3 . St ar t up Par a m et er s.pli st k e y descr i pt i ons

Ke y

De scr ip t ion A shor t descr ipt ion of t he start up it em . Th is str ing will appear i Boot Pan el at star tup.

Descript ion



A list of serv ices pr ov ided by th e st ar tu p it em . A ser vice ty pica only pr ov ides one k ind of ser vice. Sy st em Start er will r un only t f irst star tup item it f inds f or any ser vice pr ov ided. Table of Content s



Review s



Reader Rev st iewar s ted



Academic



Ten Things I Dig About Pant her

Prov ides

A list of the serv ices th at t his serv ice depends on and th at m us bef ore this item can be star ted. Note each item on this m ust con tain t he ser v ice nam e, not the star tup item n am e, of ser vice.

• Requires Er r ata



Uses

Scheduling A Tasks listin of Pantserv her ices

th at t his item uses but that aren't r equired f or item t o be start ed.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

A str ing that lets Sy stem St ar t er det er m in e in which or der to st items that are equal in t he depen dency tr ee. This st ring can be OrPub derPr lish er:ef O'Reilly erence of t he f ollowing: "Fir st ," "Ear ly ," "None," " Lat e," and "Last." Th Pub Dat e: Decem ber 2 00 3 pr ef erence is adv isory and m ight be ignor ed by Sy stem St ar t er . I SBN: 0- 59 6- 005 00 -8

Pages: 32 6

Cr eat ing you r ow n st art u p it em is easy ; m uch easier t han act ually w r it ing a p rog ram t hat pr ovid es ser v ice, alt h ough simp le sh ell scr ipt s t h at d elet e old files ar e usef ul ser vices. Her e's t he st ep- by - st e pr ocess t o creat e y our ow n st ar t up it em . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust , and en/er ally p tupI heir Mac. b ook reader s deep side OSor y is 1 . om Crize, eat et w a eak d irect or ygin Libr ar ry/evStuart t em s f orThis y our st art tak upesit em . The n am einof t heMac d ir ect X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir nam e of t h e it em and should giv e some clue as t o it s fun ct ion . Never cr eat e st ar t u p it em s in syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll be / Sy st em / Libr ar y / St art upI t em s—t h at 's t he dom ain of Mac OS X. w ell on you r w ay. 2 . Cr eat e an ex ecut able in t he direct or y and nam e it t he sam e t hin g as you r st art up it em . Th e ex can be a sh ell scr ip t or a com piled pr ogr am . 3 . Cr eat e t he St ar t up Param et ers. plist f ile in t he dir ect or y . Th is file m ust b e a v alid p r opert y list fi cont ain valu es for t h e Descr ipt ion, Prov ides, Requ ir es, Uses, and Or der Pref er ence k ey s. You ca t his f ile eit h er by using a t ex t ed it or and f ollow ing t he for m at show n in Ex am ple 4- 6, or by usi Pr oper t yList Ed it or ap plicat ion ( / Developer/ Ap plicat ion s/ Ut ilit ies ) .

Exa m pl e 4 - 6 . Th e St ar t upI t e m s.p list f ile f or t he Apa che w e b ser v e r

{ Description

= "Apache web server";

Provides

= ("Web Server");

Requires

= ("DirectoryServices");

Uses

= ("Disks", "NFS");

OrderPreference = "None"; }

Sy st em St ar t er is not ju st r espon sib le for st ar t ing up st ar t up it ems; it can also be used t o r est art or •t hem . Because Table Content of of t his, Sy stsem St ar t er passes in an ar gum ent t o a st art up it em ' s ex ecut able, ind icat i •desired act ion Review . Thes valid st ring s for t his ar gu ment ar e: " st ar t , " " r est art , " or " st op. " A st ar t up it em is •r espon sib le for Reader check Rev iniew g tshis ar gum ent and act ing accor ding ly. Ex am ple 4- 7 sh ows a sam ple st ar t up t his. You can use t h is samp le scr ipt as a t em plat e f or y our ow n st ar t up it em s. •t hat can hand Erle r ata •

Academic



Ten Things I Dig About Pant her

Exa m pl e 4Scheduling - 7 . A sim pinlePant sther a r t up i t em ex e cut abl e • Tasks Running Ma c O S X P ant he r By Jam es Duncan Davidson

#!/bin/sh

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

#

Pages: 32 6 This script

includes the /etc/rc.common file which provides useful

# functions that make the job of creating a startup item easier.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o . /etc/rc.common cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. StartService() { "Starting my service" # insert code to start service here.

}

RestartService() { ConsoleMessage "Restarting my service" # insert code to stop service here.

}

StopService() { • • •

Table of Content s ConsoleMessage "Stopping my service" Review s

# insertReader codeRev toiewstop service here. s



Er r ata

} •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

# This should be the last line of your startup item. It calls the By Jam es Duncan Davidson

# RunService function defined in rc.common which will in turn call Pub lish er: O'Reilly

# the Pub Dat appropriate e: Decem ber 2 00function 3 in this script. I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

RunService "$1"

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS 4.2.3.1 stopping startup items X's cor e,Starting r evealingand t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell can on you ay. st op St ar t u p I t em s at any t im e using t he Sy st em St ar t er com m andline t ool. To u s You st arr t wand t ool, u se t he f ollow ing syn t ax : SystemStarter action service

w her eact ion is eit her start, stop, or restart, an d ser v ice is t he k ind of ser v ice t h e St ar t up I t em pr Ex am ple 4- 8 sh ows how t o m anually st ar t t h e Apache w eb ser v er .

Exa m pl e 4 - 8 . M an ua ll y st ar t i ng t h e Ap ach e w eb se r v er

$sudo SystemStarter start "Web Server" Welcome to Macintosh. Initializing network Starting Apache web server

Processing config directory: /private/etc/httpd/users/*.conf Processing config file: /private/etc/httpd/users/duncan.conf Processing config file: /private/etc/httpd/users/norman.conf [Mon Sep 22 00:49:34 2003] [alert] httpd: Could not determine the server's fully qu •domain name, Table of Content s using 127.0.0.1 for ServerName • Review s

/usr/sbin/apachectl httpd started • Reader Rev iewstart: s •

Er r ata

Startup complete. • Academic •

Ten Things I Dig About Pant her

Hangup •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

er:t O'Reilly ThePub oulish t pu f rom Sy st em St ar t er let s y ou kn ow w hat ' s g oin g on . I n t he case of t he ex am ple her e, t he Pub ing Dat e:t h Decem 2 00v3er ' s fu lly q ualified dom ain n ame cou ld n' t b e foun d is nor m al. To st op t he Ap a indicat at t hber e ser ser v er,I SBN: use 0t he com m -8 and show n in Ex am ple 4- 9. 59 6005 00 Pages: 32 6

Exa m pl e 4 - 9 . M an ua ll y st op pin g t he Apa che w e b ser v e r

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o $sudo "Web cust om SystemStarter ize, t w eak , and gstop en er ally r ev Server" u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Password: syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Welcome to Macintosh. Stopping Apache web server /usr/sbin/apachectl stop: httpd stopped Startup complete. Hangup

4.2.4 Booting into Safe Mode At som e p oin t y ou m ay ex per ien ce a pr oblem w it h a k er nel ext ension cr ashing du r in g sy st em st art u m ay cause a k ern el panic b ef or e st art up is com p let e. To st art y our m achine an d r em ove or repair t h off ending it em , Mac OS X can be b oot ed in t o Safe Mode, b y holding d own t h e Shift k ey as you b oot Mac, w hich w ill load on ly t he ab solut e min im u m nu mb er of ker nel ext ensions and w ill ru n on ly st art inst alled in / Sy st em / Libr ar y / St art upI t em s. Becau se of Saf e Mod e' s r est r ict ions on k er nel ex t ension s and st ar t up it ems, y ou ar e quit e lim it ed in y ou can do. You can' t use a DVD play er, cap t ur e v ideo, use an AirPor t w ireless n et wor k , and m any

t hin gs. Ther ef or e you shou ld r eally use Safe Mode only w h en y ou n eed t o t rou blesh oot a st art u p iss



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.3 Logging In When t he sy st em has b oot ed and st ar t s t h e loginw indow p r ogr am, t he sy st em will eit her d isplay t he user log in scr een, as sh ow n in Figur e 4- 4 , or , if t h e aut o- login pr efer en ce has been set in t h e Accou nt s p ref er ence pan el, t h e syst em w ill log in t o t he user sp ecified t here. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Figu r e 4 - 4 . The Logi n Pan el

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

When y ou log in, t he f ollow ing t h in gs h appen: Your en vir onm ent , in clud ing pr ef erences, en vir onm ent var iables, and k ey chains, ar e loaded. The Sy st emUI Ser v er is launched and han dles t he m enu bar an d menu ext ras ( t hose lit t le app let s u p in t h e upp er - left ar ea of t he scr een) . The p ast eb oard serv er ( pb s) is lau nched. The m ou se, k eyb oard , sound , and display ar e conf igur ed accor ding t o t he y our p ref er ences. Any u ser - defin ed login it ems are p r ocessed. The D ock and Fin der ar e st art ed.

Bypassing the GUI Login Window I f for som e r eason y ou are at t h e login w in dow an d w an t t o by pass it an d get st r aig ht t o t h e comm an d line ( I can't r eally t h ink of a g ood reason t o do t his, b ut it ' s • possible it wTable Content ou ld ofb e usef uls for som et hing y ou m igh t t h in k of) t her e's a quick and • easy way t oReview d o so. s Sim ply ent er > consol e ( in clu de t h e gr eat er - t h an sy m bol) as y our t he login dialog box . The GUI w ill ex it and d um p y ou off at t he black • usern am e inReader Rev iew s - based console. Don' t w or r y, t he GUI w ill com e back af t er you log out • and w hit e t ex Er rtata session. • of y our console Academic • •

Ten Things I Dig About Pant her

The on ly cat ch t o t his t r ick is t hat y ou m u st hav e y our login scr een set t o display on ly Scheduling Tasks in Pant her a u ser nam e an d p assw or d box inst ead of a list of users.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

On ce t he Finder is st ar t ed an d y our login it em s hav e com plet ed , login is fin ished and y ou can Pub lish er: O'Reilly use y our Mac. Aft er a user has logg ed in, t he loginw indow p r ocess has t he follow ing Pub Dat r espon sib e: ilitDecem ies: ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Mon it or s t he Finder and Dock ap plicat ion s and r est ar t s t h em if t hey unex pect ed ly ex it f or som e reason. Display s aler t dialogs f rom hidd en app licat ions. Ru nning Pant is w t he ult im( at e SwFor issce Ar Quit my Knife( ; for- Esc) pow .er user s w h o w ant t o ManMac agesOS t heX For ceher Quit in dow or OpTM) t ioncust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, rages evealing t he inn w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Man t he logou t perrocess. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. I f t he Finder or Dock pr ocesses die for som e r eason , t he loginw indow pr ocess w ill au t om at ically r elau nch t hem. And if, f or som e r eason, t he loginw indow p r ocess it self dies, t he in it pr ocess w ill r est art it so t hat t he login w indow is disp layed and t he sy st em isn 't lef t in an unu sab le st at e.

4.3.1 User Authentication While t h e loginw indow p r ocess m anages t h e login win dow an d t he pr ocess of log ging a u ser in t o t he machin e, it doesn' t act ually per for m t he aut h en t icat ion of t h e user' s credent ials ( usually a passw ord ) . I nst ead it passes off aut h en t icat ion t o Dir ect or y Serv ices. Only if a u ser 's aut h en t icat ion cr ed en t ials are accept ed by Dir ect or y Ser vices w ill t he log in p rocess con t inue. Ot h er w ise, t he login w indow w ill sh ake—r esem bling somebod y shak in g h er head and say ing no—an d will n ot log t he user in t o t he sy st em .

4.3.2 Login Items Aft er t hey log in , users can specif y app licat ions t o laun ch aut omat ically by u sin g t h e Accou nt s pr efer en ce panel. A list of t hese ap plicat ion s can b e fou nd and config ur ed t h rou gh t he St art u p I t ems t ab of t he Accou nt s p ref er ence pan el as show n in Figur e 4- 5 . For ex amp le, in t h e figu re

y ou can see t hat bot h Addr ess Book and Mail ar e set t o st ar t up au t omat ically on login. You can pu t p ret t y m u ch any applicat ion y ou w ant in t o t h is list .

Figu r e 4 - 5 . The Accoun t s p r ef er e n ce pa ne l •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

I f you w ant an applicat ion t o r un bu t n ot show up in y our Dock, click t he Hid e but t on n ex t t o t h e it em. Many sup por t ap plicat ion s, su ch as t he Palm Desk t op Hot Sy nc man ager , w ill ru n hidden using t he fun ct ion alit y pr ovid ed by t his pan el.

4.3.3 Customizing the Login Screen You can cust om ize t he log in w ind ow t h rou gh t he Login Opt ion s t ab of t he User s Sy st em pr efer en ce panel, as show n in Figur e 4- 6 . You can hav e t he list of u ser s display ed as p ict u res or r eq uir e a u ser nam e and p assw or d t o be ent er ed. You can also hide t h e r est ar t and sh ut dow n bu t t ons so ran dom u ser s w on' t b e able t o t ur n off y our com pu t er .

Figu r e 4 - 6 . Login opt ion s



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

This p anel also let s y ou enab le Fast - User Sw it chin g, a new feat u re in Pant her t hat let s you hav e m ult iple u ser s logged in at t h e sam e t im e. Wh en y ou act iv at e t h is, y our user nam e w ill show up in t he u pper r ight - hand corn er of t he screen. You can click y our n ame t o log in as anot her u ser or t o see j ust t he login pan el, as sh own in Figur e 4- 7 . When anot h er user log s in, eit her t h rou gh t he log in w ind ow or Fast - User Sw it ching, t he sam e login pr ocess d escrib ed in t his sect ion occu r s.

Figu r e 4 - 7 . Fa st -U se r Sw i t ch in g me n u



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.4 Monitoring Users You can see w ho' s logged in t o t he machin e r ig ht now u sing t h e w ho com m and, as show n in Ex am ple 4- 10. •

Table of Content s

Exa m pl e 4Review - 1 0 s. Usin g t he w ho com m an d • •

Reader Rev iew s



Er r ata



Academic

$ • who

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

duncan console Dec Running Ma c O S X P ant he r 8 15:39 By Jam es Duncan Davidson

duncan ttyp1 Dec 8 23:31 Pub lishttyp2 er: O'Reilly norman Dec 8 23:37 (localhost) Pub Dat e: Decem ber 2 00 3

duncanI SBN: ttyp3 Dec 8-823:38 0- 59 6005 00 Pages: 32 6

The con sole ent r y is t h e GUI shell t hat y ou ar e logg ed in t o. Th e t t y p ent ries ar e creat ed by act ive Ter m inal w ind ows. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust ize,mt and w eakgiv , and en fer er ally evt put u p tof heir Mac. ook as t akshow es reader s am deep side The wom com es agdif en t rou t his in forThis m atbion, n in Ex plein411.Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Exa m pl e 4 - 1 1 . Usin g t he w comm a n d

$w 11:38PM up 1 day, 8 hrs, 4 users, load averages: 0.28, 0.50, 0.49 USER

TTY FROM

LOGIN@

IDLE WHAT

duncan

co -

Wed03PM 31:59 -

duncan

p1 -

11:31PM

0 -

norman

p2 localhost

11:37PM

0 -

duncan

p3 -

11:38PM

0 -

As w ell as list in g t he user s logged int o t he sy st em , t h e w com m and also giv es t he sy st em u pt im e and load aver ages on t he CPU.

You can see w ho has been log ged in t o t he sy st em ( as w ell as see w h en t he sy st em has b een r eb oot ed) b y using t he com m and- lin e last com m and, as show n in Ex am ple 4- 12.

Exa m pl e 4 - 1 2 . Usin g t he l ast com m an d



Table of Content s



Review s

$last •duncan •

Reader Rev iew s ttyp3

Thu Dec 8 23:38

still logged in

Er r ata

•duncan •

Academic ttyp3

Thu Dec 8 23:38 - 23:38 (00:00)

Ten Things I Dig About Pant her

•norman

Scheduling Tasks in Pant her ttyp2 localhost

Thu Dec 8 23:37

still logged in

duncan ttyp1 By Jam es Duncan Davidson

Dec May 8 15:39

still logged in

duncan

Dec May 8 15:39 - 15:39 (00:00)

Running Ma c O S X P ant he r

ttyp1

Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 duncan console Archetype.local. Dec May 8 15:39

still logged in

I SBN: 0- 59 6- 005 00 -8 Pages: 32 reboot ~6

Dec May 8 15:39

shutdown

Dec May 8 15:37

~

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.5 Logging Out You can log out of y our session usin g any of t he follow in g met h ods:

• • •

Use t he

Log Ou t m enu

Table of Content s Review s

Use t he Shif t -

- Q key st rok e com binat ion w hile using any applicat ion

Reader Rev iew s

•When y ou u se Er reit atah er of t hese m et hod s, t he sy st em w ill d isp lay a dialog box m ak ing su r e t hat •y ou r eally w ant Academic t o qu it . I f you d on't w ant t o see t his d ialog b ox, hold d ow n t he Op t ion k ey w hile •using t he menu Ten it Things Pant her Shif t em orI Dig u seAbout t he Op t ion- Q key com binat ion . •

Scheduling Tasks in Pant her

When y Ma ou clog out , all Running OS X P ant he rpr ogr am s t h at y ou st ar t ed w hile logged in w ill b e quit aut om at ically ( if you hav en' t alr ead y qu it out of t hem ) . How ever , any ap plicat ion can block logout by ask ing t o sav e a By Jam es Duncan Davidson docum ent . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

4.6 Shutting Down the System When y ou shu t d ow n t h e syst em or r eboot , a cont r olled pr ocess occur s so t hat t he syst em is left in a good st at e. This pr ocess is: • • • • • • •

Table of Content s

All r un ning st art up it em s ar e called w it h t he st op par am et er givin g t h em a chan ce t o shut Review s dow n gr acef ully . Reader Rev iew s

Er r atapr ocesses are st op ped. All r un ning Academic

The sy stTen emThings sy ncsI tDig h e About filesy Pant st ems her w it h t h eir in - m em or y cach es. Scheduling Tasks in Pant her

The hand Running Masy c OstSem X P ant he rs

off cont r ol back t o Open Fir mw ar e.

By Jam es Davidson OpDuncan en Firm w ar e eit her

shut s d ow n t he syst em or reboot s depending on t he in st ru ct ion s t hat t he sy st em hand ed t o it as it shut dow n.

Pub lish er: O'Reilly

YouPub canDateit shu Shu t Dow n m enu fr om t h e m en u b ar or e: her Decem bert 2dow 00 3 n t h e sy st em by select ing fr om t he com man d lin e using eit h er t he r eb oot or shut d ow n com m ands. To r eb oot t h e syst em , I SBN: 0- 59 6- 005 00 -8 simp lyPages: en t er32t6he f ollow in g:

$ sudo reboot Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em Youn m ay sy not be :a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e To sh ut.dow t he st em w ell on you r w ay.

$ sudo shutdown now

When y ou r eboot or shut dow n fr om t he com man d lin e, all ru nnin g app licat ions will b e t erm inat ed w it hout being able t o r aise an y dialog box es. This m eans any unsav ed w or k w ill be lost .

4.7 Further Explorations For m ore in for m at ion about t he t opics in t h is ch apt er , see t he Mac OS X Sy st em Ov erv iew b ook. I t 's in st alled on you r syst em as p art of t he Xcode Tools packag e and is locat ed at / Developer/ Docum ent at ion/ M acOSX/ Concep t ual/ Syst em Ov er v iew / Sy st em - Over v iew .p df . •

Table of Content s



Review s

You m ay also w ant t o look at t he f ollowin g m an pages: • •

Reader Rev iew s

nv r am Er r ata

• • •

Academic

bless

Ten Things I Dig About Pant her Scheduling Tasks in Pant her

r c Ma c O S X P ant he r Running By Jam es SyDuncan st em StDavidson ar t er Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 5. Users and Groups Than ks t o it s Unix h er it age, Mac OS X is a m ult iuser oper at ing syst em t h rou gh and t hr oug h. Th is simp le fact m eans t here can be mor e t h an on e user of y our sy st em . You can h ave accoun t s for ever y m em b er of a hou sehold on one m achine, and ev er y one's st u ff w ill r em ain independ en t an d •safe. Ev en bet Table Content t er, ofwit h Panst her m ult iple user s can b e logged in t o t he sam e m achine at t h e sam e •t im e. While only Review ons e user at a t im e can u se t he screen, w it h a q uick click of a m enu y ou can •sw it ch eff ort lessly Reader bet Revw iew s user session s. een •

Er r ata

ious at fir st g lance is t hat t he concept of user s r u ns qu it e deep in Mac OS X. Not •What isn't obv Academic an Things u ser s It rDig eatAbout ed asPant separ •only ar e h umTen herat e ent it ies by t he sy st em , bu t m an y nonh um an user s em as Tasks w ell.inThis eans d if fer en t t ask s can be per for m ed saf ely an d in isolat ion •exist on t h e syst Scheduling Pantm her fr om ot her t asks. User Running Ma c O S X P ant he rs can also be associat ed w it h gr oups, allow ing t he sy st em t o t r eat m an y users t he sam e w ay . By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

5.1 What is a User Anyway? From t he op er at ing sy st em 's point of view , a u ser isn' t n ecessar ily a r eal per son w h o t ap s aw ay at t he k eyb oard . A u ser is sim ply an ent it y t h at can ow n f iles an d ex ecu t e pr ogr am s. A u ser is defin ed in t erm s of an account t hat has a set of pr oper t ies in clud ing a n um er ic user I D, such as 501, an d a usern I n t ers nally t h e syst em uses t he user I D t o keep t rack of t h e files and • Tableame. of Content pr belong t o a user. The user nam e is a m or e hu m an- r ead able f orm t hat is used • ocesses t hat Review s heav ily t hr ough out t he sy st em so t hat you don 't hav e t o t hink in t er ms of num ber s. • Reader Rev iew s •

Er r ata

Each user is also par t of one or m or e gr oup s. A gr ou p is a collect ion of u ser s t hat t h e sy st em can • Academic t r eat as a unit . Lik e a u ser , t he sy st em defines a gr oup in t er m s of a num er ic gr oup I D an d a •m or e readab Ten I Dige. About Pant her le grThings oup nam Associat ing user s w it h g r oups g ives y ou t he abilit y t o cont r ol v ar iou s •r esour ces of Scheduling Tasks in Pant t he sy st em , an d not her j ust on a case b y case basis. For ex amp le, t he sy st em u ses t h e Running Maoup c O St X he r e users t hat can adm inist er t he com pu t er. I f y our user I D is associat ed adm in gr o Pinant dicat w it h tes heDuncan ad minDavidson gr oup , y ou h ave t he ab ilit y t o per for m ad min ist r at iv e t asks on t h e syst em . By Jam To t ake a look at you r user and gr oup I Ds, log in t o t he com m and line and ex ecut e t he id Pub lish er: O'Reilly com man d as sh ow n in Ex am ple 5- 1 Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Exa m pl e 5 - 1 . Usi ng t h e id com m an d

$id Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u pgroups=501(duncan), t heir Mac. This b ook t ak es reader s deep in side Mac OS uid=501(duncan) gid=501(duncan) 80(admin) X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The r esult s of t h is ex am ple t ell us t hat t he cur r en t ly logged- in user is nam ed duncan, h as a u ser I D of 501, an d is a m em b er of t he duncan an d admin g r oups. I f y ou t ake a look at a non adm inist r at ive user , y ou w ill see som et hing lik e t h e out p ut sh ow n in Ex am ple 5- 2.

Exa m pl e 5 - 2 . Usi ng t h e id com m an d for a spe ci fi c user

$id norman uid=502(norman) gid=502(norman) groups=502(norman)

This u ser isn' t p art of t he admin g r oup and t her ef or e w on't be allow ed t o ad minist er t h e com put er . Ty pical users hav e access t o t h eir Hom e f older s and t o t he Sy st em Pr efer ences p anels t hat cust om ize t heir user exp er ience, but t he r est of t h e sy st em w ill be of f lim it s ( at least it w ill be if t h ey don' t k now an ad m in ist r at or ' s usern ame and passw or d) . You' ll not ice in t he ex am ples abov e t hat t he u ser I Ds are 5 01 and 50 2. An d if y ou are t he only

user on you r m achine y ou' ll not ice t hat y our u ser I D is also 501 . This p at t ern is n ot coincident al; it f ollows t he n um berin g schem e t hat Mac OS X u ses t o sep arat e out user s t h at shou ld ap pear in t he log in w ind ow f rom t hose t hat should not . The r ule is t h at u ser s w it h an I D less t han 500 w on' t ap pear. Those w it h an I D gr eat er t han 500 w ill app ear .

5.1.1 Administrative Users •

Table of Content s

Adm inist r at ive u sers s r epr esent a special class of u ser s on t he sy st em . Her e ar e ju st a f ew t hing s • Review t• hat t hey ar eReader allow ed o do Revtiew s t hat user s w it h out ad m in ist r at iv e pr iv ileges ar en't : • • • •

Er r ata Academic I nst all new p r ogr ams in t h e / App licat ions f older . Ten Things I Dig About Pant her Scheduling in yPant her such as st art up it em s t h at t ak e eff ect w hen t he sy st em is Add it em s t o t h e Tasks / Libr ar f older

Running Maed. c O S X P ant he r boot By Jam es Duncan Davidson

Ch ange n et wor k set t ings using t he Net w or k pr eference p anel.

PubCh lishange er: O'Reilly t he syst em

t im e using t h e Dat e & Tim e pr efer en ce panel.

Pub Dat e: Decem ber 2 00 3

Add user or00rem I SBN: 0- 59s6-t o 005 -8 ov e t hem f rom t he sy st em . Pages: 32 6

Set u p or rem ov e pr int ers. Wit hou t ad min ist r at iv e pr ivileges, users ar e p ret t y mu ch r est r ict ed t o t heir Hom e f old er and ar e only ab le t o chan ge t h e set t ing s in Syst em Pr eferences t hat r elat e t o t h eir d esk t op su ch as scr een b ack gr oun ds an d Find er pr ef er ences. The v ar iou s Sy st em Pr efer en ces p anels t hat requ ire Ru nning X Pant her t he ultpadlock im at e Sw Ar myindKnife( TM)t h; at fort hpow er user s wable h o wt oant t o adm inist rMac at or OS access hav e aisclosed onisst hem icat ing e user is not cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS chang e t he set t ing s. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst When emy.ou You f irst m ay instnot all be Maca OS MacX,gut hrue w user hent hat y ou ystou ar cr t teat hisebook dur ing , b ut the once inst you allat'vion e r ead p rocess it , you 'll b e w ellom aut onatyou ically r whas ay. ad min ist r at iv e pr ivileges. How ev er, user s cr eat ed af t er t hat t ime will n ot h ave adm inist r at ive pr iv ileg es unless t he p er son w ho cr eat es t heir accoun t ( an ad min ist r at or ) g ran t s t he user adm in p riv ileg es in t h e Accoun t s pr efer en ce panel. You should consid er you r secur it y needs an d d et er m ine w het her t h e user I D t h at y ou use for you r nor m al w or k on t he m achine should hav e adm inist r at iv e pr ivileges.

5.2 Managing Users Unix t y pically st or es it s user and gr ou p in for m at ion in t he / et c/ passw d an d / et c/ grou p f iles—and if you g o look in g you can find t hese files on y our m achine. How ever , aft er Mac OS X boot s it does n ot use t h ese f iles. I nst ead it uses Open Dir ect or y t o st ore it s user and gr oup inf orm at ion . e sy st t o wor •This allow s t hTable of em Content s k equ ally w ell in hom e set ups w h er e t h er e is on ly one m achine an d in en t er p rise env iron ment s w here t here mig ht b e hu ndr eds of m achines t hat use a cent ral ser ver • Review s for aut hent icat ion. • Reader Rev iew s •

Er r ata



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

While t h er e ar e m any way s t o m anage u ser s on Mac OS X, t h e sim p lest an d most dir ect by f ar is • Academic t o use t he Account s pr eference p anel.

Running Ma c O S X P ant he r

5.2.1 Managing Users with the Accounts Panel By Jam es Duncan Davidson

When y ou op en t h e Accou nt s pr efer ence panel, y ou are pr esent ed w it h a list of user s on t h e er: O'Reilly systPub emlishan d a set of t abb ed pan es t o m odif y user s, as show n in Figur e 5- 1 . Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

5.2.1.1 Creating a user Pages: 32 6

To cr eat e a u ser , click t he plu s ( + ) b ut t on. This cr eat es an un nam ed u ser an d t ak es y ou t o t h e Passw or d t ab. The v ar iou s fields ar e: Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Namem e . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e syst w ell on you r w ay. This is t he fu ll nam e f or t he user . Th is nam e show s up in m ost places w here Mac OS X display s user inf orm at ion such as t he login pan el and any of t h e aler t scr een s t hat pr om pt y ou f or an adm inist r at or passw ord .

Shor t Nam e This is t he Unix- st y le nam e f or t he user and is w hat you 'll t y pically see on t h e com m and line. The d ef ault sh ort nam e r un s y our f ull nam e t oget her w it h no spaces in it and is r ep r esent ed in low ercase let t er s. Unix user nam es of y or e used t o b e lim it ed t o 8 char act er s or less w hile Mac OS X allow s shor t u ser n ames u p t o 25 5 ch aract er s.

Passw or d & Verify This is w h er e y ou set t he p assw or d f or t h e user.

Passw or d Hin t This is w h er e y ou define a hint t hat w ill be d isp lay ed t o t h e user if an in cor r ect passwor d is ent er ed m or e t han t hr ee t im es.

Figu r e 5 - 1 . The Accoun t s p r ef er e n ce pa ne l



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Disabling a User Som e oper at ing sy st ems allow you t o disable a u ser 's accoun t so it can' t be used bu t t he user ' s Hom e dir ect or y r em ains in t act . Mac OS X doesn 't let y ou d isab le a user per se. Howev er, you can alw ay s accomp lish t he sam e t h in g by chang ing t he u ser 's passw ord t o somet hin g t hat on ly you , t he adm inist rat or , will k now . The user w ill be locked out , b ut t he Hom e dir ect ory will st ill b e int act .

The ot her t hr ee t abs of t he Accou nt s p r ef er ence pan el allow you t o fine t une t he set t ings f or a user. They ar e:

Pict u re

This allow s y ou t o associat e a pict ur e w it h a u ser w hich is han dy for t he v ar ious user list s. You can eit her u se on e of t he Ap ple pr ov ided p ict u r es or ch oose one of y our ow n. Also, if y ou h ave an iSigh t cam era con nect ed t o you r comp ut er , t he Add Pict u re dialog b ox w ill let y ou t ake a snapshot , w hich y ou can u se f or t h is pict ur e.

Secu rit y • • • •

Table of Content s

This letReview s y ou sen able FileVault for a user as w ell as allow t h e user t o ad min ist er t h e m achine. Rem em b er , w hen y ou allow som ebody t o becom e an adm in ist r at or , t hat u ser Reader Rev iew s becom es a m em ber of t h e adm in g r oup and can m odif y t he sy st em how ever t h ey see f it . Er r ata



Academic



Ten Things I Dig About Pant her

•Lim it at ions

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

This allow s y ou t o By Jam es Duncan Davidson

p lace lim it at ions on t he user s' abilit y t o u se t he sy st em ov er and ab ove ju st choosing w het her or n ot t h ey can adm inist er t he machin e. For ex am ple, you can r est r ict t h e applicat ions t h at t h ey use or y ou can set t h em u p wit h t h e Simp le Fin der, Pub lish er: O'Reilly w hich is perf ect for kids. Pub Dat e: Decem ber 2 00 3

6- 005ed 00 -8 When yI SBN: ou'v 0e 59 f inish set t ing up t he user , h is or her Hom e f old er is cr eat ed in t h e / User s f older , and t hPages: ey w ill b e able t o log in t o t he sy st em . 32 6

5.2.1.2 Deleting a user Ru OS, Xselect Pant her t he ult Sw fiss Knife( ; fort he pow er user To nning d elet eMac a user t he is n ame of im t heatueser romArtmy he list an TM) d click m inu s butst w onh o ( -w ) .ant Yout oar e cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS pr esent ed w it h a d ialog box ask ing w het her or n ot y ou really w ant t o d elet e t h e user and w hat X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of y ou w an t t o do w it h t h e cont ent s of t h e user' s Hom e f old er . You can eit h er archiv e t h e user ' tsheir syst emt.o You m ay notebe a Mac gu in ru twhe hen y ous/stDelet ar t ted hisUser book b ut once e ly r ead fold er a disk imag ( . dm g) file / User s d, irect or y oryou qu'v ick andit , you 'll b e w ell on you r w ay. per m anent ly erase it , as sh ow n in Figur e 5- 2 . I f you choose t o sav e t h e cont ent s, y ou can br ow se t hr ou gh t hem at any t im e by double- click ing t he .dm g f ile. This m ount s a t em por ar y dr ive fr om w hich you can rest or e a u ser 's dat a. Wh en y ou h ave decid ed t hat y ou no long er need t h e files for t he user , y ou can delet e t he d isk im age fr om t he / User s/ Delet ed User s d irect or y as long as y ou hav e adm in pr ivileges.

Figu r e 5 - 2 . De le t in g a user w i t h t he Accoun t s p r ef er e n ce pa ne l



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o As, not aftererally y ou ed a user ou can op reader t t o delet e t heir cust om ize, t w eak andedg,en r evhav u pe tdelet heir Mac. This, byook t ak es s deep in side Mac OS inf orm ionerfr w om m ed it t ot o a gdisk e. One X's cor e, r evealing t heatinn orkt he ing syst s of em Pantim her f oriatt hely oseorwsav h o ew ant et t himag e most out of t heir optnot ion be f orasyst em or st s is savbook e t he, disk im agyou e and it 'll b e syst em . You m ay Mac guadm ru winist hen ryatou ar t ot his b ut once 'v e t rhen ead bur it , nyou t o CD or DVD for h ist or ical pu r poses. On ce t he d isc h as successf ully bu r ned, w ell on you r w ay. y ou can t hen delet e t he d isk im age t o f ree up d riv e space.

5.2.1.3 Managing users with NetInfo Manager When y ou cr eat e an accoun t u sin g t h e Accou nt s p ref er ence panel, all p r opert ies abou t t h at u ser ar e st or ed in t he local Net I nfo dat ab ase man aged b y Open Dir ect or y . To see t h e con t ent s of t h is dat ab ase, u se Net I nf o Manager ( / App licat ions/ Ut ilit ies) , w h ich pr ov ides a b are- bon es view of t h e Net I n fo dat ab ase an d will allow y ou t o mak e sub st an t ial chang es. You 'll see m ore about Net I n fo Man ager and how user record s ar e st ored in Open Direct or y in Ch apt er 9, Pr ef erences and Default s.

Managing Users from the Command Line Man y har dcor e Un ix user s ar e u sed t o b ein g ab le t o m anag e users fr om t he com man d line usin g t ools lik e userad d, u ser m od, u ser del, grou padd , gr oupm od, gr oupd el, gp assw d, gr p con v, and gr pun con v. Unf ort unat ely , t hese comm and - based • ut ilit ies don'Table of Content t ex ist on Macs OS X. Th e only t ool of t his k in d on Mac OS X is t he passw d • com man d, w Review hich sis used t o chang e a u ser 's p assw or d. •

Reader Rev iew s • While it is possib Er r ata le t o p er f orm som e u ser m anag em ent fr om t h e comm and line

man ipulat ion of t he Net I nf o dat abase using t he niut il com m and • t hr ou gh dir ect Academic Ch apt er 10 ) , sever p ieces of dat a in a user ' s Net I n fo recor d, such as • ( cover ed in Ten Things I Dig About al Pant her id p r opert y ,indPant on' ther hav e com m and- line t ools t o m anag e t hem . For • t he generat edu Scheduling Tasks alm ostMa allc O pu Running S rXposes, P ant he ran d

u nless y ou r eally n eed t o m anag e users fr om t h e com m and line, y ou shou ld u se t he Account s pr ef erence pan el t o m an age users.

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

5.3 Nonhuman Users Ev en if y ou ar e t he on ly hum an user of t he sy st em , t h er e ar e w ell ov er a dozen accou nt s on t h e sy s Most of t hese u ser accoun t s ar e not int ended for u se by y ou or any u ser on t h e sy st em bu t ar e set u use b y var ious ser vices and pr ogr am s on t he sy st em . Th ese n onhu man account s let applicat ions, su eb ser an ds t h e Post fix m ail serv er, r un in a con t r olled env ir onm ent so if t hey ar e br •t he Apache wTable of ver Content by a hack er , t he pot ent ial dam age is lim it ed . Table 5 - 1 list s t h e nonh um an user s t h at ar e d ef ined o • Review s syst em . • Reader Rev iew s •

Er r ata

Man y of t hese nonh um an user s list ed in t he t able, su ch as cyr us an d qt ss, ar en' t used on t he av er ag • per son 's sy stAcademic em but inst ead ar e d ef ined f or u se on Mac OS X Ser v er . Ot her s, su ch as post f ix an d w w •only u sed w hen Ten you Things I Dig her r un t heAbout PostPant f ix m ail ser v er or t he Ap ach e w eb serv er. Un der m ost condit ion s, y •only n ot ice p Scheduling Tasks in Pant her r ocesses ow ned by eit her y our own I D, or by t h e r oot u ser , w hen view p rocesses in t he Running c O Sor X Por antwhe Act ivit y Ma Monit itrh t he ps com m and. By Jam es Duncan Davidson Pub lish er: O'Reilly 5.3.1 The Root User Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 As in all Unix syst em00s,-8 Mac OS X has a special user , n am ed r oot , w hich is not subj ect t o t h e cont r ol per m issions Pages: 32st6 r uct ur e. The r oot user can m odif y any p art of t he filesy st em as w ell as ex ecut e any pr I t can also st op t he ex ecut ion of any r u nning pr og ram on t h e syst em .

The r oot user is a d anger ous on e. One com m and ex ecu t ed as root , su ch as r m - r f / , can im mediat el disable a sy st em; y ou r eally hav e t o t hink ab out w h at y ou ar e doing w it h ev ery com m and y ou issue r oot . Ther efor e, Mac OS X is conf igur ed by def ault t o allow access t o t he r oot user only t hr oug h t he Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o pr ogr am . To use t his p rog r am y ou m ust be an adm inist r at ive user , an d sim ply pr eface t h e comm an cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS w ant t o ent er w it h sudo. Ex am ple 5- 3 sh ows how t o use sudo t o pr int out t he cont en t s of secur e. log, X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir t hat is only v isib le t o t he r oot u ser an d t hat con t ain s t he recor ds of t he var ious act ions of Pant her 's syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e syst em s. w ell on you r w ay.

Tab le 5 -1 . M a c O S X' s non hu m an u se r s

User n am e User I D



r oot

0

The adm inistr ative user

daem on

1

Cor e sy st em daemons

sm m sp

25

Sen dmail u ser

26

Print ing ser v ice

lp

Table of Content s

• postf ix

Review 27s



Reader Rev iew s

• www

70 Er r ata



Academic



De scr ip t ion

eppc

• m ysql

71

The Postf ix SMTP ser ver The Apache web ser ver Apple Ev en ts

Ten Things I Dig About Pant her

Scheduling in PantMy her SQL 74 Tasks The

dat abase ( Mac OS X Ser ver )

Running Ma c O S X P ant he r

sshd

75

The SSH ser ver daemon

qtss

76

The Quick Time Str eam in g Ser ver ( Mac OS X Ser ver )

By Jam es Duncan Davidson

Pub lish er: O'Reilly

cy Pub r usDat e:

77

Decem ber 2 00 3

I SBN: 0- 59 6- 005 00 -8 m ailm an 78

The Cyr us POP an d I MAP serv ers ( Mac OS X Ser ver ) The Mailm an m ailing list m an ager ( Mac OS X Ser ver )

Pages: 32 6

appser v er

79

The JBoss application ser v er ( Mac OS X Serv er )

nobody

-2

A user wit h great ly r estr icted access

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust g en er Exaom m ize, pl e t w 5 eak - 3 ., and Usi ng sually dor ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. $sudo cat /var/log/secure.log Password: ******** Nov 12 04:16:11 localhost com.apple.SecurityServer: Entering service Nov 12 04:36:55 localhost com.apple.SecurityServer: Succeeded authorizing right sys preferences by process /System/Library/CoreServices/Setup Assistant.app for authori created by /System/Library/CoreServices/Setup Assistant.app.

Becau se sudo k eeps an int er nal t im er y ou can execut e m ult iple com m ands w it h out t y ping you r pass each t im e. I t also logs each use so y ou can g o back an d see a list of com m ands t hat wer e execut ed. han dy w hen you h ave m u lt ip le user s w it h adm inist r at ive pr iv ileg es on a syst em . I f you p refer t o live a bit m ore d anger ously, you can get a sh ell as t he r oot user by issuing t he f ollo com man d:

$sudo -s Password: ******** #



Table of Content s

• Review s t o # in dicat in g t hat ev ery com m and t y ped w ill be r un as t h e root user . The p r omp t chan ges •

Reader Rev iew s



Er r ata

• •

Academic Ev en t houg h it t ak es m or e w or k , you can and should av oid op en in g root shells u sin g Ten tThings I Dig About PantBy her doing t h is, y ou ar e less lik ely t o m ake a hor r ific m ist ake and he sudo com m and.



Scheduling hose y Tasks our syinstPant em her . I f y ou do m ak e a mist ak e each com man d will b e logged t o

Running Ma c O S X P r / vant arhe / log/ sy st em . log

allow ing y ou t o f ig ur e out w hat w en t w r ong.

By Jam es Duncan Davidson

Pub lish er: O'Reilly 5.3.1.1 Enabling the root user Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Som e people r eally wan t t o be ab le t o log in t o t h eir sy st em as r oot . For som e r eason hav ing Pages: 32 6 adm inist r at ive pr iv ileg es and t he ab ilit y t o execut e an y comm an d u sin g sudo isn' t enou gh. I f y ou ar of t hese people, y ou can enable t he r oot u ser so t hat you can log in eit her t o t he GUI or t h e comm a and hav e u nfet t er ed an d u nm onit or ed access t o y our sy st em . I d on' t r ecom m end t hat you d o t h is, b y ou in sist here's how : Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o 1 . om Lau ncht wNet o Man ager ( / App ilit ies) . b ook t ak es reader s deep in side Mac OS cust ize, eakI ,nfand g en er ally r ev licat u p tions/ heir Ut Mac. This X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir 2 . em Aut h en tm icat yoube rself using he wSecur y stAut t icat e. .,. bmutenu. syst . You ayenot a Mac gut ru hen yitou ar th en t his book once you 'v e r ead it , you 'll b e w ell on you r w ay. 3 . En able t he root user using t he Secur it y En able Root user m en u. 4 . Giv e t he root user a p assw or d, on e t hat is as secu re as any passw or d y ou w ould give an ad m in of t he sy st em . I f you f ollow t his p rocedur e, y ou will h ave a f ully fun ct ion al r oot u ser . You can log ou t of y our sy st e log in as t he r oot u ser . Rem emb er : you shou ld st ick t o u sin g sudo in st ead of using t he root user. I f you w ant t o en able t he root user fr om t h e comm an d line, y ou can d o so b y execut ing t he follow in com man d:

$sudo password root

Aft er y ou set t he passw or d, t he r oot user w ill b e act ive.

5.3.2 Creating a Nonhuman User I f you n eed t o cr eat e a n onhum an user f or som e r eason ( f or ex amp le, t o r un some ser ver p rog r am

secur ely) , you shou ld n' t cr eat e t hat user accoun t w it h t he Accoun t s pr efer en ce p anel. The r eason f o because non hum an users d on' t n eed a Hom e f old er and t he ot h er folder s a n or mal user get s w hen t accou nt is fir st cr eat ed. I n st ead , y ou shou ld cr eat e t he account by direct ly edit ing t he Net I nf o d at ab For det ails on how t o creat e a non hum an user accou nt , see Ch apt er 11 , Op en Dir ect or y.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 6. Files and Permissions Files ar e cent r al t o Un ix - b ased sy st ems. Com man ds ar e execut ab le files. D ev ices an d disk s ar e ident if ied as f iles. Ev en m ost in t erp rocess and net w or k com m un icat ion occu r s t hr oug h w h at app ear t o be files. Th is Un ix view of t h e w or ld per m eat es t he low est lev els of Mac OS X, even t o •t he point t hatTable of Content m any syst ems p riv ileges an d p er m issions are con t r olled, in par t , t hr ough access t o •files. Access Review t o f iless is org anized ar oun d t he concept s of ow ner sh ip an d perm ission s. •

Reader Rev iew s

•The ch apt er st Er art r atas out by look ing at h ow t o find files, an area in w hich Pant h er 's Fin der sh ow s em ent ov er t he pr eviou s v er sion of Mac OS X ( app rop riat ely enoug h f or an •gr eat im pr ovAcademic " Find er "About ) . You'll •app licat ion nam Ten ed Things I Dig Pantalso her lear n mor e ab out how t o w or k w it h f iles, and h ow t o ify a file's p er m •v iew and mod Scheduling Tasks in issions Pant her and at t r ib ut es. Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

6.1 Finding Files When y ou ar e w or k in g wit h y our sy st em , m ost of t he t im e it ' s not a m at t er of hav ing t he cor r ect per m issions t o access a f ile t hat get s in you r w ay, it 's b ein g ab le t o f ind t he f ile in t h e fir st p lace. The f ir st and easiest w ay t o fin d f iles is b y filenam e using t he sear ch t ex t b ox in ev ery Find er ow nofinContent Figur se 6- 1 . •w indow , as sh Table •

Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

Not e t h at y ou can h ave y our sear ch occur in sev eral places. Th ese ar e:

Local Disk s Scheduling Tasks in Pant her • Running Ma c O S X P ant he r

The Find er will sear ch ever y disk at t ached t o y our m ach in e t o f ind t he filen ame you ar e look in g f or .

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Hom e

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

The Find er will sear ch all t h e files in you r Hom e folder .

Select ion Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o er will h e itr em ent lyMac. select ed.b Th y ou t os deep con st rinain a search cust omThe ize,Find t w eak , andsear g enchertally ev ucu p rr t heir This ookis tallow ak es sreader side Mac OSt o a p ar t icu lar folder . X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 6 - 1 . Usi ng t h e Fi nd er t o sea r ch f or f il es



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ev w her e OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Ruery nning Mac cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS The Find er sear ch es ev ery file it can access, inclu ding t hose on r emot e net w ork dr ives, in X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir or der t o find t he most m at ch es possib le. Th is kin d of search m ay t ak e a lon g t im e t o syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e com plet e, especially if y ou hav e larg e net w or k dr ives m oun t ed t o you r Mac. w ell on you r w ay. I f you n eed t o cond uct m or e const r ain ed searches, use t h e File Find ( - F) in Fin der t o br ing up t h e Fin d w ind ow , show n in Figur e 6- 2 . Th is w ill let you bu ild soph ist icat ed sear ch qu er ies. I n t he Find w ind ow, you h ave t he abilit y t o sear ch b ased on t he f ollow in g t y pes of inf or mat ion :

Nam e Let s y ou sear ch on t h e filenam e of t he file. Your search can b e based on eit her a par t ial or an ex act m at ch.

Con t en t Let s y ou sear ch t he cont ent s of a f ile.

Lab el Let s y ou sear ch by t he lab el t hat you h ave ap plied in t he Find er .

Kin d Let s y ou sear ch for aliases, ap plicat ion s, folder s, docum ent s, aud io files, imag e files, and m ovies.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Figu r e 6 - 2 . Fi nde r 's Fin d w i ndow

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Cr eat or Let s y ou sear ch by creat or cod e, a fou r - let t er ab br ev iat ion used b y som e Mac applicat ions t o associat e files w it h t hem.

Ty pe Let s y ou sear ch by t he t yp e code, anot h er four - let t er abb rev iat ion u sed by som e Mac app licat ions.

Ex t ension Let s y ou sear ch t he par t of t he f ilen ame af t er t he dot , such as t x t , ht m l, or jp g.

Siz e Let s y ou focus you r sear ch t o f iles t h at ar e eit her smaller or lar ger t h an a giv en size.

Dat e Cr eat ed Let s y ou sear ch for f iles cr eat ed bef ore, on , or af t er a par t icular d at e.

Dat e Mod if iedTable of Content s • • •

Review s

Let s y ou sear ch for f iles last m od if ied b ef ore, on , or af t er a p art icular d at e. Reader Rev iew s

•Each sear ch Er cr ritata erion y ou add w ill in t r oduce it s ow n set of pop - up m en us or t ex t ar eas for • defin in g you rAcademic sear ch. •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

6.1.1 Finding by content By Jam es Duncan Davidson

When y ou sear ch by con t en t , t h e Fin der goes an ex t r a st ep bey ond look ing at t he m et adat a of lishIer: O'Reilly t he Pub file. t sear ches inside t h e files by con su lt in g an inv isible index ( a hidd en . FBCI nd ex f ile) in t he Pub folder Dat e: s it Decem is t rber av 2ersing 00 3 . I f an in dex isn 't pr esent in t he fold er , t h e Fin der cr eat es on e aut om at ically, ich00can t ake a f air amou nt of t ime. Th e Fin der can b uild up index es in any of I SBN: 0- 59 wh 6- 005 -8 t he lanPages: guag32 es6 t hat Mac OS X is localized for . How ev er , y ou m ig ht con sid er sp eeding u p t h e index creat ion by on ly en abling creat ion of index es f or t h e langu ages you car e abou t . You can m ak e t his set t ing in t he Finder 's pr ef erences.

6.1.2 with the Ru nningFinding Mac OS Xfiles Pant her is t he ult command-line im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's corye,our evealing he inn er using w ork ing of Pant herline, f or tdon h ose o w ant t o gt he et find t h e ,most t heire When n eed t o ftind files t hes com m and 't w forh get about gr ep ,out an doflocat syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll be com man ds t h at w er e cov er ed in Ch apt er 3. w ell on you r w ay.

6.2 File Ownership File own er ship in Mac OS X is based direct ly on t he u nder lying BSD Unix layer an d in herit s it s st r en gt hs ( as w ell as a f ew quir k s) fr om t hat legacy . On Unix syst em s, a f ile has t w o own er s: a user and a gr oup. Each of t hese ow n er s is separ at e f rom t he ot h er ; t here' s no requ irem ent t hat t he ow ne t he grofoup associat ed w it h t hat file. This split in ow ner sh ip is int en ded t o let y ou be as •of a f ile is in Table Content s flex ible as possible in t he w ay t h at y ou st ru ct ur e access t o f iles. By allow ing gr oup s as w ell as • Review s indiv idual users t o be associat ed w it h a f ile, y ou can g ive u ser s access t o an en t ir e set of f iles sim pl • Reader Rev iew s by ad ding t h em t o a gr oup, and you can t ake aw ay access ju st as easily . •

Er r ata



You can see tAcademic he ow n er and gr oup for a f ile in t h e Fin der using t he File Get I n fo ( - I ) m enu and •un folding t h eTen her sect ion an d t h e Det ails subsect ion , as show n in Figur e 6- 3 . OwThings ner shIipDig & About Per m Pant issions •The I n sp ect orScheduling Tasks in Pant her t ells y ou wh at t h e ow ner , t he u ser s in t he g rou p t hat own s it , an d ev er y body else can Running c Of S X PI ant do w it h Ma t he ile. n the her case of Nor man 's Hom e f older, Norm an can b ot h read and w r it e t o h is Home fold eres( w hich m ak es sense) , and m emb er s of t h e gr oup nor m an can only r ead t he f iles, w hile By Jam Duncan Davidson ever yon e else can only r ead t he f iles. Pub lish er: O'Reilly

Since t he file ow ner sh ip m odel in Mac OS X com es fr om Unix , it follow s t hat t her e is a w ay t o v iew Pub Dat e: Decem ber 2 00 3 t hese per m issions f rom t he com m and lin e. Ex am ple 6- 1 sh ows t he u se of t h e ls com m and t o view I SBN: 0- 59det 6- 005 00 -8 t he own er ship ails for t he cont ent s of t he / User s d irect or y. Pages: 32 6

Exa m pl e 6 - 1 . A f i le li st in g of t he U se r s dir e ct or y $ls -l /Users Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om 0 ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS total X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m4ayroot not be a admin Mac gu ru136 w hen y ou st ar t t his book , b Users ut once you 'v e r ead it , you 'll b e drwxrwx--8 Dec 20:22 Deleted w ell on you r w ay. drwxrwxrwt 5 root wheel 170 8 Dec 17:13 Shared drwxr-xr-x 23 duncan

duncan 782 8 Dec 21:59 duncan

drwxr-xr-x 11 norman

norman 374 8 Dec 22:05 norman

Believ e it or not , t h e line descr ibin g Nor m an' s Hom e folder g iv es y ou t he sam e infor m at ion as did t h file I nspect or ( albeit in a ver y concise f or m t hat is easy en ough t o read once y ou kn ow how ) . Figur e 6- 4 sh ows t he k inds of dat a in each colum n. I t ' s all q uit e self - exp lan at or y ex cept f or t h e fir st set of char act er s, w hich can be br oken dow n as f ollow s:

Figu r e 6 - 3 . Usi ng t h e f ile i nspe ct or t o l ook at pe r m issions



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 6 - 4 . Ou t pu t of ls - l

The f ir st let t er denot es t he f ile t y pe. I n m ost cases t his w ill b e eit h er a dash ( - ) for a file or a d for a d ir ect ory . The n ex t t hr ee let t er s ( char act ers 2- 4) indicat e t h e per mission s associat ed wit h t h e user ow ne of t he file. The n ex t t hr ee let t er s ( char act ers 5- 7) indicat e t h e per mission s associat ed wit h t h e gr oup ow ner of t h e file. • • •

Table of Content s

The lastReview t hr ees let t er s ( char act er s 8 - 10) ind icat e t h e per m issions associat ed w it h ev er y one w h o is neit her t h e file's u ser n or a m em ber of t he g r oup ow ner. Reader Rev iew s



Er r ata



Scheduling Tasks in Pant her

Each of t he t hr ee let t er gr ou pings con sist s of eit her t he let t er s r , w , an d x , or t he dash ( - ) ch aract er • Academic A let t er m eans a perm ission is giv en, an d a dash means t he p er m ission is w it hheld. Table 6 - 1 sh ow •t he meanin gsTen Dig of Things t hese Ilet t erAbout s. Pant her Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

Tab le 6 -1 . File p er m i ssion ch ar a ct er s

Pub Dat e: Decem ber 2 00 3 I SBN:M 0-e 59an 6- 005 Le t t er in00g-8f or a d ir e ct or y

M e an in g f or a f il e

Pages: 32 6

Can r ead t he con tents of t he dir ectory The file can be r ead Can alt er the contents of the dir ector y The file can be Can mak e th e direct or y t he cur rent dir ector y ( t hat wr itten is, use cd ) The file can be The ector y is is t he "stick ( see discu ed Ru nning Mac OSdir X Pant her ult imy"at e Sw iss Ar myssion Knife(on TM)t; he for pow erexecut user s w h o w ant t o cust om ize, stt wicky eak , bit) and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS r w x t, T

X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w you r w ay. Onellceon y ou k now t h e secr et decoder t o t he st r ing, it is pr et t y easy t o r ead t he p er m issions f or a file. Using t h is infor m at ion, you can read t he line descr ibing Nor man 's Hom e d ir ect ory in t h e file list ing i Ex am ple 6- 1 as follow s: The f ile is a d ir ect or y. Nor man h as t he ab ilit y view t h e con t ent s of , and t o read and w r it e files t o, t h e dir ect or y . Mem bers of t he nor m an g r oup can r ead f iles an d cd t o t h em . Ev ery one else can read files and cd t o t h em .

The Execute Bit and the Finder Ob ser van t Unix v et er ans w ill not ice t hat t he Find er d oesn' t off er a w ay t o mod ify a file's execut e p er m issions. Fur t h er m or e, direct or ies cr eat ed in t he Find er will alw ay s hav e execut e p er m issions set . Usually, t his isn' t a pr oblem but if y ou d o w ant t o mod if y t h e execut e p er m issions of a file or a dir ect or y , y ou w ill hav e t o d o so at t he com m and line using chm od.

Fur t her mor e, y ou can see t hat Norm an is t h e only user w ho can access t h e Desk t op, Docum en t s, Libr ar y, an d m ost of t he ot h er d irect or ies in t his Hom e f older. I n f act , t he on ly dir ect or ies t hat any bod y else b ut Nor m an can look int o ar e his Pub lic an d Sit es d irect or ies. Table 6 - 2 g ives an ov er v iew of w hat t he v ariou s let t er s can m ean in com b in at ion.



Table of Content s



Review s



Reader Rev iew s



Er r ata

• •

Tab le 6 -2 . File p er m i ssion sum m a r y

Academic Pat t e r n M e an in g

Ten Things I Dig About Pant her

Scheduling Tasks in Pant her No access Read access only By --x Jam es Duncan ExDavidson ecute access only r-x Read and ex ecute -wx Pub lish er: O'Reilly access rwx Pub Dat e: Decem 00 3 ex ecute Writber e 2and I SBN: 0-access 59 6- 005 00 -8 Pages: 32Fu 6 ll access • ---

Running Ma c O S X P ant he r r--

Re sul t No act iv ity allowed Lets user s r ead the file Lets user s execut e a pr ogram Lets user s r ead and execut e t he f ile Lets user s wr ite t he f ile, but not r ead it; usef ul f or Dr op Boxes Lets user s r ead, wr ite, and execut e t he f ile

These per missions ar e r ef lect ed in t he Finder v iew of Norm an' s dir ect ory t hat anot her u ser w ould hav e show n in Figur e 6- 5 . You can see t h e " Can' t Writ e" icon in t he u pper lef t p art of t he w in dow , Ru Mac see OS tXhat Pant her is tthe im at eenSw Knife( ; foranpow er uuser who w ante tao " Do andnning y ou can t he Desk op,ult Docum t s,iss LibrArarmy y, Mov ies,TM) Mu sic, d Pict res sf older hav cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Not Ent er " sy mb ol on t hem ind icat in g t hat y ou can' t v iew t heir cont ent s. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 6 - 5 . Fi nde r v ie w of N or m a n' s Hom e f olde r

6.2.1 Changing File Ownership I f you n eed t o chan ge t h e ow nership of a f ile, dir ect or y, or even a d ir ect or y t r ee, y ou can d o so easily f rom t he Find er b y using t he I n sp ect or . Sim ply set t h e var ious pulldow n m en us t o ch ange t he set t in gs f or Ow ner , Gr ou p, and Ot hers. To accom plish som e of t h e oper at ions, y ou'll need t o click t h pad lock icon and aut h en t icat e you rself. An adm inist r at ive user can chang e ow ner sh ip f or any ot her user' s f iles. On t h e com m and line y ou' ll need t o use t h e chow n an d chm od com m ands. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic Special Directories (dot and dot-dot)



Ten Things I Dig About Pant her

• I n t he out put Scheduling fr om ls Tasks - la, t hinerPant e arher e t w o sp ecial d ir ect or ies, one nam ed dot ( . ) an d t he Running O S X( P ant r ot her dMa otc- dot . .) . he These

are sp ecial d ir ect ories t h at serv e as u sef ul shor t cut s. Th e dot t o t h e cu r rent dir ect or y . For exam ple, t h e pat h ./foo.txt r efer s t o t he foo. t x t f ile in t he cur r en t d ir ect ory . Th e dot - d ot d ir ect ory alw ay s r efer s t o t he parPub ent of t he cur r en t d irect or y. The pat h ../bar.txt r efer s t o t he bar . t x t f ile in t he lish er: O'Reilly par ent of t he cur r en t d irect or y.

ect y alw ay s r ef ers Bydir Jam esor Duncan Davidson

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

6.2.1.1 chown The chow n t ool, sh or t f or " chang e ow nership " , chang es t he ow ner of a file. I t s basic syn t ax is: Ru chown nning owner Mac OSfile X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. w her eow ner is t he user nam e or user I D of t he new ow n er for t h e specif ied file. For ex amp le, t o chang e t he ow n er of t he f ile I m p ort an t Docum en t . doc t o nor m an, y ou w ould use t he f ollowin g com man d: $ sudo chown norman ImportantDocument.doc

You hav e t o issue t h is comm and w it h sudo b ecau se y ou need t o aut h en t icat e you rself as an adm inist r at or t o t he sy st em t o m ak e t his chan ge. Aft er all, y ou m ay not w ant a user t o p ut files un der t he ow n er ship of som ebod y else w it hou t ov ersigh t . You can also chan ge b ot h t he user and gr ou p set t ings for a file by using t he f ollow ing sy nt ax : chown owner:group file

w her e t he ow ner an d gr oup ar g um en t s ar e sep arat ed by a colon. For exam p le, t o giv e ever yon e in t he gr oup aud it or access t o t h e docum ent , y ou w ould use t he f ollowin g com m and: Archetype:/Users/shared/Documents $ sudo chown norman:auditor ImportantDocument.d

6.2.1.2 chmod The chm od t ool, sh or t f or " chang e file m odes," chang es t he per m issions on a file. I t s basic syn t ax is: •

Table of Content s chmod access-string file



Review s



Reader Rev iew s



Er r ata



Academic

•w her e t he accessTen Things I Dig hermissions y ou wan t t o set for t he g iv en file. Th e access st rin g st r ing st atAbout es t hPant e per •has t hr ee parScheduling Tasks in Pant her t s t o it : a let t er ( u, g, w , a) , an oper at ion cod e ( + , - , = ) , and a p er m ission ( r , w , x ) . Running SX P Table 6 -Ma 3 cg O ives aant suhe mrmar y

of w hat t hese codes st and for .

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Tab le 6 -3 . Com m on ly -u sed ch mod code sum m a r y

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

St r in g Pa r t Cod e De scr ip t ion Who

u User g Gr oup o Ot her Ru nning Mac OS Xa Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o All ( defau lt) cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, evealing+ t he innAdd er w ork s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Oper at rion pering mission syst em . You m ay -not be aRemov Mac gu ru w hen yission ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e e perm w ell on you r w ay.= Assign perm ission ( and r em ov e per mission of oth er fields)

Per m ission

r w x t

Read Writ e Ex ecute ( f ile) or sear ch ( dir ectory ) Stick y bit

For exam ple, t o giv e ev er yb ody w r it e access for a f ile t hat y ou ow n: $ chmod a+w ImportantDocument.doc

To enab le ex ecut ion of a f ile f or ever y one in t he g rou p t hat own s t he file: $ chmod g+x generatereport

To r em ove t he abilit y t o execut e a file f rom all user s:

$ chmod -x generatereport

To r em ove t he abilit y t o r ead a file fr om ev er y one b ut you rself: $ chmod go-r ImportantDocument.doc •

Table of Content s



Review s



Reader Rev iew s



Er r ata

You can r ecu Academic r siv ely ch ange t h e per missions of a gr oup of files by u sing t h e - R op t ion. For ex amp le, • y• ou w an t ed tTen o allow ever ybAbout ody tPant o see Things I Dig herall t he docum ent s in y our D ocu m en t s fold er , y ou w ould use t• he follow in gScheduling com m andTasks : in Pant her Running Ma c O S X P ant he r

$ chmod -R +r Documents

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

You can also0- 59 u se com I SBN: 6- 005 00 m -8 as t o set mor e t han one per m ission at a t ime. For ex amp le: Pages: 32 6 $ chmod a-wx,a+r ImportantDocument.doc

Ru Mac, OS Pantspecif her isy tthe im atof e Sw iss in Aranot my Knife( TM)ever ; for, pow sw w ant Alt nning ern at ively youXcan he ult m ode a f ile h er ; how t his er is user a m or e harocan e syt ont ax cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac t hat y ou will see qu it e oft en. To un derst an d t his syn t ax, you h ave t o t hin k in t er m s of bit s anOS d oct al X's cor e,. rAevealing t he ing s of Pant hert hf or w h o w ant t oespondin g et t h e most outt hr of ee t heir not at ion t yp ical m odinn e inert hwisork syn t ax cont ains r eet hdose igit s—each corr g t o t he lev els syst emm. ission You m( ay not gu)ru w hend igit y ouisstcalculat ar t t his ed book b ut once 'v e ring eadoct it ,alyou 'll b e of per user , gbe rouap,Mac ot h er . Each b y, addin g t heyou f ollow v alues: w ell on you r w ay. 4 Read 2 Wr it e 1 Execut e 0 No perm ission s Som e comm on nu mb er com b in at ions f or set t in g perm ission s are sh ow n in Table 6 - 4. For ex amp le, y ou w an t ed t o gr ant r ead and w r it e per m issions f or a u ser an d on ly r ead per m issions f or gr oup and ot her s: $ chmod 644 ImportantDocument.doc

Here, 6 44 indicat es t hat t he u ser w h o cr eat ed t he f ile has r ead- w r it e pr ivileges ( add 4 + 2 = 6) , an d t he gr oup and ot her s only g et r ead - only access, as ind icat ed by t h e 4s. To g r ant all perm ission s t o t he user and deny all per mission s t o t he gr ou p an d ot hers: $ chmod 700 ImportantDocument.doc

Tab le 6 -4 . Com m on ly u se d chm od nu m er i c se que nces • Nu m be r Table Re sul of Content t s •

Review s



Reader Rev iew s

De scr ip t ion

File can be r ead, wr it ten, or ex ecuted by anybody File can be r ead and ex ecuted by an ybody, but only • Er r ata 777 r wxr wx r wx wr itten to by owner or gr ou p • Academic r wxr wx rI -x FilePant can • 775 Ten Things Dig About herbe r ead and ex ecuted by an ybody, but only r wxr - xr -x itten • 755 Scheduling Tasks inwr Pant her to by owner Running 666 Ma c O Sr XwP ant r wherr w File can be r ead and writ ten by an ybody, but not execu ted 664 w- r w- r - File can be r ead by any body , wr itt en t o by owner or gr oup By Jam es Duncanr Davidson 644 r w- r - - r- and can 't be execu ted 444 r--r- -r-File can be r ead by any body , wr itt en t o by owner , and Pub lish er: O'Reilly can't be ex ecut ed Pub Dat e: Decem ber 2 00 3 File is r ead on ly I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

6.2.2 The Sticky Bit The st ick Mac y bit OS h asXan odd y. ult A long agoAritmy m eant ex;ecut fileuser shou ldhboewkept Ru nning Pant herhist is or t he im at et im Swe iss Knife(an TM) for able pow er sw ant tin o m em or y ev en af t er t he pr ocess usin g it had exit ed. Most Unix im plement at ions, including Mac cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OSOS X don cor 't use f or t h is tpur ym ing or e,s of butPant somew o anot er job X's e, ritevealing he pose inn er an w ork her fher or et halong ose w ht he o wway ant it t o got g et coer t h e ced mostintout of thheir When t he st ick y bit is set on a dir ect or y , users can on ly delet e f iles in t he dir ect or y t hat belongs syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e t o twhem , evyou en rifwt hey ell on ay. hav e access r igh t s t o t he dir ect ory b ecause of a gr oup m em b er ship. The st ick y bit is set usin g t he user par t of t he p er m ission st rin g an d ap pear s at t h e end of t he list of per m issions in a f ile list ing . For exam ple, t o t ur n on t he st icky b it on a d irect or y, you w ould execut e $ chmod u+t /Financials

and it sh ows up in a dir ect or y list ing lik e t h is: drwxr-xr-t

2 duncan

admin

68

8 Sep 01:10 Finance

A d irect or y on t he sy st em t hat h as t he st ick y bit set is / pr ivat e/ t m p, as sh own in Ex am ple 6- 2.

Exa m pl e 6 - 2 . Th e / pr iv a t e di r ect or y sh ow i ng t h e st ick y b it on / pr iv at e / tm p $ls -la /private total 0

drwxr-xr-x drwxrwxr-t

5 root wheel

170 30 Nov 17:39 .

34 root admin 1156 30 Nov 17:40 ..

drwxr-xr-x 102 root wheel 3468 28 Nov 23:11 etc drwxrwxrwt

7 root wheel

•drwxr-xr-x Table Content s 21 of root wheel • Review s •

238

4 Dec 21:06 tmp

714 30 Nov 17:41 var

Reader Rev iew s

y t hat has t he st icky b it set is t h e / User s/ Sh ared dir ect or y , as show n in Ex am ple 6•Anot h er dir ect Eror r ata •3. Academic •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Exa m pl eO6S -X3P.antTh Running Ma c he re / User s di r ect or y sh ow ing t h e st ick y bit on / User s/ Sh Davidson ar e d By Jam es Duncan $lsPub -la /Users lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

total 0

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 5 drwxrwxr-t

root

admin

170 12 Nov 04:38 .

drwxrwxr-t 34 root

admin

1156 30 Nov 17:40 ..

-rw-r--r-- 1 root wheel 0 12 Sep 20:20 .localized Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o drwxrwxrwt 5 root 12 Mac. Nov 21:39 Shared cust om ize, t w eak , and g enwheel er ally r ev u170 p t heir This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir drwxr-xr-x 29ayduncan duncan syst em . You m not be a duncan Mac gu ru w986 hen 30 y ouNov st ar 18:05 t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

6.3 Type and Creator Codes I n addit ion t o h avin g an ow ner an d a set of per missions, ever y file also has a set of HFS+ at t r ibut es assocat ed w it h it . The most int erest ing of t hese at t r ibut es ar e t h e Ty pe an d Cr eat or codes. •

Table of Content s



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

A Ty pe cod e is a f our char act er st r in g t hat can be assigned t o a file w h en it is cr eat ed an d is u sed • Review s by t he f ilesyst em t o denot e w h at t y pe of f ile it is. Ty pe codes ar e exact ly f our char act ers in • Reader Rev iew s lengt h and ar e case sensit iv e. Table 6 - 5 list s som e comm on t y pe codes. I n t his t able, an open • Er r ata squar e ( ) means t hat a space is used wh er e t h e char act er sh ould be ( r emem ber , Ty pe codes • hav e t o be exAcademic act ly f our ch aract er s) .

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Tab le 6 -5 . Com m on Ty pe code s Pub lish er: O'Reilly Pub Ex Dat e: ber 2 00 3 File t eDecem nsion

Typ e Code

Typ e of Fi le

I SBN: 0- 59 6- 005 00 -8

. pdf Pages: 32 6 PDF Por table Docu ment File .doc W8BN Microsof t Wor d docum ent .xls XLS8 Microsof t Ex cel docum en t . psd 8BPS Adobe Ph ot osh op docum en t . dm g devi Disk image .mov QuArickTim em ov; ie Ru nning Mac OS X Pant herMooV is t he ult im at e Sw iss my Knife( TM) for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es . jpeg, . jpg JPEG JPEG im age file reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. A Creat or cod e is sim ilar t o a Ty pe code, ex cept t hat it d en ot es t he ap plicat ion s t hat w as used t o creat e t he f ile. Lik e Ty pe codes, t h ey ar e also ex act ly four ch aract er s in leng t h and are case sen sit iv e. Table 6 - 6 list s som e comm on creat or cod es.

Tab le 6 -6 . Com m on Cr ea t or codes Cr ea t or Code

Ap pli ca t ion

pr vw MSWD XCEL 8BI M

Prev iew Microsof t Wor d Microsof t Ex cel Adobe Ph ot osh op

To look at a file' s Ty pe an d Creat or cod es, y ou can u se t he Get FileI nf o com m and- lin e t ool t h at is inst alled int o / Developer/ Tools as par t of t h e Xcode Tools pack age. Ex am ple 6- 4 sh ows t he u se of Get FileI nf o an d t he r esu lt in g out pu t .

Exa m pl e 6 - 4 . Usi ng Ge t Fi le I nf o t o look a t t h e at t r ibu t e s of a f il e.

$GetFileInfo Artwork.psd file: "Artwork.psd" type: "8BPS" creator: "8BIM" •

Table of Content s

attributes: avbstClinmed • Review s •

Reader Rev iew s

created: 12/06/2003 20:51:13 • Er r ata •

Academic

modified: 12/06/2003 20:51:13 • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

I n look ing at t he r esu lt s for t he com m and, y ou can see t hat t he file Ty pe is 8BPS, w hich m ean s By Jamites Davidson t hat s Duncan a Phot oshop docum ent , and t he cr eat or cod e is 8BIM, w hich m ean s t hat it w as cr eat ed by Adob e Phot oshop . Pub lish er: O'Reilly

Ty pe Creat orbercodes Puband Dat e: Decem 2 00 3 ar e u sed by t h e Fin der t o d et er m ine t h e t y pe of a d ocum en t an d t h e app licat ion t hat should I SBN: 0- 59 6- 005 00 -8 be u sed t o op en it . You can see t h is infor m at ion in t he Finder by usin g t he File Get I n fo menu ( - I ) . Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

6.4 Further Explorations To g et deeper int o t he sub ject s in t his chapt er , y ou sh ould ref er t o t h e follow ing book s:

• • •

Mac OS X Pant her in a Nut shell, b y Chu ck Topor ek , et al. ( O' Reilly & Associat es, I nc. , 20 04) Table of Content s

Review Lear ning Unixs f or Mac OS X Pan t her , b y Dav e Tay lor , et al. ( O' Reilly & Associat es, I nc. , 20 04) Reader Rev iew s



Er r ata

• You m ay alsoAcademic w ant t o check out t he f ollow in g m anp ages: • •

Ten Things I Dig About Pant her

ls

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan chow n Davidson

odO'Reilly Pubchm lish er: Pub Dat e: Decem ber 2 00 3

st ick y

I SBN: 0- 59 6- 005 00 -8

Pages: 32nf 6 o Get FileI

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 7. Monitoring the System The Mac, as w ell cr af t ed as it is, hides a lot of comp lex it y un der t he hood. Th is is unav oidab le giv en w h at it does. Much t o App le' s cr ed it , t he Mac w ork s a lot sm oot her t h an m ost com pu t er s, bu t it ' s st ill a com plex beast un dern eat h t he Aqu a int er face. I n a lot of w ay s, t he Mac is similar •t o a sm oot h Table of Content s ru nning car . Ther e' s a set of well laid out con t r ols, in clud ing a st eer ing w heel, •accelerat or, and Review brsake, b ut und er neat h t he hood, it ' s a bit m or e com plicat ed t han t h at . Ther e' s •syst em af t er Reader iew sw or k t oget her t o m ake it all hap pen. sy st emRev t hat •

Er r ata

sh ow s y ou h ow t o get u nder t h e hood and fin d ou t w h at k ind of har dw ar e, su ch as •This chap t er Academic d t h Ie Dig k inAbout d of har d r iv es, is in y our Mac. I t also show s y ou how t o v iew t he •how mu ch RAM Ten an Things Pantdher is inst alled an in dh owher t o w at ch t h e soft w ar e r unn ing. •soft w ar e t h atScheduling Tasks Pant Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.1 About This Mac The f ir st place t o go t o get in for m at ion ab out you r syst em is t h e Abou t Th is Mac m en u, w hich br in gs u p t he pan el sh ow n in Figur e 7- 1 . Th is sim ple p anel show s y ou t he k ind of pr ocessor ( or p r ocessor s) an d t he am oun t of m emor y y ou hav e inst alled in you r Mac. You can t h e ex act b uild •even find ou tTable of Content s of Pant her y ou are ru nnin g. Click t he Ver sion st r ing in t he pan el, and it will chan ge t o t he b uild num ber , such as 7C1 07. Click again, an d y ou' ll get t he serial • Review s nu mb er of you r syst em —a v aluable p iece of inf orm at ion w hen you ar e on hold w it h Ap pleCar e. • Reader Rev iew s But t he in for m at ion h er e is on ly t he sur f ace d et ails. Click t h e Mor e I nfo bu t t on and Syst em • Er r ata Pr ofiler w ill launch. • Academic •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.2 System Profiler The Sy st em Pr ofiler ( / App licat ions/ Ut ilit ies) , f or mer ly k now n as t he Ap ple Sy st em Pr of iler , giv es y ou a gr eat d eal of in sig ht in t o t h e k in d of har dw ar e t hat is inst alled and connect ed t o y our syst em an d t h e soft w ar e it ' s ru nnin g. I t gives f ast answ ers t o t h e quest ions: " How m uch m em ory " What ver sion •do I hav e?" or Table of Content s of Saf ari do I hav e inst alled ?" . I n f act , it does su ch a t hor oug h j ob t• hat a Sy st em Pr ofiler r ep ort is oft en t he fir st t hin g Ap ple's sup por t f olks will ask y ou for w h en Review s y ou h ave a pr ob lem or repor t a bu g. Figur e 7- 2 sh ows wh at Sy st em Pr ofiler looks lik e w hen you • Reader Rev iew s fir st lau nch it . •

Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Figu r e 7 - 1 . The About Thi s M ac pa ne l

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

The colum n on t he left side is div ided in t o f our p rin cipal par t s:

Har dw ar e Giv es a det ailed list ing of t he h ar dw are in an d conn ect ed t o y our sy st em including m em or y , PCI and AGP car ds, ATA and SCSI dev ices ( such as har d dr iv es) , USB an d FireWir e connect ed d ev ices, Air Port car d, and m odem . Each it em display s all t he inf orm at ion k now n t o t h e syst em abou t t h e dev ice such as m odel nu m bers and fir m war e r ev isions.

Running Software Update Ther e ar e t hr ee w ays t o r un Sof t w are Upd at e on you r Mac:



By click Table ing on of Content t he Sof s t w are Up dat e bu t t on in t he Abou t Th is Mac w indow

• • • •

Review s

By using t h e Rev Soft w sar e Updat e pr ef erence pan el Reader iew Er r ata

From t he com m and lin e, using t he soft w ar e_up dat e com m and Academic

• You can alsoTen Things I Dig conf igur e SofAbout t w arePant Upher dat e t o aut om at ically ch eck f or and dow nload • up dat es fr om Scheduling Tasks in Pant her t he Sof t w are Upd at e pr efer en ce panel. Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

Figu r e 7 - 2 . The Syst e m Pr ofi le r m a in w in dow

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Soft war e Pr ovid es a det ailed list of t h e applicat ions in t he / App licat ions f older as w ell as t h e fr am ew ork s an d k ern el ex t ensions on y our sy st em . Each it em includ es t he nam e of t h e soft w ar e com ponent , it s v er sion n um ber , and t he dat e on w hich it w as last m odif ied.

Net w ork Giv es a com plet e list of all t he n et wor k conn ect ions on y our mach in e and t he con figu rat ion inf orm at ion, su ch as I P addr ess, su bnet mask , r out er add r ess, and Et h er n et addr ess for each conn ect ion. •

Table of Content s



Review s



Reader Rev iew s

• Logs

Er r ata



Academic

Giv es access t o tIhDig e console and Ten Things About Pant hersy st em logs f or t he sy st em. The console giv es in for m at ion abou t ev en t s t hat ar e inoccu ing f or t he cur r ent ly logg ed - in u ser . The sy st em log p rov ides • Scheduling Tasks Pantrrher infMa orm abou Running c Oat S Xion P ant he r t ev en t s at t he syst em level. •

By Jam es Duncan Davidson

The am ou nt of in for m at ion t hat t he Sy st em Prof iler g ives y ou access t o can be ov erw h elm ing. Than kf ully, t he in t er f ace d oes a m uch bet t er job t h an it s pr ed ecessor d id in pr eviou s v er sions of lishXer:by O'Reilly MacPub OS let t ing you d rill d own t o t he in for m at ion y ou w ant t o see. Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

7.2.1 Creating a System Profile Report Pages: 32 6

Occasion ally y ou m ay be ask ed b y Apple or som e ot h er sof t w ar e com p any t o send a repor t fr om Sy st em Pr of iler so t hey can see t he d et ails of y our sy st em and t r oubleshoot a pr ob lem f or y ou. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e wRefreshing ell on you r w ay.the System Profiler View A f r eq uent " pr oblem" t hat people h ave w it h Sy st em Prof iler is w h en t h ey conn ect or disconnect a USB or Fir eWir e device an d d on't see a chang e in t he Sy st em Prof iler w indow . This is because Syst em Pr of iler doesn' t cont in uously poll t he syst em t o det ect chang es as t hey hap pen. Once it h as collect ed t h e dat a, it s job is t o disp lay it . I f you h ave a Syst em Pr of iler w indow open and m ake chan ges t o you r har dw ar e conf ig ur at ion t hat you w ant t o see, use t he View Refr esh ( - R) m en u.

Ther e ar e a v ar iet y of way s t o gener at e t his in for m at ion: Sav e an XML docum en t cont ain ing all t he in for m at ion in a f or m at t h at can be opened lat er w it h t he Sy st em Prof iler applicat ion. To do t his, use t he sam e File Sav e ( - S) com m and t hat y ou wou ld in any ot her applicat ion. Th is is Apple's pr ef err ed for m at f or r eceiving syst em p rof iles. Ex por t t he d at a t o a p lain t ex t or r ich t ex t file ( RTF) usin g t he File

Ex por t menu .

Pr int t he f ile, b ut in st ead of sen ding it t o y our p rint er , sav e it as a PDF f ile using File Sav e as PDF.

Pr int

To v ar y t h e det ail lev el of t h e infor m at ion in t h e r ep ort ( as w ell as t h e size of t he f iles gener at ed) , y ou can choose t h e lev el of det ail y ou w ant t o display u sing t h e View m en u an d t hen save, ex por t , or p r in t t h e r ep ort . When send ing pr oblem r ep ort s t o Ap ple, it is b est t o er r on t he side of sen ding t oo mu ch inf or mat ion r at her t h an t oo lit t le, how ever , y ou mig ht wan t t o be caref ul if y ou are act u ally p r in t ing out t he r epor t s—a f ull, ext en ded r epor t can r un upw ar ds of 75 pag es.



Table of Content s 7.2.1.1 System Profiler on the command line •

Review s



Reader Rev iew s



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

The syst em _pr of iler com m and- lin e t ool allow s y ou t o get t he sam e infor m at ion fr om t h e • Er r ata com man d line t hat Syst em Pr ofiler giv es access t o. Wh en r un w it h no ar gu m en t s, • Academic syst em _pr of iler g en er at es a f ull r epor t , t h e beginn ing of w hich is show n in Ex am ple 7- 1.

Running Ma c O S X P ant he r

Exa m pl e 7 - 1 . Th e st ar t of ou t pu t fr om sy st em _ pr of ile r By Jam es Duncan Davidson

Pub lish er: O'Reilly

$system_profiler Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Hardware: Pages:

32 6

Hardware Overview: Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, rMachine evealing tModel: he inn eriMac w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w Type: ay. CPU PowerPC G4 (3.3) Number Of CPUs: 1 CPU Speed: 1 GHz L2 Cache (per CPU): 256 KB Memory: 768 MB Bus Speed: 133 MHz Boot ROM Version: 4.59f1 Serial Number: W831520KNHX ...

Submitting Bug Reports to Apple On e of t he m ost v aluab le t hings you can do w h en som et h ing goes w r ong w it h Mac OS X—and is a h eck of a lot m or e pr odu ct iv e t h an j ust com plaining t o y our fr iends—is t o file a bug w it h Apple. The easiest w ay t o send f eedb ack is t o use t h e • for m on Ap ple' Table ofeb Content s w w w .ap ple. com / m acosx / feedback / . Even bet t er is t o use sw sit e at • t he Apple Dev Review elopser Connect ion' s bu g r epor t sit e at bu grepor t . app le. com / . You 'll • hav e t o hav Reader Rev iew s ber sh ip ( f r ee for t h e low est t ier ) t o use t h is for m , bu t in e an ADC mem • r et ur n y ou' llErbe r ataable t o t rack t h e pr ogr ess of you r issue aft er y ou su bm it it . •

Academic



Ten Things I Dig About Pant her

•The f ull r eporScheduling in Pant herou t pu t s is v er y long ind eed. You m igh t w ant t o sav e it as a t t hat systTasks em _pr of iler Running Ma c O S X can P ant he r file so t hat you view

it usin g a t ex t edit or , or so t hat you can send it in t o Apple or anot her By Jam soft w es ar eDuncan v en dor Davidson as par t of a bug r epor t . To do t h is, use t he f ollowin g com m and: Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

$ system_profiler > ~/Desktop/MySystemProfile.txt

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

You could t ake t his t ip a st ep f or w ard and ad d it t o y our cron t ab ( see Ru nning Mac OSChXapt Pant is t he ultgim at e s) Swso isst hat Ar my TM) ; for powuper tuser s ew h o w ant t o er her 8, Schedulin Task youKnife( alw ay s hav e an o- dat cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep inv ent or y of y our syst em . Sy st em adm in ist r at or s can use t his t ip in t o side k eepMac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir t r ack of m ach in es acr oss t heir n et w or k s. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. To lim it t he am ount of inf orm at ion t hat syst em _pr of iler g en er at es, y ou can pass a dat a t yp e as an ar gum ent . You can get t h e list of dat a t y pes for you r sy st em by u sin g t he - list Dat aTy pes ar gum ent as show n in Ex am ple 7- 2.

Exa m pl e 7 - 2 . List i ng t h e dat a t y pes t ha t sy st em _ pr of il er can g iv e dat a a bout $ system_profiler -listDataTypes Available Datatypes: SPHardwareDataType SPSoftwareDataType SPNetworkDataType SPMemoryDataType SPPCIDataType

SPIDEDataType SPSCSIDataType SPApplicationsDataType SPUSBDataType •SPFireWireDataType Table of Content s •

Review s

SPAirPortDataType • Reader Rev iew s •

Er r ata

SPFrameworksDataType • Academic •

Ten Things I Dig About Pant her

SPModemDataType • Scheduling Tasks in Pant her Running Ma c O S X P ant he r

SPExtensionsDataType By Jam es Duncan Davidson

SPLogsDataType Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ar m ed w it h t his inf or mat ion , if you w ant ed t o see t h e st at us of t h e net w or k con nect ion s of y our Mac, y ou cou ld u se t he SPNet w ork Dat aTy pe ar g um en t as sh own in Ex am ple 7- 3.

Exa m plMac e 7OS - 3 .X Usi m_ preof er Ar t omyg Knife( et neTM) t w; or conerne ctsion ta to Ru nning Pantng her sy is tst heeult im at Swiliss fork pow user w h oda w ant cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e $ system_profiler SPNetworkDataType w ell on you r w ay. Network:

Built-in Ethernet:

Interface: en0 Type: Ethernet Ethernet Address: 00:0a:95:99:e4:92

AirPort: Interface: en1 Type: AirPort IP Address: ("192.168.1.102")

Subnet Mask: ("255.255.255.0") Broadcast Address: ("192.168.1.255") Router Address: 192.168.1.1 DNS Servers: ("66.93.174.29", "66.93.87.2", "216.231.41.2") • • • •

Table of Content s

Domain: x180.net Review s Reader Rev iew s

Ethernet Er r ata Address: 00:03:93:ef:ba:a5



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.3 Monitoring System Activity On ce y ou k now w hat is inst alled on y our sy st em , y ou need t o be ab le t o f ind out in for m at ion about t he sy st em is r unn in g. Th e Syst em Pr ofiler r epor t g iv es access t o t w o logs ( con sole an d sy st em ) t ha pr ov ide a lit t le b it of inf or mat ion , bu t t w o t ools, Console and Act ivit y View er, can pr ov ide q uit e a b i •inf orm at ion. Table of Content s •

Review s



Reader Rev iew s

• 7.3.1 Console Er r ata •

Academic

•The Console Ten Things I Dig About Pant her Ut ilit ies) , as sh own in Figur e 7- 3 , is t h e üb er u t ilit y t o v iew a applicat ion ( / App licat ions/ •log files on y our Scheduling Tasks in Pant her com p ut er. When you laun ch Con sole, it gat her s t h e sy st em logs an d an y logs f rom Running Maect c Oor SX ant r lay s Hom e dir y Pan d he d isp

a t r ee t o nav igat e bet w een t he logs. I f y ou don' t see t he lef t - hand t r ee click h eDuncan Log s m en u b ar it em ( or use t h e View Show Log List m enu) . By Jam tes Davidson The f ir st t w o log s you 'll see ar e t he sam e sy st em an d con sole logs t hat are available in Sy st em Pr of er: O'Reilly t hatPub 's lish j ust t he w ar m up . The t r ee also giv es you t h e follow ing ar eas in w hich t o see t he log s: Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 7 - 3 . The Con sol e ap pli ca t ion

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

~ / Libr ar y/ Logs Con t ains t h e logs t hat ar e associat ed wit h a user . Th ese in clud e t he v ar ious CrashRep ort er log w hich give t he gor y d et ails of an y applicat ion cr ashes t hat y ou mig ht h ave ex per ien ced. You'l fin d t he Mir r orAg en t log det ailing t he act iv it ies of sy nchr onizing y our iDisk.

/ Libr ar y/ Logs Con t ains logs t hat ar e associat ed w it h t he sy st em at lar ge. For exam ple, y ou' ll find CrashRep r ep or t s on com pon en t s t h at ar e being r un by t he syst em ( inst ead of applicat ions t h at y ou r un if you ar e u nlucky en ough t o ex per ien ce a k er nel p anic, t he log f or it w ill be here.



Table of Content s



Review s

/ v ar / log • • •

Reader Rev iew s Con t ains t h e logs of t he var ious BSD Unix ut ilit ies r unnin g on y our sy st em . For ex am ple, you ' ata t he Ap ach e ht t pd w eb ser v er and t he ipfw f ir ew all h er e. t he logEr s rfor Academic

•Wit h such anTen Digoun About ex tThings rem e Iam t ofPant dather a at you r fin gert ip s, how can you sor t t h r ough it all? This is w h •App le' s use of Scheduling t he Filt erTasks box ininPant t h eher m en u b ar comes in han dy . Figur e 7- 4 sh ows an ex am ple of t he u sear ching Running Ma cf or O S any X P ant lines he r cont ain in g CHUD in t he syst em . log . Th e quick f ilt er ing abilit ies of t he Con sol m ake it easy for y ou By Jam es Duncan Davidsont o look f or needles in a hay st ack. A gr eat u se of t his feat u re is t o scan y our we t o sear ch f or r eq uest s fr om a par t icular I P ad dr ess. Pub lish usef er: O'Reilly Anot h er ul t ool in t he t oolbar is t he Mark b ut t on , w hich in ser t s a separ at or of t ex t , along w it h t h e: e Decem cur rPub en tDat dat and ber t im2 00 e, 3in t o t h e log view . This allow s y ou t o br ing u p t h e console, m ak e a mar k in a 0- 59 005 -8 par t of t he sy st em , and t h en com e back t o see w hat has happ en ed since yo som et hI SBN: in g wit h6-an ot00her t he mar k . 32 6 Pages:

Figu r e 7 - 4 . Fi lt e r in g for CH UD in t h e sy st e m log Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.3.2 Activity Monitor To v iew w hat ' s goin g on w it h you r syst em r ight now , not hing b eat s t he Act iv it y Monit or ( / App licat ions/ Ut ilt ies) in Pan t her, sh ow n in Figur e 7- 5 . Act iv it y Monit or g ives r ealt im e m easur em en r esour ces in u se on t he syst em , t h e pr ocesses t hat are t aking u p t h e m ost m emor y or CPU cycles, a syst em s disk and net w or k act ivit y . Th e ver sion of Act iv it y Monit or in Pant h er con solidat es t he CPU M

and Pr ocess View er ap plicat ion s t hat shipp ed in pr ev ious v er sions of Mac OS X. The t op p art of t he Act iv it y Mon it or w indow con t ains a t able list of t he pr ocesses on y our sy st em alo t he var ious at t rib ut es of t hose pr ocesses. Un lik e t h e Dock or t h e Force Quit p anel, her e you ca ever y pr ocess r un ning on y our syst em . The pr ocesses in t he main w indow can b e filt ered eit her w it h t ext box or t he p ull- dow n m en u in t he menu b ar. The " All Processes, Hier ar chically " op t ion pr ovides an int er est in g v iew. Using t his v iew , you can see •t he pr ocesses Table on yofour Content sy stsem are own ed b y t he init p r ocess discu ssed in Ch apt er 4, Sy st em St art u p Login. You can also see h ow all t he GUI applicat ions t h at y ou hav e r unn in g are own ed b y t he w ind o • Review s ser v er pr ocesses and, if • Reader Rev iewysou hav e a Ter m in al w indow open, y ou can see t he var ious p rocesses ow ne includin g t h e • Erbash r ata sh ell. •

Academic

Not only can y ou m onit or ev er y app licat ion on t he sy st em fr om t he Act iv it y Mon it or, but y ou can als • Ten Things I Dig About Pant her t er min at e applicat ions. Wh en y ou select a p rog ram and t hen pr ess t he Qu it Pr ocess bu t t on ( or use t • Scheduling Tasks in Pant her Pr ocess Qu it m en u) , a dialog sh eet w ill appear g iv ing y ou t he opt ion of polit ely qu it t in g t he ap plic Running Ma c O S X P ant he r ( t h e sam e as going t o t hat ap plicat ion an d u sin g t he Filr e Qu it m en u) or using Force Qu it . By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Figu r e 7 - 5 . The Act i vi t y M oni t or

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.3.2.1 Figuring out what a process does

I t 's pr et t y easy t o fig ur e out w hat man y of t he p rocesses t h at show up in Act iv it y View er do, par t icu w it h applicat ions lik e Safar i or Ph ot oshop w hich show up w it h t heir icon and nam e. Ot hers su ch as s m ach_init , or net infod , h owev er, aren' t as easy t o figu r e out sim ply b y looking at t hem . These ar e u t he pr ocesses t hat t ake car e of v ariou s syst em fu nct ions. I f y ou ar e cur ious ab out w hat a par t icular is, t r y lookin g at it s m anp age. For ex am ple, t he man page for net infod w ill t ell y ou t hat it is t h e Net I dat ab ase daemon . •

Table of Content s



Reader Rev iew s

7.3.2.2 Interpreting process information • Review s p rocess on y our sy st em can b e in m em or y con su m ed , pr ocessor act ivit y , or in t h e a •The im pact of Er a r ata it causes. Som e p rocesses can be r un ning w it hout using any p r ocessor t ime and can •of disk I / O t hat Academic oun tI sDig of About m em or y . her Ot h er s can con su m e you r pr ocessor w it hou t an y imp act on m e •consum e lar ge Tenam Things Pant ocess v iew givinesPant q uit e a bit of t his inf orm at ion t o y ou all at once. Table 7 - 1 list s t h e v •usage. Th e prScheduling Tasks her colum nsMainc O t he art Running S X t Pop antphe r of t he win dow an d w h at t h ey mean. The m ost u sefu l colum ns t o use ar e t he and Real Mem or y colum ns. I f you n ot ice y our sy st em is slu ggish, click t he % CPU heading t o find ou By Jam es Duncan Davidson pr ocess is u sin g t he m ost pr ocessing pow er . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Tab le 732-1 Pages: 6 . Pr oce ss a t t r i bu t e s r epor t ed in t he Act i vi t y M oni t or m ai n w i nd At t r i but e

De scr ip t ion

PID

The num er ical id of th e pr ocess

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Process Name The nam e of the pr ocess cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t heThe inn eruser w orkt ing Pant t h ose w h o w ant User hats of this prher ogrf or am belongs t o t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w% ell CPU on you r w ay. The am ou nt of CPU time that t he pr ocess is taking on your syst

# Thr eads

The num ber of thr eads t hat the process is r unn in g

Real Mem or y

The am ou nt of phy sical memor y used by t he pr ocess

Virt ual Mem ory The total amount of mem or y addr essed by t he pr ocess

To g et m or e det ail on a p rocess, select t he p rocess in t he t op par t of t he w ind ow and t hen hit t he I n bu t t on or use t h e Process I nspect ( - I ) m enu . This br ing s up a det ailed I nspect or w in dow t hat g i m or e infor m at ion about t he pr ocess such as t he Mach por t s in use b y t he ap plicat ion , t he num ber o m essages being sen t v ia t he Mach por t s, t he files t hat t he ap plicat ion is using , and t he var ious m em st at ist ics, such as fau lt s and pag e- in s for t he pr ocess, as sh own in Figur e 7- 6 . Man y of t hese st at ist only of u se t o dev elop er s, bu t t h ey can giv e y ou a good idea of t he k inds of r esour ces t h at y our app licat ions are u sin g.

Figu r e 7 - 6 . I n sp ect in g t he Saf a r i pr ocess



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

7.3.2.3 Sampling an application Pages: 32 6 The Pr ocess I n sp ect or w ind ow giv es access t o a pow er ful feat ur e t h at is of int er est m ainly t o develo w ho w ant t o t ak e a peek in t o t h e inner oper at ion of an ap plicat ion . From t he I nspect or , hit t he Sam bu t t on and anot h er w in dow p ops open ( show n in Figur e 7- 7 ) , allow ing y ou t o see t he call st ack of a app licat ion, t he am oun t of t im e spent in each fun ct ion of an app licat ion, and ot her r elat ed inf orm at Ru nning Mac OS X Pant w her ult im at can e Swalso iss Ar myple Knife( TM) ; for powt here user who t o or w only a developer could antist ot he see. You sam a p rocess fr om m ains Act iv w it yant Monit cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS by u sin g t he Pr ocess Sam ple ( Op t ion- - S) menu . X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 7 - 7 . Sa m ple of Saf a r i r un ni ng, as show n in t he Pr oce ss Vi ew e r sam w in dow

7.3.3 Monitoring Processes from the Command Line As good as t he Con sole an d Act iv it y Monit or are, som et imes t h e only t ool for a job is a com m and - lin

par t icular ly w hen y ou ar e logged in r em ot ely t o a m achine via ssh ( t he Secur e Shell) . For t u nat ely, ar e an abun dance of good t ools av ailable on t he com m and line, m any of w hich ser v ed t o in spire t he t ools in Mac OS X.

7.3.3.1 Working with log files To w or k w it hTable log files on t he com man d line, y our pr imar y t ools of choice w ill be gr ep an d t ail. Nam e • of Content s " get regu lar exp ression ," gr ep allow s y ou t o q uickly search and r et ur n lines in a f ile t hat cont ain a p • Review s of t ext . Think of it as t h e com m and - lin e v er sion of t h e Filt er b ox on t he Con sole applicat ion ( alt h oug • Reader Rev iew s pr edat es t h e Filt er box by a few decades) . Ex am ple 7- 4 sh ows t he u se of gr ep t o per for m a sear ch f • Er r ata t er m CHUD in t he sy st em log ( t he sam e sear ch as befor e, giv ing you a point of com p arison) . •

Academic



Ten Things I Dig About Pant her



Tasks in Pant her Exa m pl e 7Scheduling - 4 . Se ar ch in g t he sy st em log f or t he p at t er n CHUD Running Ma c O S X P ant he r By Jam es Duncan Davidson

$ grep Pub lishCHUD er: O'Reilly /var/log/system.log Pub Dat e: Decem ber 2 00 3

Dec 8 I SBN: 12:53:18 localhost ConsoleMessage: Loading CHUD Prof kernel extension 0- 59 6- 005 00 -8 Pages: 32 6

Dec 8 12:53:18 localhost ConsoleMessage: Loading CHUD Utils kernel extension Dec 8 12:53:18 localhost SystemStarter: Loading CHUD Prof kernel extension Dec 8 12:53:18 localhost SystemStarter: Loading CHUD Utils kernel extension Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust ize, t w eak , localhost and g en er ally r ev u p CHUDUtils.kext t heir Mac. This b ook t ak es reader s deep in side Mac OS Dec om 8 12:53:19 kernel: version: 2009002 X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst You m ay not be a Mackernel: gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Dec em 8 .12:53:19 localhost CHUDProf.kext version: 2009005 w ell on you r w ay.

gr ep g ives y ou quit e a bit mor e p ow er t han ju st t he ab ilit y t o search using a sim ple t er m. I t act ually y ou t he abilit y t o use any r egu lar ex pr ession. For ex am ple, if you w ant ed t o find all t h e lin es t hat cont ained t he w or ds CHUD and k ern el ( in t h at or der ) , y ou cou ld u se t he CHUD.*kernel r egex , w hic hu man m eans " look f or t he t er m CHUD , t hen som e n um ber of any kind of char act er s f ollowed by t h k er nel" . Ex am ple 7- 5 show s t h e result of t his r egex. You can see t h at on ly t he lines w it h bot h t h e w o CHUD and ker nel app ear .

Exa m pl e 7 - 5 . Usi ng a m or e det ai le d r e ge xp w it h g r ep $ grep CHUD.*kernel /var/log/system.log Dec 8 12:53:18 localhost ConsoleMessage: Loading CHUD Prof kernel extension Dec 8 12:53:18 localhost ConsoleMessage: Loading CHUD Utils kernel extension Dec 8 12:53:18 localhost SystemStarter: Loading CHUD Prof kernel extension Dec 8 12:53:18 localhost SystemStarter: Loading CHUD Utils kernel extension

To m on it or w hat ' s chang in g in a log f ile, an d in st ead of t r yin g t o r ead t h rou gh t he wh ole log f ile fr o t op, Un ix gives y ou t he t ail com m and for look ing at ju st t he last par t of a file. Ex am ple 7- 6 sh ows t h of t ail on t h e syst em log aft er u nplug ging and plu gging in a f ew USB devices.



Table of Content s



Review s

• •

Reader Rev iew s Regular Expressions Er r ata



Academic

Regu lar ex pr essions ( also kn ow n as r egex 's) is a sm all, highly specialized langu age f or I Dig About Pant her pr ocessing tTen ext Things st r in gs. They can be a bit scar y t o u se at f irst becau se of t heir ex t r emely • concise sy ntScheduling Tasks in Pant herlook confu sin g an d com plicat ed t o t he u ninit iat ed. Her e ar e ax w h ich m ak es t hem Running Ma c O S X P ant he r a f ew of t he most com m only u sed char act er s in r eg ular exp ression s: •

By Jam es Duncan Davidson

Cha Pub lish r act er: O'Reilly er De scr ip t ion . *

Pub Dat e: Decem ber 2 00 3

Matches an y single char act er

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Matches zero or mor e occu rr ences of th e ch ar acter imm ediately pr eceding it

^

Matches the beginning of a line

$

Matches the en d of a lin e

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eakUsed , and gt en er ally r ev u p following t heir Mac. This ook t ak s deep to in side Mac OS o quote the ch arbacter , es f orreader example X's\ cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir f ind a $ char acter syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. To lear n all about r eg ular exp r essions, y ou shou ld p ick u p Mast ering Regular Ex pr essions, 2n d Ed it ion, b y Jeffr ey E. F. Fr iedl ( O'Reilly & Associat es, I n c. , 2 002 ) .

Exa m pl e 7 - 6 . Th e t a il com m a nd a ppli ed t o t h e sy st em log $ tail /var/log/system.log Dec 8 14:15:06 localhost kernel: USB Low Power Notice: The hub "Hub in Apple USB Keyboard" cannot be used because there is not enough power for all its ports Dec 8 14:15:06 localhost kernel: USBF: 169.316 AppleUSBHub[0x2755800]: insufficient to turn on ports Dec 8 14:15:06 localhost kernel: USBF: 169.316 AppleUSBHub[0x2755800]::ConfigureHub PortPowerRequirements failed with 0xe00002e3 Dec 8 14:15:06 localhost kernel: USBF: 169.316 AppleUSBHub[0x2755800]::start Aborti

startup: error 0xe00002e3 Dec 8 14:15:34 localhost kernel: USBF: 196.900 [0x2ae1000]::start - USB HID Interfa of device USB-PS/2 Mouse M-BA47 @ 7 (0x18222000) Dec 8 14:15:55 localhost kernel: USBF: 217.924 [0x2564200]::start - USB HID Interfa •of device USB-PS/2 Table of Content s Mouse M-BA47 @ 7 (0x18222000) • Review s

Dec 8 14:16:23 kernel: USBF: 245.467 [0x239d600] USB Generic Hub @ 4 • Readerlocalhost Rev iew s •

Er r ata

(0x18210000) • Academic •

Ten Things I Dig About Pant her

Dec 8 14:16:23 localhost kernel: USBF: 245.836 [0x2564000]::start - USB HID Interfa • Scheduling Tasks in Pant her Running Ma c O S X P ant he r

of device Apple Extended USB Keyboard @ 6 (0x18211000) By Jam es Duncan Davidson

Dec 8 14:16:23 localhost kernel: USBF: 245.882 [0x23b9d00]::start - USB HID Interfa Pub lish er: O'Reilly

of Pub device Dat e: Decem Apple ber Extended 2 00 3 USB Keyboard @ 6 (0x18211000) I SBN: 0- 59 6- 005 00 -8

Dec 8Pages: 14:16:23 localhost kernel: USBF: 245.934 [0x2ae2800]::start - USB HID Interfa 32 6 of device USB-PS/2 Mouse M-BA47 @ 7 (0x18212000)

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS By def ault , t aildisplay s t he last 10 lin es of t he f ile you app ly it t o. To chang e t his b eh avior , y ou can X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir t he - n op t ion t o specif y how m any lines t o go b ack w ar ds int o t he file. Ex am ple 7- 7 sh ows t his in act syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Exa m pl e 7 - 7 . Usi ng t h e -n a r gu m en t of t ai l $ tail -n1 /var/log/http/error.log [Sun Nov 30 17:40:18 2003] [notice] Accept mutex: flock (Default: flock)

I f you w ant t o see t h e sy st em log as it chan ges ( for ex am ple, if you w ant t o mon it or t he sy st em log y ou ch ange USB d ev ices an d t hen ex ecu t e a com m and w it h sudo) , y ou can u se t he - f op t ion t o t ail, show n in Ex am ple 7- 8.

Exa m pl e 7 - 8 . Usi ng t a il - f on t h e sy st em log $ tail -f -n0 /var/log/system.log Dec 8 14:19:09 localhost kernel: USBF: 411.832 [0x2ae2300]::start - USB HID Interfa of device USB-PS/2 Mouse M-BA47 @ 7 (0x18212000)

Dec 8 14:23:10 localhost sudo: duncan : TTY=ttyp2 ; PWD=/Users/duncan ; USER=root ; COMMAND=/bin/ls

To ex it f r om t ail w h en r un ning w it h t he - f op t ion, h it Con t r ol- C. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.4 Working with Processes The ps com m and ( shor t f or pr ocess st at u s) disp lays in for m at ion ab out t he v ar ious pr ocesses on y our sy st em on t h e comm and line. How ever , if y ou j ust ex ecu t e ps b y it self on t he com m and line, y ou'll see on ly t he pr ocess in for m at ion ab out t he shell p rocess you ar e r unn ing. For t h e prs ocesses t hat belong t o y ou, use t he ps - x com m and as show n in •inf orm at ion abou Table tofall Content Ex am ple 79. • Review s •

Reader Rev iew s



Er r ata



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Exa m pl e 7Academic - 9 . List i ng al l t h e pr ocesses t ha t b el ong t o a u ser •

Running Ma c O S X P ant he r

$ ps -x By Jam es Duncan Davidson

PID

TT

STAT

TIME COMMAND

Pub lish er: O'Reilly

177 Pub

Dat ?? e: Decem Ssber 2 000:48.59 3

/System/Library/Frameworks/ApplicationServices.framew

I SBN: 0- 59 6- 005 00 -8

180Pages: ??

32 6 Ss

0:00.77 /System/Library/Frameworks/ApplicationServices.framew

184

??

Ss

0:01.32 /System/Library/CoreServices/loginwindow.app/Contents

266

??

Ss

0:00.43 /System/Library/CoreServices/pbs

Ru290 nning ?? Mac OS her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o S X Pant 0:02.62 /System/Library/CoreServices/Dock.app/Contents/MacOS/ cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's297 cor e,?? r evealing t he0:00.93 inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir S /System/Library/CoreServices/SystemUIServer.app/Conte syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you ay. 298 ?? r w S 0:28.74 /System/Library/CoreServices/Finder.app/Contents/MacO 315

??

Ss

0:02.27 /System/Library/CoreServices/MirrorAgent.app/Contents

340

??

Ss

0:00.04 /sbin/mount_webdav -o noautomounted -o nobrowse -a7 -

341

??

S

0:02.19 /Applications/iChat.app/Contents/MacOS/iChat -psn_0_9

342

??

Ss

0:00.43 /System/Library/PrivateFrameworks/InstantMessage.fram

345

??

S

2:48.70 /Applications/Adobe InDesign 2.0/InDesign 2.0.2 /Appl

347

??

S

1:09.86 /Applications/iTunes.app/Contents/MacOS/iTunes -psn_0

349

??

R

0:11.25 /Applications/Utilities/Terminal.app/Contents/MacOS/T

369

??

S

0:00.44 /Applications/Backdrop.app/Contents/MacOS/Backdrop -p

373

??

S

0:22.34 /Applications/Adobe Photoshop 7/Adobe Photoshop 7.0/C

351

std

S

0:00.11 -bash

When ps is com bin ed w it h gr ep , y ou can f ind ju st t he p r ocess y ou ar e look ing for . Ex am ple 7- 10 show s a com m and t o ret u rn t h e pr ocess inf orm at ion f or Phot oshop .

Exa m pl e 7 - 1 0 . Look in g for Ph ot oshop usin g p s an d g r ep

• •

Table of Content s

$ ps -xReview | grep Photoshop s

• • • • •

Reader Rev iew s

373

?? Er Sr ata 0:23.76 /Applications/Adobe Photoshop 7/Adobe Photoshop 7.0/C

382 std

Academic

U+

0:00.01 grep Photoshop

Ten Things I Dig About Pant her Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

To see all t h e pr ocesses ru nning on t h e sy st em, use t he - ax op t ion. Th is pr oduces qu it e a b it of contPub ent lish , er: so O'Reilly it 's b est t o u se t his opt ion w it h gr ep t o nar r ow d own t h e r esult s t o only w h at y ou w ant t o see. For ber ex am if you w ant t o see all t h e pr ocesses r unnin g as root , you w ould use: Pub Dat e: Decem 2 00 ple, 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

$ ps -aux | grep root

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust t wuleak , and g enfor er ally u pg tyheir This ook Itnakfact es ,reader s deep intside Anotom h erize, usef com m and monritev orin our Mac. sy st em is bt op. it ' s alm ost cer ain tMac hat tOS op X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir pr ov ided t he inspir at ion for t h e Act ivit y Monit or 's p rocess view . When y ou ex ecu t e t op, y our syst . You ay w not ou st ar t as t his book b utpercent once you 'v eofr ead it , yout'll be Termem inal w in m dow ill fbe ill aupMac w it hguarulistw hen of pryocesses w ell as ,t he age pr ocessor ime w ell on you r w ay. and m emor y t h ey are usin g, as sh own in Figur e 7- 8 . I nv ar iably, t her e w ill be t oo m uch inf orm at ion t o fit on t h e w indow so you m igh t w ant t o resize you r Term inal w in dow t o see mor e inf orm at ion befor e y ou issue t he t op com m and. When you ar e don e w it h t op, u se Cont r ol- C t o qu it or u se t he Mac st an dar d - . com m and.

Figu r e 7 - 8 . t op r un ni ng in a Te r mi na l w in dow



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

7.4.1 Ru nningKilling Mac OS Processes X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cort ue,nat r evealing inn er es w ork ing syou of Pant t h ose w ho ante tand o g et t h et he most out ion of tof heir Unfor ely, t heret he are t im w hen h aveher t o fmoranually int er w v en end ex ecut a syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll be pr ocess. May be it is a bugg y pr ogr am t hat h as st opped accept in g u ser in put or m ay be t he w w ay. prell ogron amyou is jr ust con su min g a hu ge dat aset an d you 'v e decided y ou don' t wan t t o w ait . Or as an adm inist r at or , y ou m igh t n eed t o log in t o a rem ot e sy st em t o k ill a user 's er r ant p r ocess or even r eb oot a ser v er . W hat ever t h e r eason, here are t he w ay s in w h ich y ou can st op a pr ocess' s execut ion. 7.4.1.1 Force Quit Using t h e Force Qu it App licat ions w in dow in Mac OS X, show n in Figur e 7- 9 , is t h e easiest w ay t o k ill off an app licat ion w hile logged in t o t he sy st em . You can get t o it by using t he Force Qu it m en u or using t he Opt ion- - Escape k eyst r ok e. Sim p ly select t he ap plicat ion t h at y ou w ant t o kill of f and hit t he For ce Quit but t on .

On ly GUI applicat ions w ill show u p in t h e For ce Qu it dialog box . To quit app licat ions t hat aren' t GUI applicat ions, use t he Act iv it y Mon it or as descr ibed in t he nex t sect ion .

You can also f or ce q uit an ap plicat ion using it s icon on t he Dock . Con t rol- click t he icon ( or click and hold it dow n on f or a second or t w o) . A cont ext u al m enu w ill pop up. Press t he Opt ion k ey t o t ur n t he Quit menu it em t o For ce Qu it .

Figu r e 7 - 9 . The For ce Q uit Appl ica t i ons w in dow



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e,Using r evealing he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir 7.4.1.2 thetActivity Monitor syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The Act iv it y Monit or also pr ovid es a w ay t o for ce applicat ions t o quit , inclu ding t hose p rocesses t hat ar en 't v isible on t h e display. To q uit an app licat ion t his w ay , sim ply high lig ht t he p rocess and t h en use t h e Quit Pr ocess bu t t on or t he Pr ocess Qu it m en u ( Opt ion - - Q) . This br ing s up a dialog box allow ing you t o qu it or f orce q uit an ap plicat ion .

7.4.1.3 Using the command line As alw ay s, t here is a com man d- line t ool w ait in g for y ou if you can' t u se t he GUI t ools. App rop riat ely enoug h, it ' s nam ed k ill. To kill a pr ocess, y ou need t o fir st get it s pr ocess I D via t he ps t ool. Then you ju st pass t h at p rocess I D t o k ill as sh ow n in Ex am ple 7- 11.

The Difference Between Quit and Force Quit What 's t h e dif ference b et w een Quit an d For ce Quit ? Qu it m akes a r eq uest t o t he app licat ion t o t er m inat e. This is essen t ially t h e same act ion y ou wou ld t ake if y ou br oug ht t he ap plicat ion t o t he f oregr ou nd and t r igger ed t h e - Q key boar d sh or t cu t . •

Table of Content s

• Force Quit isn' Review t sos polit e. I t inst r uct s t h e sy st em t o im m ediat ely t er m inat e t h e • pr ocess—w itReader h no- hold Rev iew s bar s r ed . This ensur es t hat t he pr ocess goes aw ay , bu t d oes so

it a chance t o sav e f iles or p er f orm any ot h er clean up. • w it hout giv ing Er r ata •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Force Quit the Current Application Pub lish er: O'Reilly

Man y t imes, t h e applicat ion you w ant t o f or ce quit is t he on e t hat is r unn in g in t h e Pub Dat e: Decem ber 2 00 3 for egr oun d. On e w ay t o quickly f or ce quit t he f or eg rou nd applicat ion is t o use Sh if t I SBN: 0- 59 6- 005 00 -8 Op t ion- - Esc. As soon as y ou d o, t h e for egr ound app licat ion w ill be k illed w it hout Pages: 32 6 pr eju dice. Th e dow nside: you w on' t b e pr om pt ed t o sav e any op en docum ent s—bu t if t he applicat ion is t ru ly st u ck, t hen t hey w er e t oast in an y case. This, how ev er , w ill n ot w or k on t he Find er . I f y ou need t o for ce quit e t he Finder , y ou' ll need t o use Op t ion - - Esc, select t h e Fin der , and t hen click t h e Relaunch bunning t t on. Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Ru cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Exa m pl e r 7w-ay. 1 1 . Usin g t he k i ll t ool w ell on you $ ps -x | grep emacs 415 std S+ 0:00.01 grep emacs 413 p2 S+ 0:00.13 emacs $ kill 413

I f a p rocess is bein g unr uly , y ou can t ell t h e sy st em t o k ill it wit h out pr ej ud ice b y using t he - KI LL opt ion , w hich in st r u ct s t he sy st em n ot t o be n ice. Ex am ple 7- 12 sh ows t his in act ion :

Exa m pl e 7 - 1 2 . Usin g k i ll - KI LL t o t er m i na t e a pr ocess w i t h out pr e ju dice $ ps -x | grep emacs 418 std S+ 0:00.01 grep emacs

416 p2 S+ 0:00.04 emacs $ kill -KILL 416



Table of Content s



Review s



You should ex er cise gr eat car e w hen killing err ant pr ocesses, especially w hen using t he k ill com m and, as it 's easy t o cr eat e p rob lem s. For exam ple, Reader iew sem adm inist r at or h as a st or y abou t ex ecut in g sudo k ill- KI LL 1 everRev y syst Er r ata inst ead of sudo k ill- KI LL 128 . Unf ort unat ely , t he init p r ocess has t he I D of Academic 1, wh ich w ill cause t his com m and t o h ang t he sy st em .



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

• •

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

7.5 Further Explorations To g et m or e infor m at ion about t he t ools in t his chapt er , check out t he f ollow ing m anp ages:

• •

soft w ar eupd at e

Table of Content s

Review s syst em _pr of iler

• •

Reader Rev iew s

ps

• • •

Er r ata Academic

t op gr ep

Ten Things I Dig About Pant her Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es t ailDuncan Davidson

ill er: O'Reilly Pubklish Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 8. Scheduling Tasks Com pu t ers ar e all about aut om at ion of t asks, an d Mac OS X giv es you sever al t ools t oh elp execut e t ask s at cer t ain t imes of d ay and ev en on a r eg ular and r epeat ing basis. Af t er all, if y ou w ant t o copy a f ile f r om one p lace t o anot h er , or dow nload a set of w eb p ages at 5 : 25 a. m. on •t he dot , w h y Table of Content s e t o get out of b ed w hen t hecom put er can do it for you ? sh ould you hav •

Review s

•To p er f orm mReader any ofRev t he iewtsask s it has t o, t he sy st em u ses a set of ut ilit ies called cron an dper iod ic al hou sek eepin g t ask s. This includ es su ch t h in gs as t id yin gup log files and •t o man age sever Er r ata em d at abases lik e t h e one u sed by t h e locat e com m and( discussed in Ch apt er 3. ) . •up dat ing systAcademic sh ow s y ouI Dig h ow t o use hese t ools. Fir st , h owev er , y ou' ll learn h ow t o pr operly set •This chap t er Ten Things About Pantther our com pu t er tino Pant m akher e sur e t he t ask syou 'r e w ant in g t o aut omat e get t r igg er ed on •t he t ime on yScheduling Tasks t im e ever t im Running Mayc O S Xe.P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.1 Setting the Time Wit hou t h aving t h e t im e accu rat ely set on y our m achine, it ' s pr et t y har d t o schedu let ask s. You can set t he t im e and dat e on you r comp ut er y our self using t he Dat e & Time p r ef er ence pan el ( / App licat ions/ Sy st em Pref er ences ) . I f y ou sp en d an y am ount of t im e conn ect ed t o t h e I nt er net t hese day •( and w ho doesn't Table of Content s s) , y ou sh ould by pass allt hat and hav e y our com put er set it s t im e fr om a net w or k t im e ser v er . Sim ply click t he'Set D at e & Tim e aut om at ically ' checkb ox in t he • Review s Dat e & Tim e p ref er ence pan el, asshow n in Figur e 8- 1 , an d select an ap pr opr iat e t im e ser v er near • Reader Rev iew s y ou. •

Er r ata



Academic A n et wor k t im e serv er is not hing m ore t han a m achine t hat h as an accu rat e clock and t hat •un derst an ds Ten I Dig About her ( NTP) , w hich is desig ned t o k eep lar genum ber s of t h e Things Net w or k Tim e PrPant ot ocol •m achines synScheduling Tasks in Pant her ch ron ized w it h an accur at e clock; t y pically on e of t he at omicclock s t hat pr ov ides Running Maaccur c O S XatPe ant he re p ossible. t he most t im By Jam es Duncan Davidson

By def ault , t h e Dat e & Tim e pr efer ence panel allow s y ou t o set y our t im e ag ainst oneof t h ree ser v ers p r ovided by Ap ple. One of t hese ser ver s is locat ed in t he U. S. , anot h er in Asia, an d t he Pub lish er: O'Reilly t hir d in Eur ope. You can also set you r com p ut er t o sy nchr onize it s t ime wit h any NTP ser v er you Pub Dat e: Decem ber 2 00 3 choose—su ch as a ser v er on y our local n et wor k t hat is set u p by t h e net w ork adm inist rat or s. You SBN: 06- 005 -8 can ch Ioose t o59syn ch00 r onize against a n um ber of pub licly accessible t im e ser v er s on t h e I n t ern et . Pages: 32 6 A list of n et wor k t im e serv er s isav ailable at w w w .eecis. udel. edu / ~ m ills/ nt p/ ser ver s. h t m l .

Figu r e 8 - 1 . The Da t e & Ti m e Pr ef e r en ce pa ne l Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

When y ou set a t im e ser v er , t h e syst em does t h e follow ing:

Set s t he t ime ser ver t h at is b eing u sed in / et c/ nt p. conf . Mak es su r e t hat t he nt p d p r ocess is r unn in g. Th is pr ocess w ill check t he t im eser v er per iodically an d m ak e sur e y our clock is set cor r ect ly . Set t h e TIMESYNC line in / et c/ host config t o - YES- , ensur ing t h at n t pd w ill st art w hen t he syst em is r eboot ed. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.2 Using iCal to Schedule Tasks iCal is t he per sonal calen dar ing applicat ion t hat com es w it h Mac OS X. iCal f eat ur es mu lt iple calend du rat ion . Ev ent s can be on e- t im e occur r en ces, or t h ey can r ep eat . Each event can h ave an alar m t h at can display a n ot ice on y our com pu t er scr een , opena file, or eve • Table of Content s / App licat ions/ iCal.ap p/ Con t en t s/ Resou rces ) t o k eep t rack of ev en t s and f ir e t h em off on sch ed ule w h •

Review s



Rev iew s You can u se Reader iCal' s alar m s along w it h Ap pleScr ipt t o ex ecut e just about any kind of t ask you 'd like. To •

Er r ata



Academic

• 1. •

Cr eat e an app licat Ten AppleScrip Things I Dig tAbout Pantion her t hat per for m s t he fun ct ion alit y you w ant and sav e it som ew h Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

On e logical place t o st or e y our scr ip t s is in / Libr ar y/ Scr ipt s. An yt h ing y ou can st or e almost an yt h ing, in clud ing AppleScript s, sh ell scr ipt s, a

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

2 . Cr eat e32a6 on e- t ime or a r epeat ing ev ent in iCal. Pages: 3 . Set t h e alarm pr oper t ies on t h at ev en t t o open you r AppleScrip t app licat ion. For exam ple, if y ou w an t ed t o sen d a list in g of all t he f iles in you r Hom e dir ect or y t hr oug h em ail eve Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust g en ple er ally r evipt u p tto heir Mac. ooki n t aktes Exaom m ize, pl e t w 8 eak - 1 ., and An Ap Scr li st t hThis e f ilbes hereader H oms edeep dirin e side ct orMac y a OS nd sen X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e set listing to (do shell script "/bin/ls -l $HOME")tell application "Mail" w ell on you r w ay. set the newMessage to (make new outgoing message with properties ¬

{subj

On ce y ou hav e saved t his scr ip t as an Ap pleScr ipt applicat ion nam ed List Hom eDir , you can set it u p 8- 2 . Once set , as long as y ou ar e logg ed in t o t he com put er at t he t im e t he event is sch ed uled f or , t go t o t he com man d line and use t he Unix schedu lin g t ools.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.3 Using periodic The per iod ic t ool is designed t o or gan iz e adm inist rat iv e t ask s t hat need t o be perf or med over and ov er again at r egular in t er v als. The int er v als t hat per iod ic su ppor t sar e: daily , w eekly, an d m ont h ly . Mac OS X it self has a set of t asks t hat it r un s using t he per iod ic sy st em , in clu ding: • • • •

Table of Content s Review s

Tidy ing up log files and rem ov in g scr at ch f iles ev ery d ay Reader Rev iew s

Rebu ild Er in rgata t he locat e d at abase and r ot at ing log files ever y w eek

• •

Academic

Perf or min log f ile r otAbout at ion Pant as w ell as login accou nt ing ever y m ont h Teng Things I Dig her



Scheduling Tasks in Pant her

The t askMa s ct hOat iod Running S Xper P ant heicr ex ecu t es are a set of scr ipt s in t h e / et c/ periodic/ daily , / et c/ periodic/ week ly , an d / et c/ periodic/ m on t hly d irect or ies. To hav e per iod ic r u n y our own By Jam es Duncan Davidson scr ipt , sim ply ad d it t o one of t hese dir ect or ies. For ex am ple, if you h ave a bat ch of sales r epor t s t hat y ou' d lik e t o m ak e a daily sn apshot of, you could add t he scr ip t in Ex am ple 8- 2 t o t h e Pub lish er: O'Reilly / et c/ periodic/ daily d irect or y. Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

Exa mPages: pl e 3286- 2 . A sa m ple pe r iodi c scr ipt #!/bin/bashecho Making daily backup of sales reports

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o DATE=`/bin/date +%Y-%m-%d` cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir /bin/mkdir -pay/SalesBackups/$DATE syst em . You m not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. /bin/cp -R /Users/Shared/SalesData/* /SalesBackups/$DATE

per iod ic also gives y ou a w ay t o cont r ol t h e ord er in w h ich scr ipt s ru n. I f y ou look in t he / et c/ periodic/ daily d irect or y y ou'll not ice t hat scr ipt s t hat com e w it h t he sy st em st ar t w it h a nu mb er . To hav e y our scr ip t s execut e in a par t icu lar ord er , sim ply pr efix t hem w it h a n um ber and per iodic w ill t ak e care of ord er ing t heir ex ecut ion , as show nin Ex am ple 8- 3.

Exa m pl e 8 - 3 . List i ng of t h e / et c/ per i odic da il y dir e ct or y $ ls -l /etc/periodic/daily/ total 24 -r-xr-xr-x 1 root wheel 1389 30 Aug 20:36 100.clean-logs -r-xr-xr-x 1 root wheel 3529 30 Aug 20:36 500.daily

The n um ber in t he f ilen ame con t rols t he execut ion or der of t he scr ipt s. The low er t h en um ber, t he earlier it w ill b e execut ed com par ed t o ot h er scr ipt s in t he d irect or y. For exam p le, t o hav e t h e sales b ack up scrip t in Ex am ple 8- 2 ex ecu t e aft er t h e r est of t he d aily t ask s, y ou could sav e it as

/ et c/ periodic/ daily / 700 .salesback up.

8.3.1 Viewing the output from periodic Since per iod ic r u ns in t he b ack gr oun d, an y out p ut pr oduced b y t he scr ipt s is h id denf rom view . To see w hat happ en s, per iod ic sav es t he ou t put int o t he / v ar / log d irect or y. Daily out pu t is sav ed w eekly •t o / v ar / log/ d aily. Tableout of ,Content s ou t put is saved t o / v ar / log/ w eek ly. out , an d m on t hly out p ut is sav ed t• o / v ar / log/ m Review ont h lys. out . •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.4 cron The p r im ar y t ool for scheduling t ask s on t he com m and lin e is t he vener able cron . Th is t ool is st ar t ed au t omat ically by Sy st em St ar t er at boot t im e and r uns con t inuou sly int he back gr oun d. Ev ery min ut e, cron w ak es up and consult s a set of t ables t o see ift here is any t hing t o be h at t im e, and sif so, t ak es car e of ex ecut in g it . Theset ables, k now n as cron t ab f iles, •execut ed at tTable of Content ar e locat ed in t w o p laces on t he f ilesy st em : • Review s •

Reader Rev iew s



Er r ata



Academic

/• et c/ cr ont ab Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

The f ile Running Macron c O S tXab P ant hefor r

t he sy st em at lar ge. Each en t r y in t h is t able r epr esent s a comm an d t hat w ill be r un b y t he r oot user and t he t im e t h at it w ill be r un . Any body can read t his f ile, By Jam es Duncan Davidson bu t on ly t he r oot user can edit it . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

/ v ar / crIon/ SBN:t abs/ 0- 59 6- 005 00 -8 Pages: 32 6

This d irect or y con t ains t h e user cron t ab f iles for each u ser on t h e syst em w ho is using cron . Th ese f iles ar e hid den an d are on ly visible t o t he r oot user , so t hat ot her user s on t h e syst em can' t look at each ot h er ' s cron t ab f iles.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.5 The System crontab File Ex am ple 8- 4 sh ows t he sy st em cron t ab as it app ear s in a default inst allat ion . While t h is file is f or syst em t ask s, you shou ld alw ay s use t he cr ont ab f ile for you r user . •

Table of Content s

Exa m pl e 8Review - 4 . sTh e syst e m cr on t a b f il e/ • •

Reader Rev iew s

# • /etc/crontab Er r ata •

Academic

SHELL=/bin/sh • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin Running Ma c O S X P ant he r By Jam es Duncan Davidson

HOME=/var/log #

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

#minute hour mday I SBN: 059 6- 005 00 -8

month

wday

who

command

*

*

root

/usr/libexec/atrun

Pages: 32 6

# #*/5

*

*

# Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om daily/weekly/monthly ize, t w eak , and g en er ally jobs. r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS # Run X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst be a Mac gu t his bookperiodic , b ut oncedaily you 'v e r ead it , you 'll b e 15 em . You 3m ay not * * ru w hen *y ou st ar t root w ell on you r w ay. 30

4

*

*

6

root

periodic weekly

30

5

1

*

*

root

periodic monthly

The cron t ab f ile for m at is sim ilar t o t h at of m any ot her Unix ut ilit ies. An y line begin ningw it h t he hash char act er ( # ) is a com m en t . The fir st t hr ee non - comm ent ed lin esof t h e file set t he env iron ment t hat cron w ill r un w it h. The r emain in g lin es of t h ecron t ab f ile consist of fiv e nu mb er s d ef ining t he t ime pat t er n at w hich a par t icular t ask is t o r un . The end of t h e lin e cont ains t he com man d t o r un . I n t he case of t he sy st em cron t ab, t h e comm an d also cont ain s t he nam e of t h e user und er w hich t o r un t he com m and. As t h e file it self ind icat es, each of t h e fiv e nu mb er s cor r espon ds t o a d if fer ent t im e int er val, ar r ang ed in ord er of finer t o larg er gr anular it y . Figur e 8- 3 d escr ibes t he set t ings for each of t hese field s. I n ad dit ion t o nu m bers, each f ield can cont ain an ast er isk ( * ) char act er , w h ich m ean s m at ch ev er y p ossibilit y f or t hat field. To in t er p ret t he lines in t he cron t ab f ile in Ex am ple 8- 4 , r ead t he field s for each line f rom lef t t o r ight . For ex am ple, t he f ir st field ( aft er t h e com m ent s) in t he sy st em cron t ab in dicat es t hat periodic daily sh ould b e r un on t he f ift eent h m in ut e of t h e t hir d hour on any d ay of t he m on t h on any g iv en mon t h on an y day of t h e w eek . This means t hat per iod ic d aily w ill r un at 3: 1 5 a. m . ever y day . Th e second line ind icat es t h at t h e per iod ic w eekly com m and w ill r un on t he t h ir t iet h m inut e of t he f our t h hour of an y Sun day ; t hat is, it r uns ev ery Su nday at 4: 30 a.m . For each of t h e fields, y ou can also specif y a list or ran ge of nu mb er s. For ex amp le, if you w ant ed

t o ru n a comm an d ev er y 1 5 m inu t es, you could use t he follow in g lin e: 0,15,30,60 * * * * command

Figu r e 8 - 3 . The cr on t a b f il e f or m a t •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.6 The User crontab To set u p t ask s t h at w ill g et execut ed, y ou hav e t o ed it y our ow n per son al cron t ab. You can t ak e a look at w hat y ou alr eady hav e in y our cron t ab f ile by u sing t h e cron t ab com m and: •

$ crontab -l crontab: no crontab for duncan Table of Content s



Review s



Reader Rev iew s



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

This ou t put m eans not h ing has b een sch ed uled y et . By def ault , a user accoun t w on' t hav e a • Er r ata cron t ab w hen it is fir st set u p.

8.6.1 a he user crontab Running Editing Ma c O S X P ant r By Jam es Duncan Davidson

Ther e ar e t w o w ay s t o ed it y our cron t ab. Th e fir st inv olv es u sin g w h at ev er edit or y ou' ve set up on t he com m and line ( f or ex am ple, v i, Em acs, an d pico) . Th e second inv olvesusing any edit or lish er: O'Reilly y ouPub w an t ( such as Text Edit or BBEd it ) and loading a t ex t f ile as y our cron t ab. To ed it y our f ile on Decem ber use 2 00 3 t h e follow ing comm and : t he Pub comDat me:and line, I SBN: 0- 59 6- 005 00 -8

$ crontab Pages: 32 -e 6

For y our f ir st cron t ab ent ry , let 's add a line t hat w ill m ak e y our com put er say ' hello'ever y m inut e. To do t his, add t he follow ing lin e t o y our cron t ab f ile: Ru OS X Pant her t he ult"hello"' im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o * nning * * *Mac * osascript -eis 'say cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. I f you g et st uck in an edit or t hat you ar e un fam iliar wit h , r em em ber t hat you can get out of v i b y t y ping :q! an d out of Em acs b y t y ping Con t r olX t hen Cont r ol- C. See Ch apt er 3, The Ter m in al and Shell , f or m or e info abou t com m and- line edit or s.

Now , ever y m inut e of ev ery day t hat y our m achine is on , it will say ' hello' t o y ou, w hich could becom e annoy ing indeed. Th er e ar e a cou ple t h in gs g oin g on h er e: 1 . The osascript -e'say "hello"' com m and is being issu ed by y our sy st em ever ym inu t e, based on t h e fiv e pr eced in g ast er isk s. 2 . The com m and uses t he d ef ault sy st em v oice set in t he Sp eech pr ef erence p anel t ospeak t he w or d ' hello' on cue. But now t hat you 'v e got a cron t ab f ile inst alled, you can use cron t ab t o list t h e file: $ crontab -l * * * * * osascript -e 'say "hello"'

The ot her w ay t o cr eat e a cron t ab f ile is t o u se an edit or lik e Tex t Edit or BBEd it . Toget t h e cur r en t cron t ab ou t in a for m t hat y ou can open w it h any edit or , save t he f ile on you r har d dr iv e, and t h en execut e t he cron t ab com m and as f ollow s:

$ crontab mycrontabfile

This also g ives a way t o q uick ly r eset t he cron t ab f ile for a user. By passingt h e/ dev / null f ile int o cron t ab, t h e user' s cron t ab w ill b e set t o an emp t y f ile. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Using t h e cron t ab com m en t t o specif y a f ile is also a g ood w ay t o Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

accid en t lylose any cron set t ing s t hat y ou h ave in place. Be sur e t o check y our cron t ab b ef or e loading in a new cron t ab f ile.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

To r et r iev e y our cron t ab f or edit ing , y ou can dir ect t he ou t pu t using t h e follow ingcom m and: lish er: O'Reilly $ Pub crontab -l > mycrontabfile Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Running Virex from cron I f nning you 'v eMac instOS alled t h e McAfee Virult ex im v iratus scanner romKnife( . Mac,TM) you h ave t he Ru X Pant her is t he e Sw iss Ar fmy ; for pow er user s w h o w ant t o v scanx com man dline v iru s scan ner inst alled at / usr / local/ vscanx / v scanx cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader .s You deepcan in side Mac OS t ak e adv ant ag eof t h is and hav e y our d isk scanned for vir uses fr om cron in of out of t heir X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et st t head e most fr om t heGUI . This is a b onus t hat t he v iru s scan ner w ill r un no mat t er wh o's log ged syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e ecom t er or ev en if n obody is. win ellt oont hyou r wpu ay. To enab le t his, delet e t he . Vir ex Login it em f r om list y our St ar t up I t em s in t heAccount s p r ef er ence pan el. Th en ad d a line t o you r cron t ab f ile t o execut e/ usr / local/ vscanx / v scanx w h en ev er y ou'd lik e. Not e t h at y ou need t o giv e t he f ull p at h t o v scanx since it isn' t inst alled in one of t hest and ard bin ary direct or ies, such as / usr / bin.

8.6.2 Additional configuration settings The cron com m and on Mac OS X h as been enh anced com par ed t o t hose f ound onsom e ot her Unix v arian t s. For ex am ple, y ou can use t he follow ing mor e r eadable ent riesin t h e t im e field: Day s of t h e w eek can be ind icat ed by t h eir ab br ev iat ed nam e: sun, m on , t ue, w ed, t h u, f ri, sat . Mon t hs can be ind icat ed by t h eir ab br eviat ed nam e: jan , f eb , m ar, apr , m ay , ju n, ju l, au g, sep , oct , nov , d ec. You can ind icat e st ep v alu es by using a fr act ion n ot at ion su ch as 8 - 17/ 2 w hich, if it w er e in t he hour s f ield, w ould m ean 'ev er y t w o hour s b et w een t he hou rs of 8a. m . and 5 p. m .'

Som e special st r ing s can b e used in cron t ab f iles. Table 8 - 1 h as a list of t hese st r ing s. Ex cep t f or t he last one, all t h ese st r ings r eplace t he t ime f ield s. The last , @AppleNotOnBattery, can be used in f ron t of a com m and t o pr event it f r om r unn in g w h en y our lapt op is disconnect ed f r om AC pow er . This ensur es t hat y ou d on' t r un disk - int ensivet asks w hen y ou need y our bat t er y t he m ost . For exam ple, if y ou w r it e a scr ipt t hat cop iesall y our f iles f r om y our ~ / Docum ent s f older t o som e saf e st or age locat ion t hat y ouw an t t o r un only w hen you r Pow erBook is p lugg ed in, you w ould use t he follow ingcron t ab ent ry : • 0 * * * * Table of Content s @AppleNotOnBattery ~/bin/copyfiles • Review s •

Reader Rev iew s



Er r ata

• • •

Academic Ten Things About Pant Tab le 8 .1I Dig . Specia l her st r i ng s t h at ca n be use d i n a cr ont ab Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

St r in g

By Jam es Duncan Davidson

De scr ip t ion

Equ iv al en t To

Run w hen t he system r eboots @rPub eboot Dat e: Decem ber 2 00 3 Run on m idn igh t of Januar y 1 @y ear I SBN: ly 0- 59 6- 005 00 -8 Run at m idnight on the fir st of t he 0 0 1 1 * @m on Pages: thly 32 6 m on th 0 0 1 * @week ly Run at m idnight each Su nday 0 0 * * 0 @daily Run ev er y day at m idn igh t 0 0 * * * 0 * * * * @hour ly Run ev er y h our at the top of t he h ou r @AppleNotOn Bat tery Prev ent s comm and fr om r unn in g if the Ru nning Mac OS X Pant her issyt he ult imis at eon Swbatter iss Ar my st em y Knife( TM) ; for pow er user s w h o w ant t o Pub lish er: O'Reilly

cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

What About at, batch, atq, and atrm? I f you 'r e com ing t o Mac OS X fr om an ot her Unix syst em , y ou m ay b e fam iliar w it husing t h e at , b at ch, at q , or at r m com m ands for scheduling t ask s. These com man ds ex ist in Mac OS X, but t hey hav e b een disabled b y Apple d ue t o pow er m anagem ent concer n s. I f y ou r eally need t hese com m ands, y ou m ust enab le t he at r un com m and in/ et c/ cr ont ab, b ut do so at y our ow n r isk .

8.6.3 Sleep and cron The cron sy st em w on't execut e w h ile y our sy st em is asleep. Th is is because t he CPU is pow ered dow n and t h er e's j ust en ough hap pening in you r m ach in e t o keep t h e cont ent sof m em or y r eady w hen you w ant t o wak e t h e syst em up . Som et im es t h is isn' t a big deal. For exam p le, if y ou use a cron t ab line t o r emin d y ou t ost r et ch ever y hou r, t hen you w on' t m ind it not r u nning . How ev er , for ot her t asks t hat y ou w ould lik e t o hav e r un , it can creat e a bit of a pr oblem . The b est piece of ad vice ist o t im e t ask s t hat need t o be r u n w h en y our sy st em is less likely t o be in sleep m od e.

8.7 Changing periodic's Execution Time By def ault , per iod ic r u ns daily t ask s at 3: 15 a. m ., w eek ly t asks at 4: 3 0 a.m . , an dm ont hly t ask s at 5 y ou ar e soun d asleep . I f you r syst em isn' t on 24 hou r s a d ay, you m ight consid er chan ging t he t im e idle. For exam ple, if y ou w an t ed t h e daily t ask s t o r un d ur in g you rlun ch h our , t he week ly t ask s on M t he / et •a. m ., you w ould Tableedit of Content s c/ cr ont ab f ile t o m at ch Ex am ple 8- 5. Since t h e syst em cron t ab d oesn 't •

Review s



Reader Rev iew s

Exa m pl e 8Er-r ata 5 . Th e syst e m cr on t a b w it h t h e per i odic t a sks se t a t a m or e r e • •

15 • •

Academic

12

* root Ten *Things *I Dig About Pant her

periodic daily0

10

*

*

2

root

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8.8 Further Explorations For m ore in for m at ion about t he t echn olog ies in t h is ch apt er , see t h e follow ingr esour ces:



App leScr ipt : The Definit iv e Gu id e, b y Mat t Neu bur g ( O' Reilly & Associat es, 20 03) Table of Content s

• You m ay alsoReview be ints er est ed in con su lt ing t he f ollow ing m anp ages: •

Reader Rev iew s

• • • •

Er r ata

per iod icAcademic cron

Ten Things I Dig About Pant her Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

cron t ab

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 9. Preferences and Defaults Whenev er you cust om ize t he behav ior of a Mac OS X applicat ion, such as chang in g t he def ault fon t or color s or t he w indow s t hat ar e v isib le, t he v ar iou s chang es t hat you m ak e are sav ed in t o a p r ef er ence f ile f or t h at app licat ion. This is in con t r ast w it h Window s w h er e app licat ion •pr efer en ces tTable of Content s ed in t o t h e m onolit hic r egist ry . By hav in g each applicat ion st or e it s y pically ar e sav •pr efer en ces in Review s a separ at e f ile, t h e ov er all sy st em is m ad e mor e r obu st t h an if all t h e pr efer en ces •w ere in one big Reader s efer en ce g et s cor r up t ed , it is less likely t o aff ect t he sy st em an d file.Rev I f iew a pr •t y pically will Er ata on ly t he ap plicat ion t h at uses t hat pr efer en ce. Th e desig nat ed locat ion f or afrfect •pr efer en ce dat Academic a is t he Libr ar y/ Pr efer ences f older in each of t he f ilesy st em d om ain s. ( Review t he Lan d, About f or mPant or e her infor m at ion about filesy st em dom ains. ) •Ch apt er 2, Lay TenofThings I Dig •

Scheduling Tasks in Pant her

Man y Mac X Pap plicat Running Ma cOS OS X ant he r ion s, in clu ding all t he applicat ions App le pr ovid es, g o bey ond ju st using t he Libr ar y/ Pr efer ences d irect or y and st or e t heir pr efer en ces in t he defau lt s sy st em . Th is sy st em, By Jam es Duncan Davidson w hich is oft en ref er r ed t o as t h e defau lt s dat abase , is m ade of each applicat ion' s pr eferences st or ed in an XML- based pr opert y list ( plist ) file in t he Pr ef erences f older . By using t he defau lt s er: O'Reilly systPub emlish , app licat ions can ut ilize code in t he operat in g sy st em t o m anag e pr efer en ces inst ead of 2 00 3 ow n pr ef er ence- han dling code. Add it ion ally , y ou can u se t he defau lt s hav Pub ing Dat t o e:prDecem ovidebert heir com man d- line ool o -8 r ead an d wr it e d at a int o t he dat abase. I SBN: 0- 59 t6005 t00 Pages: 32 6

Befor e t he t r ansit ion t o Mac OS X, user s used t o back up t h eir p ref er ences regu larly t o a f loppy disk . This w as d one because t he pr ef erences w ould get cor r upt ed at t he dr op of a h at . By hav ing a st ab le backu p f loppy at t h e r ead y, it w as pr et t y easy t o g et ever yt hing back t o t he w ay it w as supp osed t o b e simp ly by copy ing t he p ref er ences back int o place. W it h Mac OS X, ev en t houg h pr efer en ces d on't t end t o get cor ru pt ed as oft en, nor d o t h ey h ave as devast at in g an eff ect w hen Ru nning OS Pantt o her is et he e up Swsiss for en pow w ant t o t hey d o, Mac it is st ill Xeasy m ak quult ickim b at ack of Ar t hemy ~ / Knife( Libr arTM) y/ Pr;efer ceserd user irectsorwy.h oFor cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side exam ple, y ou can d rag t h e ~ / Libr ar y/ Pr efer en ces f older t o a USB k ey fob, upload t hem Mac t o y OS our X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of at heir iDisk, or even use Backu p 2 ( p art of t he . Mac set of t ools) t o b ack t hem up t o you r iDisk or CD syst em .. You m ay not sh beould a Mac w hen sten ar ,t w t his book ut need once you e or r ead or DVD I n fact , y ou do tgu hisrur eg ular ylyou . Th henev er, ybou t o r 'v est e t hite, you 'll b e w onenyou w ay. prell efer cesr f or an applicat ion, t hey are easy t o find .

9.1 Property Lists A p r opert y list ( plist ) file is a t ex t f ile t hat can r epr esent all k inds of d at a in a st r uct ur ed for m . Ther e ar e t w o f or mat s for a pr oper t y list file: an older ASCI I - based pr opert y list for m at ; an d t he new er XML- b ased pr oper t y list f orm at . W e saw an ex am ple of t h e older ASCI I pr oper t y list er of4 Content w h en w •for m at in Ch apt Table s e look ed at St ar t up I t em s. Th is is one of t h e few p laces w her e you 'll see t he older f orm at in use. I n m ost p laces, inclu ding t h e default s dat abase, y ou' ll see t h e new er • Review s XML for m at . A sim p le XML pr opert y list used b y t he b at t ery m enu ext ra is show n in Ex am ple 9- 1. • Reader Rev iew s I f you 'v e ever look ed at HTML or ot h er XML dialect s, t he basic st ru ct u r e of t his f ile sh ould look • Er r ata som ew hat fam iliar . •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Exa m pl e 9 - 1 . Th e com .ap ple .m e n ue xt r a.ba t t e r y.pl ist fi le Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

ShowPercent Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS NO X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e ShowTime w ell on you r w ay. YES

The st r uct u re of a pr oper t y list f ile cont ain s a plist r oot elem ent t hat con t ain s one or m ore d at a elem ent s. I n Ex am ple 9- 1, as in all p rop er t y list s used by t h e defau lt s sy st em, t he child elem en t of plist is nam ed dict ( wh ich st and s for dict ion ary —a map ping bet w een nam es and v alues) and cont ains a set of k ey an d st r ing elem ent s. Each set of k ey and st ring elem ent s defines a nam ev alue pair . I n essence, t he ex amp le file can b e int er pr et ed as " t h is file cont ains a dict ionar y in w hich t he k ey Show Per cent is set t o NO an d t he k ey Show Tim e is set t o YES" .

Unless y ou hav e m odified t he b at t ery menu ext ra, you m ay not hav e t h is or m any ot h er plist f iles t hat are m ent ion ed in t his chap t er . Th e plist f iles for a pr efer en ce dom ain t y pically ar e cr eat ed only on deman d.

The XML element s t hat can ap pear in a pr oper t y list f ile ar e list ed in Table 9 - 1. One t hin g y ou m ight not ice in Ex am ple 9- 1 is t hat ev en t hough t h er e ar e t h e t r ue an d f alse values t h at can

app ear as t ags in t he XML file, t he Sh ow Per cen t an d Sh ow Tim e k eys hav e st rin g v alues set t o NO and YES r espect ively . I t 's u nf ort u nat e, b ut t his inconsist en cy cr ops u p in m any of t he defau lt s k ey s u sed by ap plicat ion s and is somet h in g you should be aw ar e of .



Why UseTable XML? of Content s



Review s ped Rev on iew the • App le has j um Reader s XML ban dw agon w it h t he pr op er t y list f ile for m at . XML

d for m at t hat is easy f or t ools t o use and comp r eh en d. I n • pr om ises a st Er randar ata a t ex t - based f or mat w hich means t hat it 's r elat ively easy t o edit ( or at • add it ion , it ' sAcademic load in t oI Dig a t ext edit or )her . How ever , not all XML docum ent s, w it h all t h ose • least easy t o Ten Things About Pant ang le br ack et s and t ag s and at t r ibut es alon g w it h schemas and nam espaces, ar e Scheduling Tasks in Pant her easy for a hu m an t o edit . Nop e. Not at all. Running Ma c O S X P ant he r •

ByThe Jam es Duncan Davidson p r im ar y adv ant age

of t he default s sy st em as it st an ds isn't t h at it mak es pr efer en ces easy t o r ead and ed it . The reason is becau se it ' s easy t o u se t ools ( lik e t hePub Prop er O'Reilly t y List Ed it or) t o edit pr efer en ces in t he d ef ault s sy st em wit h out hav in g t o lish er: r unPub t he ap plicat ion2 t00 h 3at w r ot e t h em . Dat e: Decem ber I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Tab le 9 -1 . Pr oper t y li st e le m en t s Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Ele m en t De scr ip t ion cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing inn er w ork s of Pant f or t h ose w h o w ant t o g et t h e most out of t heir plist Root t he element of ing a proper t yherlist. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w Aay. diction ar y t o hold oth er dat a elem tents in k ey value f or m. The

dict

cont ent s of th is element ar e a set of < key> elem ents, f ollowed by th e data associated wit h the key .

arr ay

Contains a set of dat a v alues in a part icular order . The con tents of th ese elem ent s are simply a list of data elem ents.

st ring

Contains a data value as a str ing.

r eal

Contains a data value as a r eal num ber, such as 8 .1 4.

integer

Contains a data value as an in teger , such as 10 or - 9.

date

Contains data t hat r epr esen ts a date in I SO 8 601 ( a standar d f or m at for dates) , su ch as 2003 - 10- 24T08: 00: 00Z which r epr esen ts 8: 00pm Oct ober 2 4th , 20 03 ( t he t im e Panther was r eleased to the public) .

tr ue

I ndicates that th e v alue is tr ue.

f alse

I ndicates that th e v alue is false.

data

Contains arbit rar y data.

9.2 Where Preferences are Stored As m ent ioned ear lier, t he def ault s dat abase st ores p refer ence dat a in f iles locat ed in t h e Libr ar y/ Pr efer ences f older of a f ilesy st em dom ain . For exam ple, w hen a p r ef er ence app lies t o a single u ser , it is w r it t en t o t h e ~ / Libr ar y/ Pr efer en ces f older . I f t he pr efer ence applies t o all user s it is of w rit t en t os t he / Libr ar y/ Prefer ences f older . •on a sy st em , Table Content •

Review s

Each of t he f iles in t h e default s dat abase t ak es a u niqu e nam e, kn ow n as a pr efer en ce dom ain, • Reader Rev iew s det er min ed by t he app licat ion t hat uses it . The Apple- r ecom m en ded n amin g conv ent ion for • Er r ata pr efer en ce dom ains is t o use t he r ev er se I nt er net dom ain nam e of an app licat ion' s v en dor , • follow ed by t Academic he nam e of t he ap plicat ion . For exam ple, all t he plist f iles used by t he v ar iou s •App le- sup plied Tenapp Things Dig About Pant her es t hat begin wit h com .ap ple, f ollow ed by t h e nam e of licatI ions use filenam •t he applicat ion, Scheduling Tasks in Pant her ex t ension. Ex am ple 9- 2 sh ows a par t ial com m and- line f ollow ed by t h e . plist Running Ma c O S X P ant he r list in g of t he ~ / Libr ar y/ Pr efer en ces d irect or y for a f reshly creat ed user : By Jam es Duncan Davidson

ExaPubmlishpler:e O'Reilly 9 - 2 . Th e ~ / Libr a r y / Pr e f er e nce s di r ect or y Pub Dat e: Decem ber 2 00 3

$ls -lI SBN:

0- 59 6- 005 00 -8

Pages: 32 6

total 96

drwx------ 4 norman

norman

136

8 Dec 22:07 ByHost

drwx------ 3 norman norman 102 8 Dec 22:06 Explorer Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w1eak , and g en er ally r ev 975 u p t heir Mac.22:07 This b com.apple.Bluetooth.plist ook t ak es reader s deep in side Mac OS -rw------norman norman 8 Dec X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m not be anorman Mac gu ru 475 w hen 8y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e -rw------1 ay norman Dec 22:06 com.apple.HIToolbox.plist w ell on you r w ay. -rw------- 1 norman

norman

557

8 Dec 22:07 com.apple.MenuBarClock.plist

-rw------- 1 norman

norman

9795

8 Dec 22:07 com.apple.dock.plist

-rw------- 1 norman

norman

1294

8 Dec 22:08 com.apple.finder.plist

-rw------- 1 norman

norman

1040

8 Dec 22:08 com.apple.recentitems.plist

-rw------- 1 norman

norman

741

-rw------- 1 norman

norman

5004

-rw------- 1 norman

norman

456

8 Dec 22:07 com.apple.scheduler.plist 8 Dec 22:07 com.apple.sidebarlists.plist 8 Dec 22:07 loginwindow.plist

When y ou look in t o y our ow n ~ / Libr ar y/ Pr efer en ces d irect or y, you 'll see m ore files t han t his, bu t by ap ply in g t he n aming conv ent ion r ules, y ou should be ab le t o easily sor t out w h ich pr oper t y list file b elong s t o wh ich app licat ion. Pr ef erences ar e w r it t en int o t he Libr ar y/ Pr efer ences f older of a f ilesy st em dom ain . Wh en an app licat ion sear ches for t he v alue of a pr ef erence it can be given a v alue f r om t he user , local, net w or k, or syst em f ilesyst em d omains. Th is m ean s gener al set t in gs t h at ap ply t o all user s can be d ef ined at t h e local or net w or k dom ain lev el. Set t in gs t h at ap ply t o a sin gle user ar e w r it t en

t o t he u ser dom ain so t h at t h ey r em ain separ at e f rom t he p refer ences of ot her users.

9.2.1 Host-based Preferences Becau se Mac OS X can mou nt Home folder s fr om a ser v er and a user m ight log in t o sever al dif fer en t m achines w it h his accou nt , t he def ault s dat abase pr ovid es a m ech anism for ap plicat ion s m at ion on a perm achine basis. Th is allows applicat ions, such as t he on e t hat •t o st or e in forTable of Content s pr ov ides iDisk sy nchr onizat ion , t o k eep d ist inct set t in gs depend ing on wh ich m achine y ou are • Review s using . To k eep t h ese set t ings d ist in ct , t hey ar e k ep t in a By Host f older w it hin t he • Reader Rev iew s Libr ar y/ Pr efer ences f older . They t oo use a n amin g conv ent ion consist ing of t h e r ev erse I nt er net • Er r ata dom ain nam e of t he vend or, t he ap plicat ion nam e, t h e Et her net MAC ad dr ess of t he host , an d • Academic t hen t he plist f ile ex t ension. Ex am ple 9- 3 sh ows a list of t he files you m ight f in d in t h e By Host • Ten Things I Dig About Pant her fold er . •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Exa m pl e 9 - 3 . Th e con t e nt s of t he B yH ost f ol de r lish er: O'Reilly $lsPub ~/Library/Preferences/ByHost Pub Dat e: Decem ber 2 00 3

com.apple.HIToolbox.000a9599e492.plist I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

com.apple.iTunes.000a9599e492.plist com.apple.idisk.000a9599e492.plist com.apple.systemuiserver.000a9599e492.plist Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em Global . You m ayPreferences not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e 9.2.2 w ell on you r w ay. I n addit ion t o t he pr efer en ces t h at y ou see in Ex am ple 9- 2, a hidd en f ile n amed. GlobalPref er ences. plist in t h e ~ / Libr ar y/ Pr efer en ces f older cont ains pr ef er ences used b y all app licat ions. I t con t ains d at a t h at af fect s all app licat ions eq ually, su ch as t h e locale of t h e syst em in use. Ex am ple 9- 4 sh ows t his f ile f or a fr esh ly cr eat ed u ser .

Exa m pl e 9 - 4 . Th e .Globa lPr e fe r e nce s f il e



AppleAntiAliasingThreshold 8 AppleLanguages

en ja fr •

Table of Content s



Review sde



Reader Rev iew s



Er r ata es



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

it nl

Running Ma c O S X P ant he r

By Jam es Duncan Davidson sv Pub lish er: O'Reilly

no

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005da 00 -8 Pages: 32 6

fi pt

zh_CN Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS zh_TW X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e ko w ell on you r w ay.

AppleLocale en_US

These pr efer en ces cor respond t o some of t he set t ings y ou can ap ply in t he Sy st em Pref er ences app licat ion. For ex am ple, Ex am ple 9- 4 sh ows t he ar r ay of st rin gs associat ed w it h t h e App leLangu ages k ey . The st r ings in t h e ar ray cor r elat es t o t he lan guag e packag es you can ch ose fr om in t h e I nt ern at ional p ref er ence pan el ( sh ow n in Figur e 9- 1 ) .

9.2.3 Non defaults-based Preferences App licat ion pr eference f iles t h at ar en' t p art of t he default s d at abase can also be st or ed in t he ~ / Libr ar y/ Pr efer en ces f older . These pr ef erences t end t o be w r it t en in a p rop riet ar y f orm at and ar e not easily r eadable ex cept t hr oug h t he app licat ion t hat w r ot e t hem .

Ty pically , ap plicat ion s t hat w rit e non- d ef ault s d at abase pr efer en ces ar e older Car bon based app licat ions t hat mig rat ed t o Mac OS X fr om Mac OS 9 an d alr eady h ave t heir ow n p ref er ence han dling cod e. These applicat ions ar e t r uly an t isocial because t h ey can only r un in Classic m ode, and t h ey w r it e t h eir op aque p r ef er ence f iles int o Mac OS 9' s / Sy st em Folder/ Prefer ences f older .



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

9.3 Reading and Writing Preferences Ther e ar e t w o w ay s in w hich t o r ead and w r it e inf orm at ion in t he d ef ault s dat abase:

• •

Wit h t he Pr op er t y List Edit or ( / Develop er / Ap plicat ion s) in st alled as par t of t he Xcode Tools Table of Content s

Review From t he comsm and lin e using t he defau lt s com m and- lin e ut ilit y



Reader Rev iew s



Er r ata



Academic

•Figu r e •

Things La I Dig About Pant se her ct ion of t h e I n t e r na t i ona l Pr e f er e nce pan e l 9 - Ten 1 . The ng ua ge Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

9.3.1 Property List Editor The Pr op er t y List Edit or ( / Develop er / Ap plicat ion s/ Ut ilit ies) , show n in Figur e 9- 1 , is a GUI app licat ion inst alled w it h t he Xcode Tools t hat let s y ou view an d edit pr oper t y list files. When y ou f ir st open a pr op er t y list w it h t he Prop er t y List Edit or , y ou' ll not ice t h at t h e t op r oot elem ent is collap sed. Click t he d isclosu re t rian gle nex t t o it an d y ou can d rill t hr ough t h e var ious pr efer en ces.

As show n in Figur e 9- 2 , t h er e ar e t h ree colum ns t o t h e Prop er t y List Ed it or. These are:

Pr oper t y List List s t h e k ey s of t he pr opert y list ; t hat is, t he cont ent s of t he t ags of a plist XML file. Table of Content s

• •

Review s



Reader Rev iew s

• Class

Er r ata



Academic

List s t hTen e classes or each Things Iavailable Dig About fPant her k ey definit ion . This af fect s t he value t ags in t he XML f ile as d ef ined in Table 9 - in 1. Pant her Scheduling Tasks

• •

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Valu e Pub lish er: O'Reilly

t hber e valu PubCon Dat e:t ains Decem 2 00 3 e

for t he pr efer en ce key .

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 9 - 2 . The Pr ope r t y Li st Edit or a ppl ica t i on

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

To v iew t he XML ver sion of t h e plist f ile, click t he D um p but t on in t he upp er - r ight corn er of t he Pr oper t y List Edit or 's w ind ow . You can 't edit t h e XML sour ce here, b ut you can see t h e ef fect s of t he ch anges t h at y ou mak e in t he t op p ar t of t h e w in dow . To edit an it em , d ouble- click t h e it em' s nam e t h at y ou w ant t o edit , t yp e in t he new v alue, and t hen hit Ret ur n t o accep t t h e new v alue. •

Table of Content s



Review s

Rev iewCommand-Line s 9.3.2 The Reader defaults Tool • •

Er r ata



Academic

The defau lt s t ool giv es you easy access t o t h e defau lt s syst em f rom t he com m and lin e, let t in g • Things I Dig About Pant her y ou r ead andTen w rit e t he p refer ences f or an y Mac OS X ap plicat ion on t he sy st em . As wit h an y •com man d- line Scheduling in Pant u t ilit y , yTasks ou can w r ither e shell scr ipt s t o r un sev er al defau lt s comm and s Running Ma c O S X P ant he r aut om at ically, en abling you t o set an applicat ion's behav ior any w ay y ou' d lik e in an in st an t . By Jam es Duncan Davidson

9.3.2.1 Pub lishReading er: O'Reilly preferences Pub Dat e: Decem ber 2 00 3

The b asic I SBN:usage 0- 59 6- of 005t00 he-8 defau lt s com m and for readin g an app licat ion' s p refer ences is: Pages: 32 6

defaults read domain [key]

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o w her edom ain is t he pr op er t y d omain t hat y ou wan t t o r ead t h e pr eference f r om, and k ey is an cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS opt ion al k ey nam e t h at let s y ou see t h e valu e of a single k ey for a pr efer en ce dom ain. Since a X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir pr efer en ce key can con t ain m an y diff er ent k in ds of dat a, t he ou t pu t f rom t his com man d will v ar y syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e depend in g on t he k ind of dat a t hat is associat ed w it h a p ref er ence k ey . Ex am ple 9- 5 sh ows t he w ell on you r w ay. out p ut fr om r eading t he pr ef er ences for a dom ain.

Exa m pl e 9 - 5 . Usi ng t h e def a ul t s com m a nd $defaults read com.apple.menuextra.battery {ShowPercent = YES; ShowTime = NO; }

Ex am ple 9- 6 sh ows how t o r ead a sing le key f r om a d omain , in t his case a boolean valu e.

Exa m pl e 9 - 6 . Usi ng t h e def a ul t s com m a nd specif yi ng a k ey $defaults read com.apple.menuextra.battery ShowPercent NO

St r ings and num ber s w ill be show n like Boolean v alu es. Th e only cav eat is t hat a st r ing cont aining a sp ace w ill be sur r ound ed by quot es. An arr ay associat ed w it h a pr op er t y k ey w ill be out p ut as a list of it em s w it hin a set of p arent h eses, and t he it em s ar e com ma- d elim it ed.

Ex am ple 9- 7 sh ows t he m ost r ecent ly used app licat ions as st ored in t he com .ap ple. r ecent it em s pr efer en ce dom ain.

Exa m pl e 9 - 7 . Re cen t app li cat ion s st or e d in t h e com .ap ple .r ece nt it em s dom a in $defaults read com.apple.recentitems apps •

Table of Content s



Review s



Reader Rev iew s

( • • • •

Er r ata "/Applications/Utilities/Terminal.app", Academic Ten Things I Dig About Pant her 2.0/InDesign 2.0.2", "/Applications/Adobe InDesign Scheduling Tasks in Pant her

Running Ma c O S X P ant he r "/Applications/System

Preferences.app",

By Jam es Duncan Davidson

"/Applications/Preview.app", Pub lish er: O'Reilly

"/Applications/QuickTime Player.app",

Pub Dat e: Decem ber 2 00 3

I SBN: 0- 59 6- 005 00 -8 "/Developer/Applications/Utilities/Property List Editor.app", Pages: 32 6

"/Applications/Font Book.app", "/Applications/Safari.app", "/Applications/Utilities/StuffIt Ru nning Mac OS X Pant her is t he ult im at e SwExpander.app", iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS "/Applications/Can X's cor e, r evealing t he inn erCombine w ork ing sIcons.app" of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e ) w ell on you r w ay.

A d ict ion ary associat ed w it h a k ey is out p ut as a set of nam e/ v alue pair s sur r ound ed by cu rly br aces. Ex am ple 9- 8 sh ows a dict ionar y associat ed w it h t he I n box View er At t r ibut es p r ef er ence in t he com .ap ple. m ail p r ef er ence dom ain.

Exa m pl e 9 - 8 . A d ict ion ar y of v al ue s associa t e d w it h a pr e fe r en ce $defaults read com.apple.mail InboxViewerAttributes { DisplayInThreadedMode = yes; SortOrder = "received-date"; SortedDescending = NO; }

You' ll also see t his f orm at used w hen y ou list ou t all t he def ault s f or a p refer ence dom ain.

Ex am ple 9- 9 sh ows t he cont ent s of t he com .ap ple. syst em uiser ver d om ain , w hich con t r ols t he m en u ex t r as show n in t he up per- r igh t cor ner of t he scr een.

Exa m pl e 9 - 9 . A d ict ion ar y ou t pu t of t he p r ef er e nces i n t h e com .ap ple .sy st em u iser v er dom a in $defaults read com.apple.systemuiserver •

Table of Content s



Review s



Reader Rev iew s

{ •

Er r ata menuExtras = (



Academic



Ten Things I Dig About Pant her "/System/Library/CoreServices/Menu Extras/Bluetooth.menu",



Scheduling Tasks in Pant her

Running Ma"/System/Library/CoreServices/Menu c O S X P ant he r

Extras/AirPort.menu",

By Jam es Duncan Davidson

"/System/Library/CoreServices/Menu Extras/Volume.menu", Pub lish er: O'Reilly

"/System/Library/CoreServices/Menu Extras/Battery.menu",

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

"/System/Library/CoreServices/Menu Extras/Clock.menu",

Pages: 32 6

"/System/Library/CoreServices/Menu Extras/User.menu" ); } Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir You em can. also r ead t he be p refer ences f orwan licat ion sing ,itbsut n am e inst t r y it ing t o f'lligur syst You m ay not a Mac gu ru henapp y ou st ar t tby hisubook once youead 'v e of r ead , you b ee out s pryou efer ce dom ain. Th e sy nt ax for t his usage is: w ell iton r en w ay. defaults read -app appname

For exam ple, t o r ead t he pr ef erences for Mail, you w ould use t h e follow ing comm an d: $ defaults read -app Mail

9.3.2.2 Writing preferences The b asic sy nt ax t o w r it e pr efer en ces t o t he d ef ault s d at abase is: defaults write domain key value

w her edom ain is t he pr efer en ce dom ain t o w r it e t he p ref er ence t o, k ey is t he pr efer en ce nam e,

and v alu e is t he t o con t ent t o associat e w it h t hat k ey . For ex amp le, t o set Ter min al t o u se a blink ing cur sor , you w ould use t he follow ing com m and : $ defaults write com.apple.terminal BlinkCursor YES

•I f you ent er tTable h is com of Content m and sint o a Ter m in al w indow and t hen open a new win dow , y ou' ll see t h e cur sor blink ing. To r ev er se t his set t in g, u se t he f ollow ing com man d: • Review s • •

Reader Rev iew s

$ defaults write com.apple.terminal BlinkCursor NO Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

You can u se t w o com man ds t o w rit e pr opert ies t o an arr ay . The fir st associat es an ar ray w it h a By prJam eferesenDuncan ce keyDavidson and r eplaces an y pr evious valu es associat ed w it h t hat key . This com m and has t h e syn t ax : Pub lish er: O'Reilly

defaults domain key -array element1 element2 element3... Pub Dat e: write Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

To ad d new elem ent s t o t he end of an ar r ay for a k ey w it h out replacing all t he elem en t s in t he ar r ay, u se t he - ar r ay- ad d op t ion wit h t h e follow ing syn t ax: Rudefaults nning Mac write OS X Pant domain her iskey t he ult -array-add im at e Sw isselement1 Ar my Knife( element2... TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. You should alw ays m ak e sur e t hat t he applicat ion f or w hich you ar e w r it ing pr efer en ces isn' t r un ning w hen you use t h e defau lt s comm an d. A ru nning app licat ion m ig ht w rit e som et hing t o t he d ef ault s d at abase t hat w ill ov er w r it e any chan ges y ou m ay h ave mad e.

9.3.2.3 Reading and writing host-specific preferences To w or k w it h host - specif ic pr efer en ces, y ou can use t h e - cur r en t Host or - host op t ionss t o t he defau lt s com m and. For ex am ple, t o read t he p ref er ence fr om t he com .ap ple. id isk p r ef er ence dom ain on t he m achine t h at y ou ar e w ork ing on, you w ould use t h e follow ing com m and : $ defaults -currentHost read com.apple.idisk

9.3.2.4 Reading and writing global preferences To access t he glob al pr efer en ces ( t h ose associat ed w it h all app licat ions) use t he - g op t ions w it h

t he defau lt s com m and, as show n in Ex am ple 9- 10.

Exa m pl e 9 - 1 0 . Rea din g g loba l pr ef e r en ce s $defaults read -g { •

Table of Content s



Review s AppleAntiAliasingThreshold = 4;



Reader Rev iew s



Er r ata AppleICUTimeFormatStrings = {



Academic



Things I Dig About Pant her 1 =Ten 'HH':'mm';



Scheduling Tasks in Pant her

Running Ma2 c O=S X'HH':'mm':'ss'; P ant he r By Jam es Duncan Davidson

3 = 'HH':'mm':'ss z'; Pub lish er: O'Reilly

4 = 'HH':'mm':'ss z';

Pub Dat e: Decem ber 2 00 3

};I SBN:

0- 59 6- 005 00 -8

Pages: 32 6

AppleKeyboardUIMode = 2; ... Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

9.4 Determining Preference Keys Ed it in g pr ef er ences in t he def ault s dat ab ase is a chicken- and- egg pr oblem . Wit hou t k now ing t h e k e set a p r ef er ence f or, it 's h ard t o cu st omize an ap plicat ion 's b eh avior . Set t ing pr efer en ce key s r ando w on' t accom plish m uch ex cep t t o fill y our defau lt s dat abase w it h useless dat a. I n or der t o k now w h , yof ouContent hav e st o d o a bit of r esear ch. Th ree m et hods will h elp y ou det er m ine t h e pr efer •k ey s can be set Table k• ey s an app licat ion m ig ht use: Review s • •

Reader Rev iew s r ata Look ingErat t he p refer ence plist f iles aft er y ou' ve cust om ized an ap plicat ion

• •

Academic Ten I Dig About Pant her Searchin g tThings he w eb



Scheduling Tasks in Pant her

Digg ing t he Running Ma c O S int X Poant he rapp licat ion

it self

By Jam es Duncan Davidson

The f ir st of t hese m et h ods is f airly self ex planat ory . Sim ply f iddle w it h t he v ar ious set t ings of t he app licat ion and w at ch t he plist f ile t o see w hat ch anges. On ce you hav e an idea of t h e w ays t hat key lishyer: namPub ed, ouO'Reilly can u se t he defau lt s find com m and. This com man d sear ch es t hr ough t h e defau lt s dat ab e: Decem berefer 2 00en 3 ce f ile and dat a associat ed w it h any par t icu lar st ring . For exam ple, if af t er andPub r etDat ur ns t h e pr t w eakin g t h0e 59 opacit y of I SBN: 6- 005 00 -8 y our Ter m in al w indow s, y ou sear ched f or t h e st ring Op aque, y ou w ould find k ey in Pages: t h e com 32 6 . app le. Term inal dom ain, as sh own in Ex am ple 9- 11.

Exa m pl e 9 - 1 1 . Sea r chi ng f or a st r i ng in t h e de fa u lt s d at a ba se $ defaults Ru nning Macfind OS XOpaque Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Found 1 rkeys in tdomain 0.95425927639007 X's cor e, evealing he inn er'com.apple.Terminal': w ork ing s of Pant her f or t h{TerminalOpaqueness ose w h o w ant t o g et t h e= most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. I f ot her app licat ions used k ey s w it h t he st r ing Op aque, t h ey wou ld also b e list ed. The second of t hese met h ods is also st r aight f or w ard —using t he w eb. Th e Mac OS X Hin t s w eb sit e ( w w w .m acosxh in t s. com / ) has a wealt h of infor m at ion on way s t o hack t h e defau lt s dat abase. Goog le w w w .google.com / ) sear ch es can t u rn up q uit e a lot of useful infor m at ion as w ell. The t hir d of t h ese m et hod s is a b it m or e diff icu lt and r equir es lookin g inside t he app licat ion' s bu ndle using t he st r ings com m and. The st r ings com m and exam ines a binar y file an d p r in t s out all t h e st rin fin ds in a b in ar y. For ex am ple, t o look inside t he Dock 's ex ecu t able, you w ould use t h e comm an d sh in Ex am ple 9- 12.

Exa m pl e 9 - 1 2 . Exa m in in g a bin ar y f or p r ef er e nce k ey s $strings /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock __dyld_mod_term_funcs __dyld_make_delayed_module_initializer_calls The kernel support for the dynamic linker is not present to run this program. showhidden

showshadow DoesPointToFocusCursorUpdate ClientMayIgnoreEvents com.apple.finder •en_US

Table of Content s



Review s

trashlabel • Reader Rev iew s •

Er r ata

owensdock • Academic •

Ten Things I Dig About Pant her

dock •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

.dock By Jam es Duncan Davidson

AppleShowAllExtensions Pub lish er: O'Reilly

AppleShowAllFiles Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

notfound Pages:

32 6

trashfull trashempty Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o finder cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's ...cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The r esult is a lar ge nu mb er of st r ing s, w hich p rob ably don 't hav e any t hin g t o do w it h p ref er ence se at all. But m an y of t hese st ring s ar e used as pr ef erence k eys an d values in t he plist f ile. This m et ho becom es a sleut hing gam e t h at is b oring f or some and imm ensely in t erest ing t o ot hers. I f you locat e un docum ent ed p r ef er ences, keep in m ind t hat t hey m ay go aw ay or be renam ed in a f v er sion of t he app licat ion, som et hing t h at h as been k now n t o happ en in t he p ast ( esp ecially w hen c hack er s h ave unear t hed set t ing s t hat Apple w ou ld r eally rat h er keep pr iv at e) .

9.5 Further Explorations For m ore in for m at ion about t he d ef ault s sy st em , see t he PDF book t it led Sy st em Over view an d locat ed at / Developer/ Docum ent at ion/ M acOSX/ Concep t ual/ Syst em Ov er v iew / Sy st em Ov erv iew . pd f. •

Table of Content s



Review s

You m ay also w ant t o consult t he f ollow in g m anp ages: • • • • •

Reader Rev iew s

defau lt sEr r ata Academic

st r ings Ten Things I Dig About Pant her Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 10. Disks and Filesystems Mac OS X su ppor t s m ult ip le device t y pes t hat can b e accessed as a disk. These in clud e ph ysical disk s su ch as har d d riv es, Fir eWire and USB dr ives, m ult iple har d dr iv es com bin ed int o a RAI D, CD s and DVDs, v ar ious f orm s of f lash m emor y , net w or k disk s r esiding on a ser ver , and v irt u al •disk s t hat can Table of Content ex ist in m ems or y or be d er iv ed f rom files on anot her f ilesyst em . Ev en t houg h d isk s •can t ake m anReview s s, fr om t h e user per sp ect iv e, a disk is a disk is a d isk . Files can be m ov ed y for m •and copied b Reader iew s w it hou t t oo m uch t h ough t . et weenRev t hem •

Er r ata

To , how ev er , t w o layer s m ed iat e bet w een t h e operat in g sy st em and disks: • t he syst em Academic • •

Ten Things I Dig About Pant her Scheduling Tasks in Pant her

Dev ice d riv ers t hat t ran slat e st an dar d sy st em file access calls int o a f orm und er st ood by t h e disk

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Filesyst em s t hat or ganize d at a on a dr ive in t o a for m t h at can be accessed b y a d ev ice iver: er O'Reilly Pubdr lish Pub Dat e: Decem ber 2 00 3

Mac OS X has dev ice d r iv ers, in t h e for m of k ern el ex t ensions ( k ex t s) , f or m ost of t h e devices I SBN: 0- 59 6- 005 00 -8 t hat y ou will w an t t o use as a disk inclu ding FireWir e dr ives, USB f lash m em or y car ds, and SCSI Pages: 32 6 disk s. This chap t er st art s out by int r odu cin g t he k inds of f ilesy st em s t h at Mac OS X su ppor t s an d sh ows y ou h ow t o ex am ine an d w or k w it h t hese filesy st ems. I t t hen sh ow s you h ow t o wor k w it h disk s—b ot h phy sical and vir t ual—in clud ing par t it ioning disk s and m oving d at a safely f rom one disk t o anot . X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Ru nning Macher OS cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.1 Filesystems Each dev ice st or es dat a in a for m t h at m ak es sense f or t hat dev ice. A har d dr iv e u su ally wr it es dat a t o t he plat t er s using a ser ies of sect ors and t r ack s. A CD wr it es dat a in one cont inu ous t r ack t hat spir als fr om t h e inside of t he disk out . A comp act flash card simp ly holds d at a in a m at r ix of on t of h eContent chip. sFor eff iciency r eason s, t he d at a t h at m ak es up a f ile may b e scat t er ed •m em or y cellsTable across a dr ive in st ead of being nicely org anized in one lu mp . The role of a filesy st em is t o • Review s m ed iat e bet w een t h e w orld of t he device w her e dat a is sp read across t h e ph ysical m ed ia of a • Reader Rev iew s disk and t h e w orld of t he Find er w here d at a show s up in an or ganized for m of f iles an d f older s. •

Er r ata



Academic



Ten Things I Dig About Pant her

10.1.1 TheScheduling Mac OS Extended Filesystem (HFS+) • Tasks in Pant her Running Ma c O S X P ant he r

The r im ar y f ilesyst em used by Mac OS X is t he Mac OS Ext en ded f ilesy st em , also k now n as By Jampes Duncan Davidson HFS+ . I n t r oduced wit h in Mac OS 8. 1 and r ecent ly u pgr aded w it h j our naling f eat u res f or Pant h er , HFS+ allow s long f ilenam es w it h up t o 2 55 Un icod e ch ar act er s, scales up t o 2 TB of Pub lish er: O'Reilly dat a on a f ilesyst em , can hand le 2 b illion files, and allow s for f iles u p t o 2 GB in size. I n ad dit ion, Dat e: Decem ber 2 00 3 eachPubf older in an HFS+ f ilesyst em can hand le a m ax im u m of 32, 7 67 files. When HFS+ w as f ir st I 59 6-size 005 00 int r odu SBN: ced, 0-t he of-8t hese fig ur es was w ay beyon d wh at t h e st at e- of- t h e- ar t filesy st ems of t he Pages: 32 6 t im e could hand le.

Ev en t houg h it looks lik e it w ill b e good for t he n ex t cou ple of y ear s, it 's obv ious t h at HFS+ ( in it s cur r en t f or m) only h as a f ew m ore year s lef t t o it . le, inher all is t h teir e inn ovat w isdom , no r ealizes t his isant t o Ru nning Mac OSApp X Pant he in ultfinit im at e Sw iss ivAre my Knife( TM)dou ; forbt pow er user s wand ho w pr ,obab harerdally at wr ev or ku at n ewbfilesy t yp e for t he f ut re; Mac OS cust om ize, t w eak and lyg en p t devising heir Mac.aThis ook tst akem es reader s deep inuside somtet g er capwable of sk eeping u p wf or it ht ht he weout of t heir X's cor e, r evealing heh in inn ork ing of Pant her oserap w hidly o w gr antowt oing g etfile t h sizes e most encount h en gu w or g w ityhoudigit and, bv ut id eo. syst em . You m ay not beerawMac rukin w hen st aralt taudio his book once you 'v e r ead it , you 'll b e w ell on you r w ay. On e of t he q uir ks of HFS+ is t h at it is a case- p reser v in g an d case- insen sit ive f ilesy st em . Th is m ean s y ou can 't hav e files nam ed Readm e an d READM E in t h e sam e d irect or y. This is similar t o t he way t he f ilesyst em s w or k on Window s, bu t is d iffer ent fr om t he t r adit ional Unix casepr eser v in g filesy st em s w h er e y ou can hav e b ot h a Readm e an d READM E f ile in t he sam e dir ect or y . I n m ost cases t h is isn 't a pr ob lem b ecause p eop le don' t t end t o place t w o f iles w it h t he sam e nam e int o a d ir ect ory . Anot h er diff er ence bet w een t h e HFS+ filesy st em and m ost ot her s is t h at HFS+ supp or t s t he concep t of r esour ce f ork s. Resour ce for k s w ere used on t he old Mac OS t o st ore all sor t s of m et adat a for a file, such as icons. Alt h ough r esou rce f or ks w er e a g ood id ea, t hey didn 't cat ch on w it h t he r est of t he wor ld. Un ix and Window s f ilesy st em s don 't hav e an equiv alen t concept , so App le adopt ed a sim ilar policy an d recom mend s t hat all app licat ions t hat w rit e f iles shou ld av oid using r esour ce f ork s. How ever , t he filesy st em st ill sup por t s r esou rce f or ks, m ainly so old er app licat ions t hat rely on t hem can ru n just fine. I n all likelihood, man y app licat ions w ill cont in ue t o use r esour ce for k s t o som e d eg ree or an ot her .

Case Insensitivity and Unix When t he Rhapsody t eam fir st br ou ght up t he sy st em on t op of t h e HFS+ filesy st em, t hey w er e con cer ned t hat t he case insensit iv it y w ould be a pr oblem . I t t u r ned ou t t hat t her e w as only on e pack age in all t he var ious Unix u t ilit ies w her e case • insensit iv it yTable s and t h at w as in t he Per l sour ce code t r ee. The pr oblem : w as of a Content pr oblem • t her e w as bot Review h a sMak efile an d a m akef ile at t h e t op lev el of t he d ist r ibu t ion p ack age. • Now t h at m ost Reader s Per l d ev elopers ru n Mac OS X, t his is n o long er an issue. of tRev he iew core •

Er r ata



Academic



Ten Things I Dig About Pant her

10.1.1.1 Journaling • Scheduling Tasks in

Pant her

Running Ma c O S X P ant he r

I f Jam somesetDuncan hin g wDavidson ent w ron g wit h t h e Mac OS X f ilesy st em b ef or e Pant h er , a long and int ensive fsck By pr ocess w ou ld b e ru n t he n ex t t im e t he m achine st ar t ed u p. For ex amp le, if t h e m ach ine w as pow er ed of f in cor r ect ly or if t he sy st em cr ashed, it was pr et t y comm on t o wait a long t im e at t he Pub lish er: O'Reilly init ial g ray boot scr een. And if t he f ilesyst em t r uly g ot it self in t o a bad st at e, man ual in t er v ent ion Dat e: Decem ber 2 00 3 w asPub necessar y t o f ix t he filesy st em . I SBN: 0- 59 6- 005 00 -8

Jour naling Pages:, 32 w 6hich w as fir st int r odu ced in Mac OS X Ser ver 10 . 2. 2 and is now t h e defau lt filesyst em t y pe f or Mac OS X Pant her . I t im plem en t s a schem e t hat k eeps t he f ilesyst em st r uct ur e of y our d isk safe ev en in t h e face of an unex pect ed shut dow n. W hen y our Mac r eb oot s, disk r ep airs are mad e as needed. Th e filesy st em does t his b y k eeping a con t inuou s r ecor d of chang es t o t h e files on a disk in a j our nal f ile in a desig nat ed area of t he disk . I f a com put er st t s up Mac and OS t h eXdisk in an ent st at e, Ar t he r nal TM) is u sed q uickly r est heant disk Ruarnning Pantisher is t inconsist he ult im at e Sw iss myjou Knife( ; fort opow er user s wore h o tw to to it s pr ev iou s k now n st at e. This r ecor d keeping does com e w it h a slig ht perf or man ce over head. cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OSI t t y pically 1 0 t ot he 15inn perercen t long t oPant w r ither e small our naling it houout t it , of b ut in X's cor e, trakes evealing w ork inger s of f or t files h ose wit w hho j w ant t o g ett han t h e wmost t heir m ost cases, t h e slig ht p er f orm an ce loss is w ell w or t h t he safet y g ain ed . Jour n alling also allow s syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e ot heron opyou t imizat ion s t o b e m ade in t he d isk I / O syst em , w hich mor e t h an mak es up for t he w ell r w ay. per for m ance penalt y . I t is im por t an t t o not e t h at , in t he f ace of unex pect ed shut dow ns, j our naling w on't necessar ily pr ot ect t h e dat a being w rit t en t o d isk . By p r ot ect ing t h e filesy st em , jour naling p rot ect s all t h e dat a t hat is alr ead y on you r disk fr om b ein g lost b ecau se of a pow er out ag e at t he w r ong m om en t .

10.1.1.2 Fragmentation I n t he past 20 y ear s of p er sonal com put in g, a comm on t hem e w it h har d disk s h as been t h e issu e of file f r agm en t at ion. Early h ard d riv e f orm at s w er e ext r em ely suscep t ible t o perf or man ce pr oblem s m anifest ed ov er t im e by h avin g t h e dat a for t he f iles split amon g t oo m any locat ions on t he d riv e. As f iles gr ew lar ger t h an t h eir origin al allocat ion , t he filesy st em was for ced t o put par t s of t h ose files ont o diff er ent par t s of t h e disk. Ev en m or e m odern f orm at s su ch as HFS+ can exh ibit p er f orm ance slow dow ns ov er t im e as a disk is used m or e. Pant h er int r oduces t he follow in g t w o opt im izat ions t o t h e HFS+ dr iver w hen using a j our naled filesyst em :

Aut om at ic f ile defr agm en t at ion

When opened, if a file has mor e t h an 8 f r agm en t s and is sm aller t h an 20 MB in size, it is defr ag ment ed by sim ply m ov in g t he f ile t o a new locat ion on t he dr ive w h er e t h e file can be w r it t en in on e cont iguou s block .

Adap t iv e Hot File Clu st er in g • • • • • •

of Content s t he syst em k eep s t r ack of sm all f iles t h at ar e r ead f r eq uent ly , bu t Ov er a Table p er iod of t ime, Review nev er wr it t ens t o. As t h e syst em learn s w hich files are u sed m ost and w hich ar e least lik ely t o ch ange Reader size, Revitiew msov es t hem t o t he f ast est par t of t h e dr iv e, wh er e t h ey can qu ick ly be accessed Files t h at don 't m eet t he r equir ement s for b ein g in t his " hot zone" ar e m ov ed out Er r.ata t o en suAcademic re t hat en ough r oom exist s f or t he files t hat sh ould be t h er e. Ten Things I Dig About Pant her

This m eans, Scheduling at least forTasks m ost f iles m ost of t he t im e, a separ at e def rag ment at ion p rog r am isn 't • in Pant her needed. I t also means you shou ld alw ay s en able j our naling on you r dr ives so y ou can t ake Running Ma c O S X P ant he r adv ant ag e of t hese feat ur es. Fort u nat ely, w hen in st alling Pant h er , t he def ault f ilesy st em t yp e is By JamOS es Duncan Mac Ex t endDavidson ed ( Jour n aled) , so y ou shou ld b e set . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00opt 3 im izat ions These

w er en 't par t of t he off icial adv er t ised f eat ur e set of Th ey w er e discover ed b y some p r ogr amm er s w hile r ead ing t he sour ce cod e for t he f ilesyst em d riv ers av ailable f rom t he D arw in pr oject .

I SBN: 0- 59 6Pant 005 00 h er -8. Pages: 32 6

10.1.2 Other Supported Filesystems Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, , and g enOS er ally ev u pt s tsever heir Mac. b ook t akfilesy es reader s deep Mac OSit s I n addit ion tt w o eak HFS+ , Mac X sur ppor al ot hThis er t yp es of st em s, each in ofside w hich has X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir ow n uniqu e char act er ist ics: syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Mac OS St and ar d ( HFS) The st an dar d Mac filesy st em pr ior t o t he r elease of Mac OS 8 .1 , HFS is pr im arily sup por t ed so t h at older d isk s can st ill b e accessed.

Unix File Sy st em ( UFS) A v ar iant of t he st and ard BSD Fast File Sy st em, UFS is a case- sen sit iv e and casep reserv ing filesyst em pr ov ided t o ensur e t hat app licat ions need in g a case- sensit iv e f ilesy st em can be r un. Some people r ecom m en d t hat Unix sof t w are developer s use UFS, b ut ex per ien ce has show n t hat HFS+ is a m uch fast er f ilesyst em and casein sensit ivit y isn' t t he big pr ob lem m any m ak e it ou t t o be. I f y ou t h ink y ou hav e a n eed for UFS, y ou'll w ant t o consider y our decision caref ully becau se, u nder Mac OS X, t his f ilesyst em doesn' t p er f orm as w ell as HFS+ .

Univ er sal Disk For m at ( UDF) The st an dar d for m at f or all DVD m ed ia f orm at s in clud ing vid eo, DVD- ROM, DVD - RAM, an d DVD- RW as well as som e w r it eab le CD for m at s.

I SO- 966 0 The st an dar d cr oss- plat for m f ile for m at f or CD - ROM dat a disks.



Aud io CD • •

Table of Content s Review s

Rev iew The f orReader m at used bys st and ard aud io CD s.



Er r ata



Academic



Ten Things I Dig About Pant her

MSDOS File Scheduling Allocat ionTasks Tablein (Pant FAT) • her Running Ma c O S X P ant he r

The st an dar d filesy st em of MS- DOS; w id ely u sed by Micr osoft Window s. Mac OS X 16- and 32 - bit v ar iant s of FAT.

By Jam es Duncan supp ort sDavidson bot h t he Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.2 Network-based Filesystems I n addit ion t o w or k ing w it h p hy sical f ilesyst em s, Mac OS X also sup por t s a set of net w ork - based filesyst em pr ot ocols. These are used w hen you m oun t a filesy st em fr om a m ach ine elsew her e on t he net w ork and, f or t h e m ost par t , m ak e a r em ot e filesyst em app ear as t hou gh it w ere local t o . Thofe Content net w ork •y our com put er Table s filesy st em pr ot ocols su ppor t ed by Mac OS X are: •

Review s



Reader Rev iew s



Er r ata

• Academic App le Filing Pr ot ocol ( AFP) •

Ten Things I Dig About Pant her

The n atScheduling ive net w ork fileshar Tasks in Pant ing her pr ot ocol f or Mac- based com pu t ers. Origin ally d esign ed t o w Ma or kc Oover , it now op er at es w ell ov er I P- b ased net w or ks. Most connect ions t o Running S X PAp antpleTalk he r Mac- based filesy st em s w ill be AFP- b ased. •

By Jam es Duncan Davidson

Pub lish er: O'Reilly

ServPub iceDat M e: essage Block Decem ber 2 00 3( SM B) / Com m on I nt er net File Sy st em ( CI FS) I SBN: 0- 59 6- 005 00 -8

The n at ive net w ork fileshar ing pr ot ocol f or Wind ow s- b ased comp ut er s. Know n as SMB f or m ost of it s life, Micr osoft st art ed st andar dizat ion of t he pr ot ocol un der t he CI FS nam e in t he lat e 199 0s b ut t hese ef for t s w ere never f inalized . This p rot ocol is im plem en t ed in Mac OS X by t he Sam ba su it e of soft w ar e ( w w w .sam ba. or g/ ) .

Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Net wom orkize, Filet wSy st em ( NFS) cust eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir older, Unnot ix - based net w used ariouyou s BSD st em Solar syst emAn . You m ay be a Mac guork ru filesy w henstyem ou st ar t tby hisLinux book,, tbhe ut vonce 'v e sy r ead it ,s,you 'll bis, e X, and ot h er Unix v ar iant s. NFS allow s Un ix m ach in es t o t r ansp arent ly shar e f ilesy st em s w ell onAIyou r w ay. in su ch a w ay t hat t he Unix u ser secu rit y mod el is pr eser ved.

Web- Based Dist ribu t ed Aut hor ing and Versioning ( W eb DAV) A set of ex t ension s t o HTTP t hat allow s you t o collab orat iv ely ed it and m anag e files on r em ot e web ser v er s. WebD AV is t he nat iv e pr ot ocol used f or m oun t ing iDisk sh ares f rom . Mac. You can f ind m ore in for m at ion ab out Web DAV at w w w .w ebd av. or g/ .

File Tr ansfer Pr ot ocol ( FTP) An older pr ot ocol used t o t r ansf er files bet w een m ach in es t hat st ill is in use on t h e I nt er net . Tr adit ionally , FTP has been used wit h an FTP clien t ( sim ilar t o how t he w eb is br ow sed w it h a w eb br ow ser ) , how ev er , if y ou w ant y ou can m ou nt an FTP sit e as a dr iv e.

10.2.1 Mounting a Network File System The Find er ' s Go Con nect t o Ser v er menu ( - K) , show n in Figur e 10 - 1, g iv es y ou a simp le int er face f or m ount in g r em ot e disks locally . Ther e are four w ays t o connect t o a r em ot e ser v er:

Figu r e 1 0 -1 . Conn ect in g t o a ser v er w i t h t he Fin der



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 32 6 Serv erPages: Add ress

Here you can t yp e t he h ost nam e or I P ad dr ess of t h e ser v er t hat you w ant t o con nect t o. The Find er will assum e t h at y ou w ant t o connect v ia AFP if y ou sim p ly en t er a host n ame or I P ad dr ess, bu t y ou can also u se a URL in t h is field t o connect t o AFP, FTP, SMB, an d WebDAV st ems. Table 1 0-im 1 at g ives h e Ar syn t axKnife( for t hese Ru nning Mac OSfilesy X Pant her is t he ult e Swtiss my TM) ; URLs. for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Favor it e. You Servm ers w ell on you r w ay. A list of ser ver s t hat y ou can add by clicking t h e plus ( + ) bu t t on next t o t he Ser ver Add ress field. Use t his f or ser v ers t hat you connect t o f requ en t ly.

Recen t Ser ver s The Clock b ut t on giv es y ou access t o t he ser ver s y ou hav e recent ly connect ed t o. You' ll see t hese r ecent ser v er s b y URL, as show n in Figur e 10 - 1.

Tab le 1 0 - 1 . Ne t w or k fi le sy st e m t yp es, URL syn t a x, an d com m a nd -l in e m oun t ut ili t i es

Pr ot ocol

File syste m Typ e

AFP

afp

afp: / / [ user ] @host / [ v ol um ena m e] m ou nt_af p

FTP

f tp

f tp: / / [ user ] @host / [ p a t h]

m ou nt_f t p

nf s

nf s: / / [ user ] @host / [ p a t h]

m ou nt_n fs

sm b: / / [ user ] @host / [ sh ar en am e]

m ou nt_smbf s

ht tp: / / [ user ] @host / [ p a t h]

m ou nt_w ebdav

NFS •

• SMB/ • •

Table of Content s

CIFSReview sm bf s s

WebD AV

Reader Rev iew s

webdav

Er r ata

URL Syn t a x



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Com m a nd -l in e M oun t Ut i li t y

Running Ma c O S X P ant he r

Br ow se

By Jam es Duncan Davidson

When y ou click t he Br ow se but t on, a Fin der view w ill op en f ocu sed on t he Net w or k, as in Figur e 10 - 2. Th is w ill pr ovide you access t o t he v ar ious Mac- and Window s- based Pub show lish er: n O'Reilly filesyst em s t hat ar e on t he local net w or k. Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 1 0 - 2 . The Ne tw or k br ow ser in the Fi nder

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

When y ou conn ect t o a net w or k- b ased filesy st em using Con nect t o Ser v er , it w ill sh ow up as a dr iv e in t he Finder and w ill be mou nt ed in t o t h e filesyst em in t he / Volu m es d irect or y. I f y ou w ant t o mou nt a net w or k - based f ilesyst em int o a d iff er ent dir ect or y t han / Volu m es, y ou' ll need t o use t he m ount com m and- lin e ut ilit y. The m oun t com m and has t h e follow ing gener al syn t ax: mount -t filesystemtype url mountpoint

The —t op t ion let s y ou specif y t he t yp e of filesy st em you w ant t o mou nt . Th e m ount poin t m u st be a dir ect or y t h at alr eady exist s in t he filesy st em . For ex am ple, t o m oun t a . Mac user' s Pub lic fold er , issue t h e follow ing com m and s:

$ mkdir -r /Disks/iDisk • • •

Table of Content s Review s Reader iew s $ mount -tRev webdav http://idisk.mac.com/runningosx-Public /Disks/iDisk



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

The f ir stMacomm d, he m rkd ir —r / Disk s/ iDisk cr eat es a dir ect ory an d su bdir ect or y in t he filesy st em Running c O S Xan P ant t hat y ou can use f or m ount in g a disk v olum e t o. Th e second comm an d act u ally m oun t s t h e iDisk By Jam es Duncan Davidson Pub lic folder , w hich b elon gs t o t he . Mac mem ber nam ed r unn in gosx , int o t he / Disk s/ iDisk dir ect or y . Pub lish er: O'Reilly Dat Decem ber 2 00 TherPub e ar ee:also specif ic 3m ount com m and v arian t s for each pr ot ocol. These are list ed in Table 1 01. I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.3 Disk Utility The p r im ar y t ool for w or k in g wit h d isk s and f ilesyst em s is t he D isk Ut ilit y ( / App licat ions/ Ut ilt ies) , show n in Figur e 10 - 3. Th e Disk Ut ilit y can be u sed t o conf igur e, f orm at , ej ect , an d par t it ion d isk s of all k inds. On t h e lef t side of t he Disk Ut ilit y in t erf ace is a list of t h e disks at t ach ed t o y our t h e vofolu m es tshat ex ist on t hose disk s. Addit ionally , if you h ave m ou nt ed an y disk •m achine and Table Content im ages, a list of t h e most r ecent ly accessed f iles app ear s at t he bot t om of t he left - h and colu mn . • Review s On t he rig ht side of t he int er face is a set of panels t hat giv e y ou access t o t h e act ion s t hat y ou • Reader Rev iew s can accom plish w it h a d riv e. At t he bot t om of t he win dow is a st at us d isplay t hat g ives y ou all • Er r ata sort s of infor m at ion about t he disk or v olu me you hav e select ed. •

Academic

•Som e of t he Ten Dig About Pant t askThings s t h atI can be p er forher m ed wit h Disk Ut ilit y are: • Scheduling Tasks in Pant her Running Ma c O S X P ant he r

Mou nt anDavidson d ej ect disks, By Jam es Duncan

includ in g har d d r iv es, CDs, an d d isk im ages.

Get t he t y pe, f orm at , cap acit y , an d r oom av ailable f or any d isk at t ach ed t o you r com put er . Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 1 0 -3 . D isk Ut i lt it y

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Ch eck and r epair disk s ( ot her t h an t he boot disk ) . Ch eck and r epair disk per m issions. Er ase a d isk , includ in g er asur e by w r it ing r andom dat a t o a disk. Par t it ion a disk int o m ult iple v olum es wh ich subd ivides t h e dr iv e int o m u lt ip le logical disks. • • • •

Cr eat e and w or k w it h disk im ag es. Table of Content s Review s

Rest or e t he cont ent s of a d isk im age t o a d isk . Reader Rev iew s

r ata Set u p aErRedun dant Ar ray of I n dependent Disks ( RAI D) .



Academic

line Things in t erf ace ool called disku t il can be u sed t o perf or m all t he feat ur es of t he GUI •A com m and- Ten I Dig tAbout Pant her r ogr am and m or Toher get a list of t h e disks at t ach ed t o you r com put er , execut e t he •Disk Ut ilit y p Scheduling Tasks in e. Pant com manMa d disku listheas Running c O S Xt il P ant r sh ow n in Ex am ple 10 - 1. By Jam es Duncan Davidson

ExaPubmlishpler:e O'Reilly 1 0 -1 . Ge t t i ng a li st of d r iv es u si ng t h e disk ut il com m a nd Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 $diskutil list

/dev/disk0 #: type name size identifier Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o *74.5 GBt akdisk0 cust0: om Apple_partition_scheme ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Apple_partition_map KB , b disk0s1 syst1: em . You m ay not be a Mac gu ru w hen y ou st ar t 31.5 t his book ut once you 'v e r ead it , you 'll b e w ell on you r w ay. 2: Apple_Driver43 28.0 KB disk0s2 3:

Apple_Driver43

28.0 KB

disk0s3

4:

Apple_Driver_ATA

28.0 KB

disk0s4

5:

Apple_Driver_ATA

28.0 KB

disk0s5

6:

Apple_FWDriver

256.0 KB

disk0s6

7:

Apple_Driver_IOKit

256.0 KB

disk0s7

8:

Apple_Patches

256.0 KB

disk0s8

74.5 GB

disk0s9

size

identifier

0: Apple_partition_scheme

*27.9 GB

disk1

1:

31.5 KB

disk1s1

9:

Apple_HFS Incognita

/dev/disk1 #:

type name

Apple_partition_map

2:

Apple_HFS Backup

27.8 GB

disk1s3

This v iew giv es you m uch m ore in for m at ion t han t he list of d riv es and v olu mes on t h e lef t side of t he Disk Ut ilit y app licat ion. I n p art icular , it sh ow s you t h at m or e t han j ust a sin gle v olum e is associat ed wit h a disk. I n f act t her e ar e sev eral par t s, somet im es called slices, t o a d isk , each •w it h an id en tTable Content ifier. ofThe f ir stsslice of t he d isk h olds t he par t it ion m ap . This is a key t o w here •ever yt hing isReview s on t he r est of t h e disk. Then a gr oup of ot h er p ar t it ion s follow s. I n t he case locat ed •of Ex am ple 10Reader - 1, slices Rev iew 2 st h rou gh 8 of disk0 h old d isk d r iv er s used b y Mac OS 9, an d slice 9 is •t he act u al HFS+ Er r atav olum e of t he d riv e. The Mac OS 9 d riv ers are in st alled by def ault w h en y ou a . I f you f orm at an in t ern al boot dr ive w it h out t he OS 9 dr iver s, y ou'll see som et h ing •for m at a diskAcademic Ex amI ple - 2, Pant w her •like t he out put TeninThings Dig 10 About here only t he par t it ion m ap an d t he m ain HFS+ v olum e •app ear . Scheduling Tasks in Pant her Running Ma c O S X P ant he r By Jam es Duncan Davidson

1 0 - 2 . Th e li st of pa r t i t i on s of a di sk w i t h ou t O S 9 d r iv er s Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 059 6- 005 00 -8 $diskutil list Pages: 32 6

/dev/disk0 #:

type name

size

identifier

0: Apple_partition_scheme *37.3 GBTM)disk0 Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Apple_partition_map disk0s1 X's 1: cor e, r evealing t he inn er w ork ing s of Pant her f or31.5 t h oseKB who w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Apple_HFS TiBook 37.1 GB disk0s3 w ell2: on you r w ay.

10.3.1 Examining a Disk To t ake a closer look at a d ev ice at t ached t o y our com put er or a v olum e associat ed wit h a dev ice, select t he disk or v olum e and t h en click t he I nf o bu t t on. A w indow pops up list ing all sort s of infor m at ion about t he device or v olum e, as show n in Figur e 10 - 4. Som e of t h e fields t h at y ou' ll see in t he I n fo win dow f or a d isk ar e:

Nam e The n am e of t he d ev ice or v olu m e. I n t h e case of a volu me, t h is w ill be t h e nam e y ou gav e t he volum e an d is t hat wh ich app ear s in t h e Fin der. I n t h e case of a device, t his w ill b e t he har dw ar e n ame of t he disk , such as Hit ach i I C25 N0 80ATMR04 - 0.

Figu r e 1 0 -4 . D isk Ut i li t y 's D isk I nf o w in dow



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Disk I dent ifier The lab el by w hich t he op er at ing sy st em r efer s t o t he disk . For exam ple, t h e pr imar y b oot disk in most Macs is ident if ied as disk0 . A volu me on t h e dr iv e has an add it ion al set of char act er s ident if y in g t he par t it ion on t he d riv e it occup ies, such as disk0 s9 . Th e disk ident if ier is also t he f ilenam e in t he / dev d irect or y und er w hich p rog ram s m ay access t he dr iv e dir ect ly .

Con nect ion Bus The k ind of bu s t hat t he device is at t ached t o. The in t ern al disk in a Pow erBook will sh ow ATA f or t h is field w h ile an ex t er nal Fir eWire dr iv e w ill show Fir eWir e.

Device Tree

The id en t ifier in t he syst em 's device t r ee t hat t he d ev ice occup ies. Th is is t he sam e ident if ier t h at show s up in t h e Open Fir m w ar e device t r ee.

Wr it able I ndicat es w het her or n ot t h e dev ice can be w r it t en t o. •

Table of Content s



Review s



Reader Rev iew s



Er r ata

Ej ect ab le •

I ndicatAcademic es w het her or n ot t h e dev ice can be ej ect ed.



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Tot al Cap acit y

By Jam es Duncan Davidson

The am ou nt of d at a t hat t he dev ice can hold. Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

S. M. A. R. T. St at us Pages: 32 6

Man y disks m ad e in t h e last f ew year s cont ain a set of on - boar d d iagnost ic f unct ions k now n as S. M. A.R.T. , wh ich st and s for Self - Monit or ing, Analysis, an d Repor t in g Tech nology. Th ese disk s m onit or d isk calibr at ion, cy clic r edun dancy check ( or CRC) er r or s, disk spin- u p t im e, r ot at ional sp eed of t he d isk , d ist an ce b et ween t he h ead and t h e disk, Ru nning andMac t h eOS t emp X Pant er at u her re is of t he he ult dr iv ime.atThe e Swviss alues Ar my youKnife( see inTM) t his ; for field pow are er eit user hers Verified, w h o w antw hich to cust ommize, ean tswever eak ,ytand hingg en is er okally ay, rAbou ev u tp t toheir FailMac. , w hich This m bean ooks t he ak es d isk reader n eeds s deep t o b einr side ep laced Mac OS X's corim e, mediat r evealing ely , t or he Not inn er Suw ppor ork ing t ed,s w ofhich Pantm her eanf or s t he t h ose d iskw d h oesn o w ant 't su t oppor g et tt hS.M.A. e most R. out T. of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Iwf ell youonexyou amin a v olum e on a d isk w it h t he I n fo but t on , y ou' ll see m or e inf orm at ion abou t t h e r weay. disk , including :

File Sy st em The t yp e of filesy st em t hat t he v olum e is f orm at t ed t o use.

Cap acit y , Free Space, Used The t ot al am ount of dat a t hat can be st or ed on t he v olum e, t h e amou nt of addit ional dat a t hat can be st or ed on t he volum e, and h ow m uch sp ace t he cur r en t cont ent s of t he v olum e occu py .

Num ber of Files, Num ber of Folder s The n um ber of f iles and f olders on t h e v olu m e.

Perm issions Enabled , Can Tur n Perm issions Of f, Can Repair Per m issions I ndicat es w het her or n ot t h e syst em k eep s and enfor ces perm ission inf or mat ion on files. This set t ing w ill alw ays b e Yes for t he int er nal b oot d riv e of y our m achine and w ill usually be No for ex t er nal dr iv es w here it is exp ect ed t hat you 'll b e m oving d at a bet w een m achines. For disk s t h at sup por t p er m issions, t he Can Repair Per m issions set t ing ind icat es w het her or n ot y ou can u se Disk Ut ilit y t o set t he p er m issions of a disk t o wor k w it h t he cur r en t sy st em . •

Table of Content s



Review s



Reader Rev iew s



Er r ata

Sup por t s Jour naling, Jou rn aled • •

I ndicatAcademic es w het her or n ot t h e v olu m e su ppor t s jour naling an d w h et h er or not it is enab led. Ten Things I Dig About Pant her

•You can also Scheduling Pantaher g et inf ormTasks at ionin on d isk u sing t h e disku t il t ool. Tw o com man ds t h an can be u sed Running Matcil Oar S e: X P ant he r w it h disku By Jam es Duncan Davidson

Pub lish er: O'Reilly

diskutil info device Pub Dat e: Decem ber 2 00 3 I SBN: 059 6- 005 00 -8 diskutil info mountpoint Pages: 32 6

The f ir st comm an d u ses a disk ident ifier , such as disk0 , t o locat e t he d isk t o obt ain t he inf at ion secon d is com m and t heiss locat ion Knife( in t h eTM) filesyst heruser e t he is t o Ru orm nning Macof. OSThe X Pant her t he ult imuses at e Sw Ar my ; for em powwer s wdhev o ice w ant m ount , such as, /and . Ex am 10 -r3evshuows t he Mac. r esu ltThis of rbunn t il inf o ag ainst t h e Mac boot OS dr ive cust omed ize, t w eak g enple er ally p t heir ooking t akdisku es reader s deep in side of acor m achine. X's e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Exa m pl e 1 0 -3 . Ge t t i ng di sk in for m a t ion f or t he boot di sk dr iv e usin g t h e di sk i de nt if ie r

$diskutil info disk0 Device Node:

/dev/disk0

Device Identifier:

disk0

Mount Point: Volume Name:

Partition Type:

Apple_partition_scheme

Bootable:

Not bootable

Media Type:

Generic



Protocol:

ATA

SMART Status:

Verified

Total Size:

74.5 GB

Table of Content s 0.0 B Free Space:



Review s



Reader Rev iew s

• • • •

Er r ata

Read Only: Academic

No

Ten Things I Dig About Pant her

Ejectable: NoPant her Scheduling Tasks in

Running Ma c O S X P ant he r

OS 9 Drivers:

Yes

By Jam es Duncan Davidson

Low Level Format:

Not Supported

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ex am ple 10 - 4 sh ows t he inf or mat ion abou t t he v olum e m ount ed at / .

Exa m pl e 1 0 -4 . Ge t t i ng di sk in for m a t ion f or t he r oot vol um e by u si ng t h nning e m oun poiXnt Ru Mac tOS Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e $ wdiskutil ell on you rinfo w ay. / Device Node:

/dev/disk0s9

Device Identifier:

disk0s9

Mount Point:

/

Volume Name:

Incognita

File System:

Journaled HFS+ Journal size 8192 k at offset 0x831000

Permissions:

Enabled

Partition Type:

Apple_HFS

Bootable:

Is bootable

Media Type:

Generic

Protocol:

ATA

Total Size:

74.5 GB

Free Space:

63.5 GB



Table of Content s



Review s

• • • • •

Reader Rev iew s

Read Only: Er r ata

No

Academic

Ejectable: No Pant her Ten Things I Dig About Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

From t his ou t put , you can see t h at t h e filesy st em is for m at t ed as Jour naled HFS+ , an d t hat t he er: O'Reilly jou rPub nallishsize is a m er e 81 92 KB. Ev en t h ough it is mod est in size, t he jour nal has a larg e im pact on tPub he Dat in te: egDecem rit y of bert he 2 00 3 f ilesyst em and allow s f or m any per for m ance opt im izat ions. I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

10.3.2 Verifying and Repairing Disk Permissions On e of t he m ost com m on t hings t hat can g o w r ong w it h a disk is t hat t he perm ission s for t he v ariou s files and dir ect or ies on it get set incorr ect ly . Alt h ough t h e perm ission s for a disk shou ld Ru Xhack Pant,her ult im e Sw Knife( ; inist for pow er suser s word ho w ant t too nevnning er getMac ou t OS of w qu itise tahef ew instataller s iss t hatArrmy equir e an TM) adm rat or' passw seem cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OSis set t he perm ission s on var ious d irect or ies of y our disk t o w hat t hey t h ink t hey shou ld b e. This X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of one r eason w h y m any syst em ad min ist r at or s abh or old- st y le sof t w ar e inst aller s and p ref er ttoheir syst emsoft . You not bet ed a Mac gu ruimwages, hen y wh ou ich st arcan t t his ut once r ead , you 'll ions be inst all w armeay d ist r ibu on disk bebook dr ag, -bandd rop you ped'vinet o t h e itApp licat w ell on you r w ay. fold er wit h out har m . To see if t he p er m issions on y our disk are cor r ect for you r syst em , select t h e disk or v olu m e you w ant t o check and click t he Verif y Disk Perm ission s but t on in t he Fir st Aid panel of t he Disk Ut ilit y in t er f ace. Th is det erm ines w hat t he cor r ect file per m issions ar e f or y our sy st em an d t hen check s y our disk against t hose perm ission s. I f y our perm ission s ar e not set cor r ect ly , y ou sh ould st r ongly consider r epairin g t hem by click ing t he Repair Disk Perm ission s but t on. To ch eck per m issions f r om t he com m and line, use t he follow in g sy nt ax t o disku t il :

diskutil verifyPermissions [diskid | mountpoint]

For exam ple, t o ver ify t he per m issions of t h e boot volu me, y ou w ould use t he f ollowin g com man d:

$ diskutil verifyPermissions /

To r epair p er m issions, u se t he f ollow ing :

$ diskutil repairPermissions / •

Table of Content s



Review s



Reader Rev iew s



Er r ata 10.3.3 Verifying and Repairing Disks • Academic •

Ten Things I Dig About Pant her

To ensu re t hat t he f ilesyst em on a d isk is w or k ing cor r ect ly , select t he disk or v olum e t h at y ou • Scheduling Tasks in Pant her w ant t o check and click t he Verif y Disk but t on. Th is scans t he v ar ious par t s of t he filesyst em t o Running Ma c O S X P ant he r m ake su re t hey ar e int act . I f any p rob lem s ar e r epor t ed, y ou sh ould use t he Rep air Disk but t on By Duncan Davidson t oJam cores r ect t he issues. I n ord er er: t o O'Reilly v erif y or r ep air a d isk , Disk Ut ilit y mu st f ir st u nm oun t t h e dr ive, r em oving t h e abilit y Pub lish t o access t he f ilesberon t h3 e disk w hile it p er for m s it s w or k . This m eans y ou can't v er ify or r ep air Pub Dat e: Decem 2 00 t he disk you boot ed f rom , w h ich in most cases is t he disk t hat you w ant t o ver ify . Ther e ar e t w o I SBN: 0- 59 6- 005 00 -8 solut ions t o t his p r oblem , an d t hey w ork eq ually w ell: Pages: 32 6

Boot off Disk 1 of t he Mac OS X inst all CD set . When t he inst aller show s up , select I nst aller Op en Disk Ut ilit y fr om t he menu b ar so y ou can w or k on t he local disk . Put Mac y ourOS m achine FireWir t aratget d isk e by b oot in g; tfor he pow m achine ansdwhholding Ru nning X Pant int hero is t he ulteim e Sw iss m Arod my Knife( TM) er user o w antdow to n t he T kt w eyeak . Th, en g ter heally m achine o anot h erThis Macb ook using Firreader eWir e scable useMac DiskOS cust om ize, andp lu g en r ev u p int t heir Mac. t aka es deepan indside Ute,ilitr yevealing on t h e ot herinn mer achine t o vserofifyPant andher r epf or airt ht he iskh .o w ant t o g et t h e most out of t heir X's cor t he w ork ing osed w syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Iwf ell Disk ilitry wr un on Ut you ay.s int o a pr oblem it can 't hand le, you 'll n eed t o enlist t h e help of anot her app licat ion such as Dr iv e 1 0 f r om Microm at ( w w w .m icr omat . com / ) or Disk War rior f r om Alsoft ( w w w .alsoft .com / DiskW arr ior / ) . To v er if y and r epair a disk fr om t h e com m and line u sing disku t il , y ou can u se on e of t he follow ing :

diskutil verifyDisk [diskid | mountpoint] diskutil repairDisk [diskid | mountpoint]

Ex am ple 10 - 5 sh ows t he com m and you should use t o r ep air a Fir eWir e disk nam ed Backu p:

Exa m pl e 1 0 -5 . Repa ir i ng a di sk u sin g t he di sk u t il comm a n d

$diskutil repairDisk /Volumes/Backup

Started verify/repair on disk disk1s3 Backup Checking HFS Plus volume. Checking Extents Overflow file. Checking Catalog file. •Checking Catalog Table of Content s hierarchy. • Review s

Checking volume bitmap. • Reader Rev iew s •

Er r ata

Checking volume information. • Academic •

Ten Things I Dig About Pant her

The volume Scheduling Backup Alpha to be OK. • Tasks in appears Pant her Running Ma c O S X P ant he r

Verify/repair finished on disk disk1s3 By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.4 Erasing and Formatting Disks Ther e ar e m any t im es w hen y ou w ant t o " st ar t over " w it h a d riv e, such as w hen y ou ar e up gr ading y our Mac OS X inst allat ion an d w ou ld r at her st ar t f r om scr at ch, or w hen you w ant t o m ake su re t hat all of you r dat a is r em ov ed f r om a Fir eWir e d riv e. Er asin g a disk w it h t he D isk sim pofle, alm ost •Ut ilit y is ver yTable Content s t oo sim p le con sider ing t he f act t h at all t he dat a on t he d isk w ill b e oblit er at ed . • Review s •

Reader Rev iew s



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

The Er ase t ab cof Disk Ut ilit y , show n in Figur e 10 - 5, let s y ou er ase and f orm at a disk w it h t he • Er r ata follow ing opt ion s:

Running Ma c O S X P ant he r

Figu r e 1 0 -5 . Er a si ng a disk u si ng D isk Ut i li t y

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Volu m e For m at The Volu me For m at p ull- dow n list let s you select t h e filesyst em y ou w an t t o place on t he dev ice. For m ost p ur poses you 'll w ant t o use Mac OS Ex t ended ( Jour naled) .

Nam e Let s y ou nam e t h e volu me t hat will b e creat ed on t he disk . Ther e ar e addit ion al opt ion s hiding behin d t he Op t ions bu t t on, sh own in Figur e 10 - 6. Th ese opt ion s ar e:



Table of Content s



Review s

Z ero all d at a Reader Rev iew s • • • • •

Er r ata

This op t ion f or ces D isk Ut ilit y t o g o bey ond ju st set t ing up a n ew filesy st em on t he disk , r esult inAcademic g in ever y bit on t he disk b eing set t o 0. Th is en su r es t hat t he dat a pr eviou sly on Tencan' Things I Dig About Pant her se D isk Ut ilit y has t o w r it e a 0 t o ev ery par t of t h e dr ive, t he dr ive t be accessed . Becau Scheduling Tasks in Pant her t his op t ion isn' t nearly as fast as just er asing and for m at t ing a dr ive.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

Figu r e 1 0 -6 . Er a se opt ions in Di sk Ut i li t y

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

8 Way Ran dom Wr it e Form at This op t ion is f or t h e t r uly par anoid . I f you select t h is opt ion, Disk Ut ilit y r and omly w r it es

dat a t o ev ery b it of st or age eight t im es, m ak ing it h ighly un lik ely for any body t o r ecov er dat a fr om t he disk . Ev en a comp any lik e Dr ive Sav ers ( w w w .d r iv esav er s. com ) wou ld b e har d- p r essed t o find an yt h in g usable on t he d isk , ev en af t er t hey disassem bled it and used v er y ex pensive t ools t o analy ze t h e m agnet ic st r uct ur e of t he disk . Th e dow nside is t hat an 8- w ay w r it e t ak es a lon g t im e t o for m at a lar ge disk . To u se t he disku t il com m and t o er ase a d isk , use on e of t he f ollowin g com m ands: •

Table of Content s



Review s newName [diskid | mountpoint] • diskutil eraseDisk Reader Rev iew[format] s •

Er r ata • diskutil zeroDisk Academic [diskid|mountpoint] • •

Ten Things I Dig About Pant her

diskutil randomDisk [numberOfPasses] [diskid|mountpoint] Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

lish er: O'Reilly For Pub exam ple, t o for m at an ex t er nal Fir eWire disk t hat had t he d ev ice I D of d isk 1, u se t he follow Pubing Dat:e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

$ diskutil eraseDisk "Journaled HFS+" Backup disk1

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e wWhy ell on Write you r w ay. Eight Times? So, w hy wou ld y ou w ant t o t ak e t h e t im e t o w r it e r and om dat a eig ht t im es ov er t he sur face of y our h ard d riv e? Well, w hen y ou w r it e dat a t o a disk, t here is st ill a fain t m agnet ic r em nant of t he or iginal dat a on t he dr iv e. Ver y soph ist icat ed equ ipm en t can det ect t hese mag net ic t r aces an d recreat e d at a t h at w as on ce on t he dr iv e but erased. Each t im e d at a is w r it t en t o a spot on a d isk , t h e t r aces f r om pr evious dat a at t hat sp ot g et cover ed u p an d f ade. Af t er eig ht w r it es, it shou ld be close t o im possib le t o r esu rr ect dat a f rom any t r aces t hat rem ain.

To w r it e zer os across t h e ent ir e filesy st em of a Fir eWir e disk nam ed Backu p, u se t he f ollow ing :

$ diskutil zeroDisk /Volumes/Backup

On e t hing t o keep in m ind w hen eit h er zer oing or w r it ing r andom d at a t o a d isk is t hat bot h oper at ions t ak e q uit e a w h ile t o per for m on lar ge d isk s. Aft er issuing t he com m and, you m ight w ant t o g o of f and r ef inance y our h ouse; t he com m ands mig ht be don e by t h e t im e you g et back .



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.5 Partitioning Disks For t he most par t , y ou' ll w ant t o assig n a single v olum e t o each of y our har d dr iv es. I t ' s quick and easy and is usually t he most ef ficien t u se of sp ace. How ever , t h er e ar e t im es w hen y ou m ight w ant t o h ave m or e t h an on e v olu m e on a dr iv e. For ex am ple, w hile w ork ing w it h t he f irst of a new v er sion of Mac OS X, you m ight w ant t o h ave a t est par t it ion for t he n ew •few releases Table of Content s v• er sion w h ileReview keeping a st able, k now n v er sion av ailable. Or y ou m ight w ant t o k eep an old copy s of Mac OS 9 av ailab le on a sep arat e par t it ion f r om y our Mac OS X in st allat ion f or r unn in g • Reader Rev iew s Classic. •

Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

The b est and only t im e t o par t it ion you r disk is w hen you 'r e inst alling t he oper at ing syst em . Once t h e syst em is inst alled , y ou can 't go back lat er and Running Ma c O S X P ant he r par t it ion t he d riv e or ad ju st t he p ar t it ion sizes. So, if you w ant t o p ar t it ion By Jam es Duncan Davidson y our d riv e, you m ust fir st back u p all you r crit ical dat a t o anot her d riv e, t hen do a clean inst all of Mac OS X, using t he D isk Ut ilit y on I n st all Disc 1. Pub lish er: O'Reilly For det ails on par t it ioning and inst alling Mac OS X, see Append ix A, I nber st alling Pub Dat e: Decem 2 00 3 Pant h er . I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

To cr eat e m ult iple v olum es on a disk , select t he disk t hat you w ant t o sp lit up and click t he Par t it ion t ab. Th is br in gs u p an int er face t h at let s y ou con figu re how m uch space t o g ive each v olum e on a disk as show n in Figur e 10 - 7. Fr om t he volum e schem e pop- up menu choose t h e nu mb er of par t it ions y ou w ant an d size t h em how ever y ou w ant u sin g eit her t h e gr aph ical t ool or t y pin gMac sizes par tisit ion. Thim en at click t it ion b ut tTM) on ;t ofor com m iter t he chang Ru nning OSforX each Pant her t he ult e Swt he iss Par Ar my Knife( pow user s w h es. o w Th antist o erases all t h e dat a on t he disk , creat es t h e volu mes, and t h en cr eat es t h e filesy st ems for each cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS v olum e. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 1 0 -7 . Pa r it i oni ng a disk u si ng t h e Di sk Ut i li t y



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e 10.5.1 Adding w ell on you r w ay. a Disk Drive For t he most par t , add ing an in t er n al disk dr iv e t o y our com pu t er is as easy as m aking sur e t h at y ou g et a dr iv e w it h an int erf ace t hat y our com put er sup por t s ( I DE dr iv es f or m ost G3 an d G4 m achines, Ser ial ATA for t h e new er G5 m ach in es) and t hat w ill fit int o y our Mac. Add in g an ext er nal Fir eWir e d riv e is ev en easier ; y ou sim ply p lug it in. I f t h e Fir eWir e dr ive is for m at t ed pr oper ly, it should aut omat ically appear in y our Finder an d in Disk Ut ilit y . I f t h e dr ive is not for m at t ed, it w on' t ap pear in t he Finder , bu t it w ill appear in Disk Ut ilit y . When y ou f irst add a d riv e t o a m achine, y ou sh ould mak e sur e t h at it is for m at t ed t he w ay y ou w ant . Oft en, new har d dr iv es ar r ive fr om t h e fact or y pr efor m at t ed as MSDOS FAT. I f y ou encount er t his w it h a new d riv e, y ou w ill n eed t o r efor m at t he dr iv e as Jour naled HFS using t he Disk Ut ilit y . Th e only except ion t o t his r ule is if y ou w an t t o shar e an ex t ern al FireWir e dr iv e w it h a W in dow s m achine, in w hich case y ou'll wan t t o leave t h e dr iv e for m at t ed as MS- DOS FAT.

Naming Your Partitions All Macs com e w it h t heir har d dr ives nam ed Macin t osh HD. Not only is t h is nam e bor ing , but w hen you enab le file shar ing on m u lt ip le com p ut ers, y ou don 't really w ant t o m ou nt m u lt ip le dr ives all w it h t he sam e n ame acr oss t he net w ork . I • r ecom m en dTable Content t hat ofyou namse y our har d d r iv e som et hing dist inct ive. I usually nam e t he • boot dr iv es Review of m y sm achines w it h t he sam e nam e I give t he m achine it self. Th at w ay , • w hen I hav eReader a bunRev ch iew of sdisk s m ount ed fr om v ar ious m achines, I k now w h ich is • w hich. Er r ata •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.6 Disk Images Disk im ages ( files w it h a . dm g ex t ension) h ave becom e a fr equent par t of lif e on Mac OS X. Or iginally cr eat ed t o st or e t h e block- for - block cont ent s of a flopp y disk for ease of d uplicat ion, t h e disk im ages creat ed and used b y Pant h er ar e b ased on a f orm at called Un iv er sal Disk I m age Form at ( UDI F) . UDI F allowss t h e st orag e of t he sam e par t it ion t ables, disk dr iver s, and v olu m es • Table of Content fou nd on phy sical disks, w hich let s disk im ag es t o ser v e as an int er m ed iar y in t he dup licat ion of • Review s any k ind of disk , including CDs and DVD s. • Reader Rev iew s •

Er r ata

Beyon d t heir orig in as a disk du plicat ion f orm at and because of t heir ease- of - use, disk im ag es ar e • Academic used by m any soft war e v endor s, includ in g Ap ple, as a dist ribu t ion for m at inst ead of .sit ( St uff I t ) , •. t ar , or .zip f Ten her a disk im age ( or use Disk Ut ilit y t o open it ) , Mac OS X iles.Things Wh enI Dig y ouAbout doubPant le- click •uses t he con tScheduling Tasks in Pant her en t s of t he im ag e as t he d at a f or a disk t hat it m oun t s int o t he f ilesyst em , w hich Running Ma c X PFind ant he show s up inOtShe err as sh ow n in Figur e 10 - 8; Figur e 10 - 9 sh ows t he sam e disk im age in Disk UtJam ilit yes . Duncan Davidson By Pub lish er: O'Reilly

10.6.1 Pub DatTypes e: Decem ber of2 00Disk 3 Images I SBN: 0- 59 6- 005 00 -8

Becau Pages: se t hey 32 6can b e used f or m any d iffer ent pur poses, disk imag es hav e sev er al diff er ent t yp es. These ar e:

Ru nning OS im X age Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Read/ Wr itMac e disk cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's corAe,f ixedr evealing he im innage er wt ork s of 'tPant t h dat oseawbhut ow ant allow t o g et t h eamost t heir size dtisk hat ing d oesn justher conf or t ain also s dat t o beout wr itoft en t o it . syst emThese . You disk m ay im not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll ages ar e usef ul if y ou w ant t o h ave an encr yp t ed d at a st or age p oin t , or if byeou w ell onw ant you rt owset ay. u p t he cont ent s of a disk im age b ef ore con ver t ing it t o one of t h e ot her t y pes. This k ind of disk im age occupies t he sam e am oun t of space on a d isk as it s capacit y.

Read Only disk im age A f ixed- size d isk im age t hat on ly allow s dat a t o be read fr om it . This k in d of disk im ag e occu pies t he sam e am oun t of space on a d isk as it s cap acit y .

Figu r e 1 0 -8 . A di sk im a ge m oun t e d i n t h e Fi nde r



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 1 0 -9 . A di sk im a ge m oun t e d i n Di sk U t il it y

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Com pr essed disk im age A r ead- on ly disk w hose con t ent s h ave b een comp ressed , r esult ing in t he size of t h e disk im age being m uch less t h an it s cap acit y . Th is is t he p refer r ed f orm at for dist ribu t ing soft w ar e acr oss t he I nt er net .



Table of Content s

CD/ DVD MastReview er disk • s im age • • • • •

Reader Rev iew s

A d isk im age wh ose int ern al f orm at uses eit h er I SO- 9660 or UDF so it s cont ent s can be Er r ata dir ect ly b ur ned t o a CD or DVD. CD and DVD m ast er d isk im ages end w it h t he . cdr Academic ext ension. Ten Things I Dig About Pant her Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Spar im Davidson age By Jamse es disk Duncan A r ead/ w r it e disk im age f orm at t hat st art s out sm aller on disk t han it s or iginal cap acit y . The disk im age gr ow s in size as needed u p t o eit her it s capacit y or t h e size of t he d isk it is Publocat Dat e: ed Decem 2 00 3 on,ber w hichever is less. Sp arse d isk im ages end w it h t he . spar seim age ex t ension.

Pub lish er: O'Reilly

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

10.6.1.1 Encryption and disk images On e at t r ibut e t hat disk im ag es d on' t shar e w it h t heir ph ysical cousin s is t hat all t h e dat a on a disk im age can be encr yp t ed . This enab les y ou t o st or e d at a on pu blic disks t hat can 't be accessed b y Ru X Pant her ulter im passw at e Sworiss myexKnife( TM) ; for powst eroruser s wable h o wdat anta t on o a anynning bod y Mac w ho OS d oesn 't hav e tishet he p rop d. Ar For am ple, y ou could e v alu cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS k ey chain USB flash dr iv e u sin g an encr yp t ed d isk im age w it h t he kn owledg e t hat if som ebody X's coraccess e, r evealing inn Pant f oraccess t h ose twohtohew dat ant at ostgoretedt hon e most out dofriv t heir gains t o y ourt he key s, erhewwork on'ing t bse of able t oher gain t he USB e. As syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll be w ell, t hese en cr y pt ion feat ur es ar e used b y FileVault t o p rot ect y our Home dir ect or y, if you enable w ell on you r w ay. t his f eat ur e in Syst em Pr eferences.

10.6.2 Working with Disk Images on the Command Line I n addit ion t o D isk Ut ilit y, Mac OS X p rov ides t he hd iut il com m and- lin e t ool t o w ork wit h disk im ages. This t ool h as a w ealt h of opt ions t o cr eat e and man ipulat e d isk im ages, m any of w h ich v en t ur e int o ver y ar cane t er rit or y . I 'm going t o cov er a f ew of t he m ost com m only - used f eat ur es of hd iut il so you can see h ow t o man ip ulat e d isk im ages f rom t he com m and lin e. To m ou nt a disk im age, use t h e follow ing com m and : hdiutil mount imagename

This com m and m ount s t he cont ent s of t he d isk im age in t o t h e / Volu m es f older and it appear s as a disk in t he Finder 's Sid eb ar. Ex am ple 10 - 6 sh ows a disk im age n amed t est .d m g b ein g m ou nt ed.

Exa m pl e 1 0 -6 . M oun t i ng a di sk im ag e usin g h di ut i l

$hdiutil mount test.dmg Initializing... Attaching... Finishing... •

Table of Content s

• Finishing... Review s •

Reader Rev iew s

/dev/disk2 • Er r ata •

Apple_partition_scheme

Academic

/dev/disk2s1 • Ten Things Apple_partition_map I Dig About Pant her •

Scheduling Tasks in Pant her

/dev/disk2s2 Running Ma c O S X

P ant he Apple_HFS r

/Volumes/test

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub yDat 00 3 im age, y ou'll see sever al it ems t hat sh ould be f amiliar f rom looking at When oue:mDecem ou ntber a 2disk disk s. There ser ies of slices t o t h e disk including a par t it ion map . The ou t pu t of t h e disku t il I SBN: 0-ar 59e 6- a 005 00 -8 com man d also Pages: 32 6 g ives y ou t he f ilesy st em locat ion w here t he disk im age w as m oun t ed.

You ar en 't lim it ed t o m oun t ing disk imag es in t o t h e / Volu m es f older . The f ollow in g com m and can be u sed t o mou nt t he cont ent s of a disk im age int o any direct or y in t he f ilesyst em : hdiutil mount -mountpoint directory imagename Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on onlyyou w ay. The catr ch her e is t h at t h e dir ect or y y ou are mou nt ing t he disk dr ive in t o h as t o ex ist in t he filesyst em . The cont ent s of t he d irect or y t hat you ar e m oun t ing t he d isk im age in t o w ill also be hidd en b y t he cont en t s of t he d isk im age. Ex am ple 10 - 7 sh ows an ex am ple of t his com m and:

Exa m pl e 1 0 -7 . M oun t i ng a di sk im ag e in t o t he f il esy st e m

$hdiutil mount -mountpoint /Foo test.dmg Password: Initializing... Verifying... Checksumming DDM... DDM: verified

CRC32 $70362E53

Checksumming Apple (Apple_partition_map : 0)... Apple (Apple_partition_map : 0): verified

C

RC32 $DFA2282D Checksumming (Apple_Free : 1)...

(Apple_Free : 1): verified •

CRC32 $00000000

Table of Content s

Checksumming Apple_HFS_Untitled_2 (Apple_HFS : 2)... • Review s •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

..............................................................................

•Apple_HFS_Untitled_2 Scheduling Tasks in Pant her (Apple_HFS : 2): verified

CRC32 $2877B09E

Running Ma c O S X P ant he r By Jam es Duncan Davidson Checksumming (Apple_Free : 3)...

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

(Apple_Free : 3): verified

CRC32 $00000000

Pages: 32 6 Verification completed...

verified CRC32 $3CAEE635 Attaching... Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust Finishing... om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst Finishing... em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. /dev/disk5 Apple_partition_scheme /dev/disk5s1

Apple_partition_map

/dev/disk5s3

Apple_HFS

/Foo

To u nm oun t a disk imag e use t he follow in g com m and : hdiutil unmount mountpoint

Here, t h e m ount poin t is t he pat h of t h e fold er w h er e t h e disk im age is m oun t ed .

10.6.3 Creating an New Disk Image To cr eat e a n ew em p t y r ead / w rit e d isk im age usin g Disk Ut ilit y :

1 . Use D isk Ut ilit y' s I m ages New Blank I m age m enu, or t he New I m age but t on on Disk Ut ilit y ' s t oolbar . A dialog w ind ow opens, as sh own in Figur e 10 - 10.

Figu r e 1 0 -1 0 . Op t ion s f or cr e at in g a di sk im a ge •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst 2 . em Select . Yout he m ay size notofbe t he a Mac d isk gu im ru age. w hen Th isy size ou stgarover t t his ns book t he disk , b utimonce age'syou capacit 'v e r ead y . As it , wyou it h 'llhar b ed w ell on dr iv you es,r kweep ay. in m in d t hat t he size of a d isk im age doesn 't eq ual h ow m uch dat a it can act ually hold because of filesy st em ov er head. 3 . Select w h et h er or not y ou w an t t o en cr y pt t he d isk im age. 4 . Select t he k ind of disk imag e t o cr eat e. When you cr eat e a new d isk im age, y ou hav e y our choice of a r ead/ w r it e disk imag e or a sp arse d isk im age. For m ost p ur poses, t he st and ard r ead / w rit e disk im ag e is appr op riat e. When y ou h it t h e Cr eat e but t on, a disk imag e w ill be cr eat ed and m oun t ed int o t he Find er and int o t he filesy st em in / Volu m es. By d ef ault , t he disk im age cont ain s a single HFS+ v olum e. To chan ge t he for m at of t h e volu me t o HFS or t o UFS, sim ply h ig hlight t he volum e in Disk Ut ilit y and use t he Er ase t ab, just as y ou w ou ld w it h an act ual p hy sical disk . To cr eat e a d isk im age on t h e comm an d line, u se t he f ollow ing hd iut il com m and: hdiutil create -volname volumename -fs fstype -size size imagename

w her ev olu m enam e is t he nam e of v olum e y ou w ant t o cr eat e, fst y pe is one of of t he filesy st em t y pes list ed in Table 1 0- 2, an d size is t he size of t he d isk im age ex pr essed as a n um ber follow ed by eit her b ( wh ich st and s for sect or s, not b yt es) , k ( for k iloby t es) , m ( for m egaby t es) , g ( for gigab yt es) , t ( for t er aby t es) , p ( for p en t aby t es) , or e ( for ex aby t es) .

Tab le 1 0 - 2 . Fi le sy st em t y pe code s used by h diu t i l File syst e m Ty pe Code • HFS+ • •

HFS+

J

Table of Content s Review s Reader Rev iew s

• HFS

Er r ata



Academic

De scr ip t ion Jour naled HFS+ HFS+ ( non j ou rn aled) Or iginal HFS

The • MS- DOS Ten Things I Dig About Pant her •

UFS

FAT f ilesystem used by MS- DOS

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

The Un ix f ilesy stem ( Ber k eley Fast File Sy st em )

By Jam es Duncan Davidson

Ex am ple 10 - 8 sh ow s how t o cr eat e a 10 MB disk imag e. Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 005. 00 -8 ea t in g a ne w disk i m ag e Exa mI SBN: pl e 0-15906--8 Cr Pages: 32 6

$hdiutil create -volname Foo -fs HFS+ -size 10m foo.dmg Initializing... Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Creating... X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e ............................................................................... w ell on you r w ay. Finishing... created: /Users/duncan/foo.dmg

To cr eat e an en cr y pt ed disk imag e, add t he - encry pt ion ar g um en t t o t he com m and. Applied t o t h e com man d in Ex am ple 10 - 8, it looks lik e: hdiutil create -encryption -volname Foo -fs HFS+ -size 10m foo.dmg

By def ault hd iut il cr eat e cr eat es read/ w r it e d isk im age f iles. Creat ing ot her k ind s of disk imag e files r eq uir es t he u se of t h e - for m at ar g um en t along w it h a f our - let t er cod e. The com plet e list of codes is giv en in Table 1 0- 3. For ex amp le, t o cr eat e a spar se disk imag e, you w ould use t h e follow ing com man d: diskutil create -format UDSP -voname Foo -fs HFS+ size 10m foo.dmg

Tab le 1 0 - 3 . Com m onl y disk ut il di sk im a ge for m a t code s Cod e

De scr ip t ion

UDRW

Read/ wr it e

UDRO

Read only

• UDZO

Table of Content s



Review s

• UDTO

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

Compr essed DVD/ CD mast er

10.6.4 Creating a Disk Image from a Folder • Scheduling Tasks in Pant her Running Ma c O S X P ant he r

To cr eat e a d isk im age t hat holds t h e cont ent s of a folder u sin g D isk Ut ilit y: By Jam es Duncan Davidson

lish er: O'Reilly 1 .PubUse D isk Ut ilit y' s I m ages New I m age From Fold er , or t he New I m age bu t t on on Disk Ut ilit y ' s t oolbar Pub Dat e: Decem ber 2 .00An 3 Open dialog w in dow ap pears giv in g y ou t he ch ance t o select a f old er t o creat e t he disk im I SBN: 0- 59 6- 005 00 -8 age. Select t he f old er you w ant t o cr eat e an imag e fr om an d hit t h e Open bu t t on.32 6 Pages:

FileVault Implementation Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's e, r FileVault evealing tin hePan innter w ork ing sencr of Pant h ose w hyoour w ant t o gfolder et t h e, most Thecor n ew her, w hich yp t sher all ftor h et dat a in Home uses out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r eadait , you 'll b e disk im ages un der t he cov er s t o per for m it s m ag ic. W hen y ou en able FileVault for wuser, ell onall you r w ay. t he user ' s dat a is placed int o an en cr y pt ed sp arse d isk im age. Wh en a user logs in t o a m achine, t he sp arse d isk im age h olding t heir dat a is m oun t ed int o t he / User s f older . When t hey log out , t he disk im age is u nm ount ed, mak ing any dat a in t he user ' s Hom e dir ect or y inaccessible. As of v er sion 10. 3. 1, w hen y ou enable FileVau lt for a u ser , t he dat a t hat was in t h eir or iginal Hom e f older is erased. I t is, how ev er , t he sam e k ind of er ase t hat hap pens w hen you dr ag f iles t o t he t r ash. Th is m ean s t hat any d at a t h at w as in a user ' s Home fold er befor e FileVault w as en abled could pot en t ially b e r ecov er ed. Th e best t im e t o enable FileVau lt f or a u ser is b ef or e any sensit iv e d at a is p laced in t o t h eir Hom e fold er .

2 . A d ialog w ind ow, con fu sing ly t it led Con ver t I m age, op en s, let t in g y ou set t he op t ions f or t he disk im age, as show n in Figur e 10 - 11. 3 . Select t he k ind of imag e t o cr eat e. Sin ce you ar e cr eat ing an im age w it h dat a, you can select fr om read- on ly, com pr essed, D VD/ CD m ast er , as well as r ead/ w r it e. 4 . Select w h et h er or not y ou w an t t o en cr y pt t he cont en t s of t he d isk im age. When y ou h it t h e Cr eat e but t on, t h e disk im age is cr eat ed. Un lik e w hen you cr eat e an im age, it w ill not be m oun t ed.

To cr eat e a d isk im age fr om a folder on t he com m and line, use t h e follow ing hd iut il com m and:

hdiutil create -srcfolder folder imagename



Table of Content s

•w her efolder is Review t he spat h t o t he folder t h at y ou w ant t o im age and im agenam e is t he nam e of t h e ExRev amiew ples 10 - 9 sh ows t he cr eat ion of a disk im ag e fr om t h e Docum ent s d ir ect ory •r esult in g im age. Reader dirr ata ect ory : •in t he Hom e Er •

Academic



Ten Things I Dig About Pant her

Exa m pl e 1Scheduling 0 -9 . CrTasks ea t in inPant g aherdisk i m age w it h t h e cont en t s of a di r ect or y • Running Ma c O S X P ant he r By Jam es Duncan Davidson

$hdiutil create -srcfolder ~/Documents Documents.dmg Pub lish er: O'Reilly

Pub Dat e: Decem ber Initializing...

2 00 3

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 Creating...

Copying... ............................................................................... Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Converting... cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Preparing syst em . You imaging m ay not engine... be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Reading DDM... (CRC32 $FA1A8A19: DDM) Reading Apple_partition_map (0)... (CRC32 $5BC1024A: Apple_partition_map (0)) Reading Apple_HFS (1)... .............................................................................. (CRC32 $B732C490: Apple_HFS (1)) Reading Apple_Free (2)... (CRC32 $00000000: Apple_Free (2)) Terminating imaging engine... Adding resources... ...............................................................................

Elapsed Time: 24.503s (1 task, weight 100) File size: 31918290 bytes, Checksum: CRC32 $001F90E7 Sectors processed: 188034, 173057 compressed •Speed: 3.4Mbytes/sec Table of Content s • Review s

Savings: 66.8% • Reader Rev iew s •

Er r ata

Finishing... • Academic •

Ten Things I Dig About Pant her

created: /Users/duncan/Documents.dmg • Scheduling Tasks in Pant her Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er:, O'Reilly By def ault t h e disk imag es t hat hd iut il cr eat es fr om a dir ect or y ar e r ead - only . To cr eat e a Decemim berag 2 00 r eadPub / wDat rit ee: disk e, 3 use t he f ollowin g sy nt ax f or t h e hd iut il com m and: I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

hdiutil create -srcfolder folder -format UDIF imagename

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, Converting r evealing t he inn w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir 10.6.5 a erDisk Image syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w you r weay. Onellceon y ou hav w or ked w it h a disk im age in one f or mat , su ch as r ead/ w r it e, y ou m ay w an t t o conv er t it t o r ead - only for m at , so t hat it is com pr essed an d r eady t o post t o t h e I nt ern et , or conv er t it int o a CD m ast er t hat is r eady for dup licat ion. To conv ert an imag e using Disk Ut ilit y , use t h e I mag es Con ver t m enu opt ion , select t he disk you w ant t o con ver t , and t h en use t h e Cov ert Disk dialog box t h at ap pears t o select t he k ind of im ag e you w ant t o con ver t it t o. Th is dialog box is show n in Figur e 10 - 11.

Figu r e 1 0 -1 1 . Op t ion s f or cr e at in g a di sk im a ge f r om a di r ect or y



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

To con t aDecem diskber imag Pub ver Dat e: 2 00 3e on t he com m and lin e, use t he hd iut il conv ert com m and as f ollow s: I SBN: 0- 59 6- 005 00 -8

hdiutil convert -format format -o outputfile imagefile Pages: 32 6

Wher e for m at is t he f our - let t er code t hat t he d isk im age w ill b e conv er t ed t o, out p ut f ile is wh er e t o Ru nning Pant ult im atis e tSw Ar im myage Knife( TM) ;erfor pow user w hsh ow anthow to to save t he Mac new OS diskX im ag her e, anisd t he im agefile heiss disk t o conv t . Ex amerple 10s- 10 ows cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS use t h is com m and t o con ver t a disk im age t o a com pr essed d isk im age. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you Exa m pl e r 1w0ay. -1 0 . Conv e r t in g a disk i m age t o a com pr e sse d di sk im a ge

$hdiutil convert -format UDZO -o Compressed.dmg Documents.dmg Preparing imaging engine... Reading DDM... (CRC32 $EEB3C0C1: DDM) Reading Apple_partition_map (0)... (CRC32 $5A2C9F73: Apple_partition_map (0)) Reading Apple_HFS (1)... .............................................................................. (CRC32 $C7097C7F: Apple_HFS (1)) Reading Apple_Free (2)...

............................................................................... (CRC32 $00000000: Apple_Free (2)) Terminating imaging engine... Adding resources... •............................................................................... Table of Content s •

Review s

Elapsed Time: 23.061s • Reader Rev iew s •

Er r ata • (1 task, weight Academic 100) •

Ten Things I Dig About Pant her

File size: Scheduling 48394357Tasks bytes, CRC32 $79BEA1E4 • in PantChecksum: her Running Ma c O S X P ant he r

Sectors processed: 258898, 238321 compressed By Jam es Duncan Davidson

Speed: 5.0Mbytes/sec Pub lish er: O'Reilly

Savings: Pub Dat e: 63.5% Decem ber

2 00 3

I SBN: 0- 59 6- 005 00 -8

created: Pages: Compressed.dmg 32 6

Ru nning Creating Mac OS X Pant her is tImage he ult im at e Sw iss my Knife( TM) ; for pow er user s w h o w ant t o 10.6.6 a Disk from a Ar Device cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cordisk e, r evealing t he hinn w ork f or h ose w h o w ant o gtet t h emap most of ur t heir Since im ages can olderall t heing dats aofonPant a dher isk d rivte, including t h e tpar it ion , itout ' s nat al syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll be a t hat y ou can cr eat e a disk im age dir ect ly fr om eit her a d isk d r iv e or a v olu m e on it . By creat ing w ell im on age you fr rom w ay.a dr iv e, you can lat er rest or e t hat imag e back ont o t h e dr ive or ont o any ot h er disk dr iv e. You can use t h is for b ack up pu r poses or t o cr eat e a m ast er disk imag e for a depar t m ent or com pany , m ak in g it easy for y ou t o clone on e inst allat ion on t o ev er y m achine. To cr eat e a disk im age f rom a disk dr iv e using Disk Ut ilit y , select t he dr iv e and t hen select I m ages New I m age fr om diskn am e f r om t he menu b ar. Her e, diskn am e is t he nam e of t h e v olu m e you 'v e select ed in Disk Ut ilit y ' s lef t p ane.

Keep in m in d t hat if y ou w ant t o clone t h e dr ive or par t it ion t hat con t ains y our inst allat ion of Mac OS X, y ou shou ldn' t u se Disk Ut ilit y t o accom plish t his t ask w h ile t he sy st em is r un ning . I nst ead , y ou sh ould eit her b oot f r om Pant h er ' s I nst all Disc 1, or put y our Mac int o t arg et m ode an d m oun t it s dr iv e( s) via Fir eWire on an ot her syst em .

Cr eat ing an im ag e of a dev ice fr om t h e com m and line is a bit t rick ier . Th er e isn' t a dir ect com man d in hd iut il, so y ou hav e t o use t he conv er t com m and and conv er t fr om t h e disk' s d ev ice in t he / dev d irect or y. Ex am ple 10 - 11 sh ows how t o creat e a comp ressed disk im age of an ext er nal FireWir e dr ive mou nt ed at / dev / disk 1. Since t h is com m and accesses t he r aw d ev ice of t he d isk , t he com m and m ust b e r un by a user w it h ad m in ist r at iv e pr iv ileges.

Exa m pl e 1 0 -1 1 . Cr e at in g a di sk im a ge f r om a de vi ce

$sudo hdiutil convert /dev/disk1 -format UDZO -o /FirewireBackup.dmg Preparing imaging engine... Reading DDM... • •

Table of Content s

(CRC32 $70362E53: DDM) Review s

•Reading Apple_partition_map Reader Rev iew s (0)... • Er r ata • •

Academic (CRC32 $DFA2282D: Apple_partition_map (0)) Ten Things I Dig About Pant her

•Reading Apple_Free Scheduling Tasks in Pant her (1)... Running Ma c O S X P ant he r

(CRC32 $00000000: By Jam es Duncan Davidson

Apple_Free (1))

Reading Apple_HFS (2)... Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 .............................................................................. I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 (CRC32 $15DC1C94:

Apple_HFS (2))

Reading Apple_Free (3)... ............................................................................... Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Apple_Free cust(CRC32 om ize, t $00000000: w eak , and g en er ally r ev u p(3)) t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Terminating syst em . You mimaging ay not be engine... a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Adding resources... ............................................................................... Elapsed Time: 11.784s (1 task, weight 100) File size: 1433395 bytes, Checksum: CRC32 $43A4EE39 Sectors processed: 58605120, 62161 compressed Speed: 2.6Mbytes/sec Savings: 100.0% created: FirewireBackup.dmg

10.6.7 Burning a Disk Image to CD or DVD

Bur nin g an im age t o CD or DVD fr om Disk Ut ilit y is simp le; ju st select t h e disk imag e and click t h e Bur n but t on. Make sur e t h at t h e im age doesn' t cont ain m or e dat a t han t he disc you ar e bu rn ing t o. CDs can hold up t o 6 60 MB an d DVDs can hold up t o 4 .7 GB. I t 's just about as easy fr om t h e comm and line. Sim ply use t h e hd iut il bu r n com m and as show n in Ex am ple 10 - 12.

•Exa m pl e 1 Table 0 -1of2Content . Usi sng •

Review s



Reader Rev iew s



Er r ata

t h e hdi ut il bu r n com m an d

• hdiutil burn Academic $ Documents.dmg •

Ten Things I Dig About Pant her

Please insert a disc: • Scheduling Tasks in Pant her Running Ma c O S X P ant he r

Preparing data for burn By Jam es Duncan Davidson Opening session Pub lish er: O'Reilly Pub Dat e: Decem ber Opening track

2 00 3

I SBN: 0- 59 6- 005 00 -8

Writing Pages: track 32 6 ............................................................................... Closing track Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Closing cust om ize,session t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Finishing syst em . You burn m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Verifying burn... Verifying ............................................................................... Burn completed successfully ...............................................................................

hdiutil: burn: completed

10.6.8 Restoring a Drive Image to a Drive To r est or e t he cont ent s of a d isk f rom a d isk im age, u se D isk Ut ilit y' s Rest or e panel, as sh own in Figur e 10 - 12, an d u se t he f ollow ing p rocess: 1.

1 . Eit h er dr ag a disk im age t o t he Sou rce t ex t f ield or click t he I m age bu t t on and select t h e im age y ou wan t t o r est or e f rom . 2 . Dr ag t he d isk t hat y ou w ant t o r est ore t o f rom t he left - h and colu m n t o t he Dest in at ion t ex t field.



of Content Figu r e Table 1 0 -1 2 . Usis ng Di sk Ut i li t y t o r est or e a di sk fr om a disk i m age



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

3 . Op t ionally, click t he Erase D est inat ion check box if y ou w ant t o r eplace t he cont en t s of t he disk w it h t he d isk im age. 4 . Click t he Rest or e bu t t on.

You should be aw ar e t h at it is possib le t o r est or e t h e cont ent s of a dr ive t o anot h er dr ive t hat is eit her lar ger or sm aller t han t he or igin al dr ive. As lon g as t h er e is enou gh sp ace on t he t ar get dr iv e t o hold t he d at a b ein g m ov ed t o it , Disk Ut ilit y w ill t ake car e of t h e r est .

10.6.9 Moving the Contents of One Drive to Another

You can u se t he Rest or e panel of D isk Ut ilit y t o cop y one d isk t o anot h er . Th is is usef ul wh en y ou w ant t o m ov e a perf ect cop y of y our boot disk t o anot her d riv e. For exam ple, y ou cou ld copy a disk t o an ex t ern al FireWir e dr ive and t hen use t hat dr ive as a m ast er disk im age f or r est or ing t he disk ont o ot her m achines. To d o t h is using t he Rest or e pan el, select a d isk as t he sour ce inst ead of a d isk im age. This f eat ur e is esp ecially hand y w hen you w ant t o u pgr ade t he b oot dr iv e in a m achine. For exam ple, if y ou wan t ed t o up gr ade t h e har d dr ive in y our Pow er Book, you could use t he f ollow in g • Table of Content s pr ocess: •

Review s



Reader Rev iew s

• 1. • •

Errr ata Boot you syst em using t he Mac OS X I nst all Disk 1. I nst ead of pr oceed in g wit h t h e inst all, use I nstAcademic aller Op en Disk Ut ilit y menu t o launch Disk Ut ilit y . Ten Things I Dig About Pant her

• 2.

Plug in Scheduling an ex t ern Tasks al Fir eWir e her dr ive ( eit h er one t hat y ou own or h ave begged or bor r ow ed f rom in Pant som Running Maeon c O Se)X. PMake ant he r su re t hat t he FireWir e dr iv e is larg e enoug h t o hold t he con t en t s of y our har d dr ive. By Jam es Duncan Davidson

3 . Click t he Rest or e t ab of Disk Ut ilit y ( ref er t o Figur e 10 - 10) . Pub lish er: O'Reilly

4 .PubSet Sourber ce2 00 of3t he r est ore t o y our in t er nal boot dr ive. Datte:h e Decem I SBN: 0- 59 6- 005 00 -8

5 . Set t h e Dest in at ion of t he r est or e t o y our ext er nal Fir eWire dr iv e. Pages: 32 6

6 . Click Rest ore and go h ave a coff ee at y our local cof fee shop w hile Disk Ut ilit y copies t he dat a fr om t he int er nal d r iv e t o t he ex t ern al. 7 . When Disk Ut ilit y is d one, exit t he in st aller and pow er d own y our sy st em . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o 8 . om Replace he ,drand ive gineny er our com You Mac. should r efber t o tAp ple's d ocusment ion f orMac y ourOS cust ize, t w teak ally r evput u pert.heir This ook ak es reader deepatin side m odel of Mac t o help you . X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e 9 . On ce t he new d riv e is inst alled, boot y our sy st em wit h t h e Mac OS X I nst all D isk 1 again . And w ell on you r w ay. once ag ain , launch Disk Ut ilit y . 1 0 . Verif y t hat t he new disk dr iv e appear s in t he d riv e list . Mak e sur e t hat it is f or mat t ed t o use Jour naled HFS+ . 1 1 . Using t h e Rest ore t ab, m ak e t he ex t ern al FireWir e dr iv e t he Sou rce an d t h e new int er nal har d dr ive t he Dest inat ion. 1 2 . Click Rest ore and go h ave som e m or e coff ee. When Disk Ut ilit y is d one, y ou' re alm ost d one. You ju st need t o check t o m ak e sur e t hat y our disk is set up t o boot . Usually Disk Ut ilit y d oes t he r ight t h in g if each d isk only has a sin gle par t it ion on it , b ut w h en y ou are mov ing dat a ar ound on disks w it h m ult ip le par t it ions, t hing s m ight not alw ays wor k ou t so well. You can check t he boot st at u s of y our dr iv e w it h t he bless com m and, as show n in Ex am ple 10 - 13 ( replacing New D riv e w it h t he n ame of y our dr ive) .

Exa m pl e 1 0 -1 3 . Ch eck i ng you r d r iv e

$sudo bless -info /Volumes/NewDrive finderinfo[0]:

2589 => Blessed System Folder is /Volumes/NewDrive/System/Library/

CoreServices finderinfo[1]:

0 => No Startup App folder (ignored anyway)

finderinfo[2]:

0 => Open-folder linked list empty

finderinfo[3]:

0 => No OS 9 + X blessed 9 folder



Table of Content s



Review s

finderinfo[4]:

0 => Unused field unset



Reader Rev iew s finderinfo[5]: 2589 => OS X blessed folder is //Volumes/NewDriveSystem/Library/ •

Er r ata

•CoreServices Academic •

Ten Things I Dig About Pant her

•64-bit VSDBScheduling Pant her volume Tasks id: in 0xCE442C88EEA5FF45 Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

I f you d on't hav e a blessed sy st em folder ( y ou' ll see No Blessed Sy st em Fold er in t h e out pu t ) , y ou Pub Dat e: Decem ber 2 00 3 can bless it w it h t h e follow ing comm an d ( r eplacing New Dr iv e w it h t he nam e of y our dr ive) : I SBN: 0- 59 6- 005 00 -8 Pages: bless 32 6 $ sudo -folder /Volumes/NewDrive/System/Library/CoreServices

Ch eck t h eMac disk w ither h t he m and. ev er yTM) t hin; gfor is fpow ine, er y ou ar se w r eady t o r eb Ru nning OSagain X Pant is tbless he ult—info im at e com Sw iss Ar myI fKnife( user h o w ant t o oot y ourom Mac. r syst em gwen ill er boot omu tphet heir int erMac. nal hThis ar d b d riv hin g ev er happ en edMac , except cust ize,You t w eak , and ally frr ev ooke tlike ak esnot reader s deep in side OS t hatcor t he d dr iv e tshou ld er n ow being eitsher b ig ger f ast r eplaced it h . X's e, har r evealing he inn w ork of Pant herorf or t her osedepending w h o w anton to w g hat et t hyou e most out ofit t w heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.7 Creating a RAID The last feat ur e t h at Disk Ut ilit y and it s r elat ed comm and - line t ools enab les is t h e use of a Redu ndan t Ar r ay of I ndependent Disk s ( RAI D) , w h er e m ult iple d isk s ar e com bined in t o on e v irt u al disk . I n g en er al, RAI D solut ions ar e d esign ed for increased d at a av ailabilit y and int egr it y. ov er ead ofs m aint aining d at a acr oss a set of disk s for t he f ault t oler ance t hat •They t r ade t he Table of h Content using m ult iple d riv es • Review s can p rov ide. •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

Ther e ar e sev eral t yp es of RAI D in use t od ay. These ar e:



Scheduling Tasks in Pant her

RAI D0 Running

Ma c O S X P ant he r

By Jam es Duncan Davidson

Dat a is st rip ed acr oss t w o or m or e disk s giv in g in cr eased I / O perf or man ce; if each disk is on a separ at e disk cont r oller , t his allows for lar ge v ir t ual d isk s. This t yp e of RAI D p rov ides Pub no lish er: O'Reilly pr ot ect ion again st disk failur e. I f a d isk f ails, all t he d at a on t h e disk set is lost . Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

RAI D 1

Dat a is m irr or ed acr oss t w o dr iv es givin g com plet e dat a r ed und ancy. I f on e disk fails, t h e ot her st ill h as all t he d at a n eeded t o k eep g oin g. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS RAI D D 4, RAIt he D 5inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir X's cor3,e,RAI r evealing syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e lt ipr lew disks w ell onMuyou ay. ( t hr ee or m ore) are u sed t o bot h st rip e dat a for p er f orm an ce an d t o k eep par it y inf or mat ion t o pr ov id e for redu ndan cy in case a d isk f ails. Because dat a is split an d du plicat ed am ong m any disk s, t his t y pe of RAI D r equir es sig nificant com p ut at ion pow er. Mac OS X pr ovides sup por t f or RAI D 0 ( st ripin g) an d RAI D 1 ( m ir ror ing ) . Bot h t y pes of RAI D can be p er f orm ed w it h accept able p er f orm ance in soft w ar e. The ot h er for m s of RAI D are not supp ort ed in sof t w ar e as t he in cr eased ov er h ead w ould creat e t oo lar ge a p er f orm an ce h it t o be w or t hw hile. I f you r equir e RAI D 3, 4 , or 5, you shou ld t ak e a close look at har dw ar e solu t ions such as Apple's Xser ve RAI D, w hich has dedicat ed pr ocessors t o han dle t h e ex t r a ov er head, or ot her t h ird - par t y RAI D solu t ions. To cr eat e a RAI D set using Disk Ut ilit y , u se t he RAI D pan el, as sh own in Figur e 10 - 13. D rag t h e disk s t hat you w ant t o be par t of you r RAI D t o t h e Disk t able, select t he RAI D schem e, and t hen click t h e Cr eat e bu t t on. To cr eat e a RAI D set using t h e com m and line, use t h e disku t il cr eat eRAI D com m and as f ollow s: diskutil createRAID [mirror|stripe]setname filesystemtype diskids...

Ex am ple 10 - 14 sh ows how t o creat e a st rip ed RAI D set using t w o d isk s w it h t he d ev ice I D s of disk1 an d disk2 :

Exa m pl e 1 0 -1 4 . Cr e at in g a RAI D se t usin g t he com m a nd li ne

$diskutil createRAID stripe RAID "Journaled HFS+" disk2 disk3 The RAID has been created successfully



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

10.8 Further Explorations I f you f ind you rself usin g t he t ools in t his ch apt er ext ensiv ely , y ou sh ould con su lt t h e follow ing m anpag es for m or e inf orm at ion : • • • • • • •

disku t il

Table of Content s Review s

m ount Reader Rev iew s Er r ata

um oun tAcademic Ten Things I Dig About Pant her

hd iut il Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Figu r e 1 0 -1 3 . Cr e at in g a RAI D usin g D isk Ut il it y Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Part III: Advanced Topics This p art of t he book cover s adv anced t opics such as how t o w or k w it h D ir ect ory Ser v ices, t he pr int ing syst em of Mac OS X, n et wor k ing, and how t he v ariou s net w or k ser v ices w or k. • • • • • • •

Table Content Ch apt ers in tof h is par t sof t he book in clu de: Review s Reader Rev iew s

ChEr apt er 11 , Op en Dir ect or y r ata Academic

Ch apt er 12 , Pr in t in g

Ten Things I Dig About Pant her

in Pant ChScheduling apt er 13 ,Tasks Net w ork ingher

Running Ma c O S X P ant he r

Ch apt er 14 , Net w ork By Jam es Duncan Davidson

Ser v ices

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 11. Open Directory Op en Dir ect or y , t h e dir ect or y ser v ices lay er of Mac OS X ( see Figur e 11 - 1 f or a det ailed v iew ) , pr ov ides t he essen t ial ser v ice of p rov iding inf or mat ion t o t he sy st em about users, m achines, pr int er s, and m uch mor e. I t 's also som et hin g t h at m ost p eop le kn ow v ery lit t le ab out . To m any , •it 's my st eriouTable of Content s because it s snam e conn ot es a t ie t o t he idea of a f ilesyst em dir ect ory . I n r ealit y •Op en Dir ect or Review s y d oesn' t h ave mu ch at all t o do w it h t h e filesy st em ot her t h an t h e fact t hat it s •dat a is ar ran Reader iew s chical t r ee. ged in Rev a hierar •

Er r ata

par t , how ev er , Open D irect or y is an en ig m a because t he role it play s is cen t ral •For t he most Academic syThings st em It hat it 's har d ther o dist ing uish w hat it 's doing. At Ap ple' s 20 03 Wor ldw ide •enoug h t o t he Ten Dig About Pant er ence ( WWD C) ,her an App le em ploy ee r et old a st or y ab out h ow m anag em ent •Dev eloper 's Conf Scheduling Tasks in Pant alw ays Ma wan t ed see Running cO S X tPoant he ra dem o of d ir ect ory ser vices. His response w as sim ply , " Did y ou m ak e it past t he login w indow ? [ I f so, ] w ell, t h at 's t he dem o. " By Jam es Duncan Davidson

Ev ery t ime you log in , w het her t h r ough a local or a net w or k accou nt , an d ev ery t im e y ou br ow se lish er: O'Reilly for Pub Macin t oshor Window s- based file ser v er s, y ou are usin g Open Direct or y. When you log in t o y ourPub Mac using Dat e: Decemt he ber 2login 00 3 w indow , t he login w indow con su lt s Open Dir ect or y t o see w h et h er or not y ouI SBN: h ave a v alid 0- 59 6- 005 00u-8ser nam e and passw ord f or t he sy st em. I f Open D ir ect ory in dicat es t hat t he usern am e and Pages: 32 6 passw ord ar e ok ay, log in p r oceeds. I f not , y ou' r e challen ged u nt il y ou eit h er get it r ight or y our ent r y is r efu sed. When you w ant t o conn ect t o a ser v er , t he Finder consult s Open Dir ect or y f or a list of ser ver - based f ilesy st em s. I n lar ge net w ork s, Op en Dir ect or y can be u sed t o conf ig ur e pr int er s, m ail set t ing s, and m uch mor e. This chap t er giv es y ou an over v iew of w h at d ir ect ory ser vices ar e, wh er e t h ey cam e f r om, and Ru nning Mac OS X Pant her Iis t he ult Swhiss my TM)ices ; forare pow er user s w hOS o wXant w hat pr oblem s t hey solve. t also shim owat s eyou owArdir ectKnife( or y serv u sed in Mac by t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Op en Dir ect or y an d h ow t o con nect t o ser v er s t h at p rov ide d ir ect ory in for m at ion lik e Mac OS X X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Serv er , Act iv e D ir ect ory , an d Net I nf o. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

11.1 Open Directory in Action To h elp exp lain h ow Op en Dir ect or y is u sed in Mac OS X, let ' s look at a f ew ex am ples. When you ent er y our u ser nam e and passw or d in t o t h e login win dow , t he follow ing st eps happ en : • •

Table of Content s

1 . The log in w ind ow calls Open Direct or y w it h a r eq uest t o aut hent icat e t he user . Review s

• 2. • •

Academic

• 3. •

Reader iewes s t he user nam e an d p assw or d and if t he u ser ex ist s, look s up t he Op en Dir ect or Rev y t ak r ata aut h en tEr icat ion m et hod.

Using t hTen e prThings oper IpDig rocess erher ned by t h e aut h en t icat ion m et hod, Open Dir ect or y at t em pt s Aboutgov Pant t o validat e t he passw Scheduling Tasksorind.Pant her

Running Ma c O S X P ant he r

4 . Op en Dir ect or y ind icat es w h et h er or not t he u ser w as au t hent icat ed t o t he log in w ind ow .

By Jam es Duncan Davidson

5 . I f t he u ser w as au t hent icat ed, t h e login win dow p roceed s t o cr eat e a GUI session f or t he Pubuser. lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

6 . As t h e0-GUI session I SBN: 59 6- 005 00 -8 is cr eat ed , Open Dir ect or y is q ueried t o g iv e t h e locat ion of t h e user ' s Hom e fold er . Pages: 32 6

This b asic p r ocess of quer y in g Open Direct or y for user in for m at ion is follow ed by all par t s of t he syst em t h at eit her k now h ow t o use Op en Dir ect or y or are u sin g it behind t h e scenes by usin g t he PAM ( p lu ggab le aut h en t icat ion m odules) f unct ionalit y b uilt int o m any Unix - based app licat ions. For ex amp le, wh en y ou log in t o you r comp ut er r em ot ely v ia SSH, t h e follow ing Ru nning Mac st eps occu r : OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir 1 . em ssh d ( t he SSH d aem get s t hy eouusern d foryou t he syst . You m ay notser bever a Mac guon) ru w hen st ar tame t his and bookpassw , b ut or once 'v eu ser r eadr equest it , youing 'll bteo logyou in . r w ay. w ell on 2 . ssh d t hen m ak es a PAM call t o au t hent icat e t h e user . Th is is hand led by Open Direct or y. 3 . Op en Dir ect or y t ak es t he user nam e an d p assw or d and if t he u ser ex ist s, look s up t he aut h en t icat ion m et hod. 4 . Using t h e pr oper p rocess gov er ned by t h e aut h en t icat ion m et hod, Open Dir ect or y at t em pt s t o validat e t he passw or d. 5 . Op en Dir ect or y ind icat es w h et h er or not t he u ser w as au t hent icat ed t o ssh d. I n addit ion, t he act of b r owsing t h e net w ork for f ilesy st em s w hen you u se t he Finder 's Go Con nect t o Ser v er ( - K) menu causes a look up int o Open Dir ect or y w hich t hen pr esent s t h e inf orm at ion t hat it f inds usin g LDAP, Net I nf o, Rend ezv ous, SMB, SLP, an d Ap pleTalk . Open Dir ect or y is also u t ilized by Ter m in al's File Con nect t o Ser v er ( Shift - - K) com m and , w hich allow s you t o creat e a con nect ion t o Rendezv ous- enabled com pu t ers t hat adv er t ise SSH an d Telnet serv ices.

11.2 Directory Services Defined Hist orically, Unix sy st em s h ave st or ed user and passw or d inf orm at ion in " flat " t ex t files locat ed in t he / et c d irect or y and let app licat ions access t hat dat a dir ect ly . This w or k s w ell enou gh w hen y ou on ly hav e t o adm inist er on e m ach ine. How ev er, in t he 19 80s, w it h t he adv en t of t h e Un ix at ion, w ellsas t h e pr olifer at ion of p er sonal com pu t er s, allow ing m ass •based wor k stTable of as Content deploy m en t s of comp ut er s in of fices and un iv er sit ies, m anaging u ser inf or mat ion on each • Review s m achine becam e a seriou s adm inist r at ion p rob lem . Th e pr oblem only b ecam e w or se as • Reader Rev iew s adm inist r at or s t r ied t o cop e not ju st w it h set t ing up u ser s, but set t in g up pr int ers, ser ver s, and • Er r ata ot her n et w or k r esou r ces. •

Academic

•Var ious solutTen Dig About Pant herover t h e year s t o allev iat e t his p rob lem . Su n in t rod uced ionsThings h aveI been inv ent ed •Net w ork I n for Scheduling Tasks in Pant her m at ion Ser vices ( NI S, also k now n as " Yellow Pages" ) , NeXT dev eloped Net I n fo, Running c OaS business X P ant he r Nov ell bMa uilt

ar ound Net War e ( and f ailed) , and Microsoft ended up t ak ing it aw ay f rom All t hese solu t ions hav e a com m on goal: t o cent r aliz e t he inf orm at ion needed so t hat a gr ou p of u ser s across a v ariet y of m achines can b e m anaged eff ect ely Pubiv lish er:. O'Reilly Nov elleswDuncan it h ActDavidson ive Direct or y. By Jam

Pub Dat e: Decem ber 2 00 3

When dev elopm ent on Mac OS X st ar t ed, App le inher it ed t h e Net I n fo cod e t hat cam e w it h I SBN: 059 6-com 005 00 -8 NEXTSTEP. The pany kn ew it w as not goin g t o be enou gh t o j ust pr ovide for m anag em ent of Pages: 32 6 hom ogenou s net w or ks of Macs, so Apple set ou t on a p at h t o b uild a set of t ech nologies collect ively k now n as Op en Dir ect or y . These t echnologies br oug ht su ppor t for t he Lig ht w eig ht Access Dir ect or y Pr ot ocol ( LDAP) an d Ker ber os ( a n et wor k au t hent icat ion st an dar d developed at t he Massachu set t s I n st it u t e of Tech nology ) t o t he operat in g sy st em . Wit h t h e r elease of Pant her , Mac OS X in t er op er at es w it h all t he m aj or dir ect or y serv ices sy st em s in use includ ing Act iv e Dir ect or yMac , as OS show in Figur 1. im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Ru nning X nPant her ise t11 he- ult cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS The cor w ay w hich applicat t ilize D irect illu stwrhatoed in Figur e 11 - 1.most Wh en natt heir iv e X's e, in r evealing t he innions er w u ork ing sOpen of Pant her or f ory tish ose w ant t o g et the outa of Mac OS X applicat ion, such as t he log in w ind ow , need s t o aut hent icat e a user it calls int o Open syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Dir or you y . I tr twhen w ellect on ay. can aut h en t icat e t he u ser inf or mat ion again st w hat ev er dat a st or e it is conf ig ur ed t o use. To accom mod at e Unix- b ased com man d- lin e applicat ions, t he BSD aut h en t icat ion r out in es h ave been m odif ied t o u se PAM, w hich t hen uses Open Direct or y t o aut h en t icat e against . Likew ise, w henev er any sy st em com pon en t n eeds t o fin d a r esour ce, such as a net w ork file shar e, it uses Op en Dir ect or y . The end r esu lt is a sy st em in wh ich t h e applicat ions t h at n eed aut h en t icat ion and conf ig ur at ion dat a can g et it w it h out kn owin g, or ev en car ing, wh er e t h at d at a is st or ed. I t sh ould be not ed t hat it ' s not just en d- user app licat ions t hat use t his ab st ract ed dat a. Th e dat a about a u ser t hat 's obt ain ed f rom Open Direct or y is used b y ever y par t of t he sy st em . For exam p le, t h e filesyst em per m issions scheme descr ibed in Ch apt er 6, Files and Per m ission s, r elies on t h e user and gr oup inf orm at ion st or ed in Open Dir ect or y .

Figu r e 1 1 -1 . H ow app licat ions an d O pe n Di r ect or y fi t t oge t h er



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

11.2.1 Kinds of Directory Information Pub lish er: O'Reilly

Op en Dir ect or y can hand le m any dif fer en t k inds of in for m at ion. Th e follow ing ar e t he m ost Pub Dat e: Decem ber 2 00 3 com mon t y pes of dat a t hat Mac OS X look s t o Open Dir ect or y t o pr ov id e: I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

User ident if icat ion dat a includin g r eal nam e, u ser nam e, and user I D. Aut h en t icat ion inf or mat ion used t o v erif y passwor d s giv en by a user Gr oup ident if icat ion dat a Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak and en er u p t heir This b ookmt ak es reader side Mac The locat ion , of a ugser 's ally Homreevf older , eitMac. her on a local achine or ons adeep net winor k ser v er OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You ay not be sa Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Net w orkmfilesy st em w ell on you r w ay. Qu ot as for disk , p r in t , and m ail usag e Net w ork - enabled pr int er s t hat ar e eit h er sh ared by ot h er m ach in es or ar e dir ect ly connect ed t o t he net w ork

11.2.2 Sources of Directory Information Op en Dir ect or y is a flex ib le br idge allow ing inf orm at ion t o b e obt ain ed f rom man y diff erent sour ces. Th ese sour ces f all int o r ough ly t hr ee cat egor ies: conf ig ur at ion in for m at ion, aut h en t icat ion serv ices, an d d iscov er ed ser vices.

11.2.2.1 Sources of configuration information

LDAP The op en st and ar d u sed in m an y m ix ed en vir onm ent s an d t he nat iv e Op en Dir ect ory dat ab ase in Mac OS X Ser v er 10. 3 .

Net I nf o As m ent ioned ear lier, Net I nf o is t h e leg acy dir ect or y ser v ice pick ed up fr om NEXTSTEP an d earlier v er sions of Mac OS X. I t is t he st an dar d local d irect or y ser v ice f or Mac OS X.



Table of Content s



Review s

Act iv e Direct or y • •

Rev iew s This is Reader Micr osoft ' s LD AP- based dir ect ory ser vice pr ov ided b y Wind ows 200 0 an d W in dow s Er r ata 20 03 ser v er s.



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

NI S Running

Ma c O S X P ant he r

By Jam es Duncan Davidson

Net w ork I n for m at ion Ser vices ser v er s ar e st ill used by m any Unix shop s bu t less fr equent ly since LDAP hit t he st r eet .

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

BSD f lat files

Pages: 32 6

These files ar e locat ed in t he / et c d irect or y.

11.2.2.2 Source of authentication information

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS To au t hent icat e u ser s, Open Dir ect or y supp ort s t he f ollowin g t echn olog ies: X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The Sh adow Passw or d Dat ab ase The d ef ault aut hent icat ion m echan ism used in Mac OS X. Passwor ds are st or ed in t h e / v ar / db/ shad ow d irect or y, w hich is on ly accessible b y dir ect or y serv ices an d t he r oot u ser .

App le Passw ord Ser ver This au t hent icat ion ser ver ship s only as p art of Mac OS X Ser ver .

Kerb er os A n et wor k au t hent icat ion pr ot ocol developed at MI T, Ker ber os ships as par t of Mac OS X Serv er as w ell as a st an d- alone ser ver im plem en t ed in m any lar ge gov er nm en t , educat ional, an d cor por at e n et wor k ing en vir onm ent s.

Act iv e Direct or y This is t he dir ect or y ser vices lay er of Wind ow s 200 0 Ser v er an d Window s 2 003 Serv er . I t

uses Kerb er os t o per for m aut hent icat ion.

11.2.2.3 Source of discovered services Op en Dir ect or y ob t ains inf or mat ion abou t n et w or k f ilesyst em s, pr int er s, and ot her net w or k dev ices f rom t he f ollow ing serv ices: •

Table of Content s



Review s



Reader Rev iew s

• Rend ezv ous Er r ata •

Academic

This is Ten t he Things I nt er net g Task For ce' s ( I ETF) Zer ocon f- b ased pr ot ocol f or I DigEngineerin About Pant her discover ing ser v ices t he her local n et w or k . Scheduling Taskson in Pant

• •

Running Ma c O S X P ant he r By Jam es Duncan Davidson

SMB Pub lish er: O'Reilly

Message PubServ Dat e:ice Decem ber 2 00 3Block

is u sed t o an noun ce and con nect t o Window s- based sh ared filesyst em s and pr int er s. I SBN: 0- 59 6- 005 00 -8

Pages: 32 6

SLP Serv ice Locat ion Prot ocol is an op en serv ice discov ery pr ot ocol used on som e net w or ks. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir App leTalk syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell onApp you ay.acy Mac OS- b ased pr ot ocol for discov erin g shar ed filesy st em s an d pr in t ers. le'r swleg

11.3 Directory Domains The ad vent of net w or k- based dir ect ory ser vices did not t ot ally obv iat e t he n eed for local conf ig ur at ion dat a. As m u ch as it w as necessary t o m ak e net w or ks of m achines w or k w ell t oget h er , it w as also necessary for com put er s t o be ab le t o w or k w ell in st an dalone sit uat ions. y solv t his spr oblem by usin g a set of dom ains: •Op en Dir ect or Table of es Content • • • • • •

Review s Rev iew s The localReader d om ain t hat ev ery in st allat ion of Mac OS X h as. I t is t h e fir st dom ain t o b e Er r ata consult ed by Op en Dir ect or y Academic Ten I Dig Any n um berThings of shar edAbout d om Pant ainsher f or w hich an in st allat ion of Mac OS X can be con figur ed t o use so tScheduling hat it canTasks p art icipat in Panteher in a net w ork ed en vir onm ent

Running Ma c O S X P ant he r

This allow s Mac OS X t o r un j ust f ine in st and- alone mod e w hile allowin g it t o b e config ur ed t o By Jam es Duncan Davidson r un in a lar ge net w or k env iron ment s. I t can w or k w ell in en t er pr isew ide con figu rat ion s w it h m ult iple p lat for m s t hat ar e w oven t oget her w it h v arious st andar ds. I nt er oper abilit y has b een t he O'Reilly holyPub g lish railer:for m any net w ork ad m in s. Wit h it s r ange of d ir ect or y int egr at ion, Mac OS X is a f irst Pubcit Dat e: Decem ber 2en 00 3vir onm ent s. class izen in such I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

11.4 The Local Domain and NetInfo The local d omain is t h e defau lt dir ect or y d omain of t h e sy st em. I t consist s of t he f ollow ing p art s:

• • • • • • •

The local Net I nf o dat abase t hat is creat ed wh en t h e oper at ing sy st em is fir st in st alled. I t is Table of Content s locat ed in t he / v ar / db/ n et inf o d irect or y. Review s

Reader Rev iew s The local Sh adow Passw ord d at abase, cr eat ed w h en t h e operat in g sy st em is fir st inst alled, locat ed Er inr ata t he / v ar / db/ shad ow d irect or y. Academic

Rend ezvTen ous, SLP,I Dig andAbout SMBPant for her d iscov er y of shar ed f ilesy st em s an d ot h er net w ork ser vices Things Scheduling Tasks in Pant her

The Sh adow Passw Running Ma c O S X P antor hedr d at abase is new in Pant h er . I n pr eviou s v er sions of Mac OS X, t h e passw ord s w er e encr y pt ed ( usin g t he cry pt com m and- lin e t ool) int o a h ash f or m and st or ed By Jam es Duncan Davidson dir ect ly in t h e Net I nf o d at abase. How ev er, becau se t he inf or mat ion in t he Net I nf o d at abase is av ailab le t o an yb ody on t he m achine, t he passw ord s w ere v uln er able t o decry pt ion at t em pt s. All lish er: y ouPub h ad t o dO'Reilly o w as du m p ou t t h e Net I n fo dat abase ( y ou' ll see t he com man ds t o do so lat er in t his PuberDat 2 00 3 chapt ) te:o Decem a flatber f ile and t hen r un any n um ber of passwor d - cr ack in g u t ilit ies ag ain st t h at f ile. You could d005 o so on a separ at e m achine once you h ad t h e flat file. I SBN:ev 0-en 59 600 -8 Pages: 32 6

NetInfo is Dead, Long Live NetInfo Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om tize, t wsteak , and gofenMac er ally p t le heir Mac. This b ook es reader in side Mac OS Since he fir r elease OSr ev X, u App has b een slow ly put ak t t ing t oget hserdeep all t he X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir pieces t o m ov e aw ay fr om Net I nf o and use LDAP f or Dir ect or y Ser vices. Wit h t he syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it r elease of Pant h er t he m igr at ion on t h e ser v er sid e is done. W hen y ou inst all Mac OS, you 'll b e wXellser onver you ay.ect or y ser v er in u se is LDAP, an d t he only op t ions in t he Ser v er , t rhew dir Adm in t ools r elat ed t o Net I nf o ar e t o mig rat e t he d at a f rom a Net I nfo dat ab ase t o LD AP. How ev er , on t he clien t side, Net I nfo is st ill t he d ef ault local d irect or y. So, t he r u mor s of Net I n fo' s deat h ar e pr emat u r e. At least in Pant her .

The Sh adow Passw or d d at abase chang es t his, lock ing t he passw or ds in t o a dir ect or y w her e only t he r oot u ser of t he syst em can access t hem , t her eby closing t h is secur it y v ulner abilit y. When t he sy st em need s t o aut hent icat e a user, Open Direct or y w ill look at t h e user' s Net I nfo r ecor d, see t hat t he p assw or d is in t h e sh adow p assw or d dat abase, and t h en com par e t he in for m at ion giv en t o it ag ainst t h e user ' s passw ord . Unless y ou hav e r oot p riv ileg es on t h e m ach ine, t her e' s no w ay t o g et t o t he d at a t h at Op en Dir ect ory uses t o aut h en t icat e a u ser .

The m ov e t o sh adow p assw or ds in Pant h er br eak s som e Unix- based t ools t hat st ill exp ect t o be able t o find a cr y pt - based passw or d. These t ools need t o be up dat ed t o u se t he PAM- b ased aut h en t icat ion libr ar ies. The Unix t ools t hat ship as par t of t he def ault Mac OS X inst allat ion u se PAM. How ev er if y ou ar e com piling y our ow n t ools, you 'll n eed t o be sur e t hey u se PAM in or der t o avoid aut h en t icat ion pr ob lem s.

To m od if y inf orm at ion abou t u ser s and gr oup s in t he local dom ain, t yp ically y ou use t he Accou nt s p ref er ence pan el. Wh en ev er y ou cr eat e or m odif y a u ser , t h e user in for m at ion is st or ed in t he local Net I nfo dat ab ase. Wh en ev er y ou mod if y a passw or d, eit h er w it h t h e Accoun t s pr efer en ce panel or t he passw d com m and- lin e t ool, t hat passw ord is u pdat ed in t he local Shad ow Passw or d dat ab ase. I n addit ion t o t hese easy - t o- use GUI t ools in t h e Syst em Pr ef erences, Mac OS X p rov ides t h e GUI - b ased Net I n fo Manager ( / App licat ions/ Ut ilit ies) and a set of comm an d- line t ools t o m anipu lat e Net I nf o d at a. •

Table of Content s



Review s



Er r ata

11.4.1 Examining NetInfo Data with NetInfo Manager • Reader Rev iew s launch Net I n fo Manager , y ou see an int er face w it h t w o par t s, as sh own in Figur e •When y ou f irst Academic par t of t Ih Dig e int er face isher a br owser t h at allow s y ou t o nav igat e t hr ough t h e t r ee •11 - 2. Th e t opTen Things About Pant t he Net I nfo datin abPant ase.herTh e lef t - m ost colum n of t he br ow ser displays " / " , w hich is t he •hier archy of Scheduling Tasks r oot of tMa h ec Net Running O S XI nPfo antdat he r abase t r ee. The colum n t o t he r ight of " / " is t he set of t op - lev el dir ect or ies ( not t o be conf used w it h filesy st em dir ect or ies! ) t hat ar e in t he dat abase. Unlik e ot her Ap ple By Jam es Duncan Davidson app licat ions, Net I nf o Man ager doesn't hav e a help sy st em ( - ?) . Th is is a sign t hat t h is t ool isn't for beginn er s, bu t n ot hav ing a help sy st em h as giv en Net I nf o a r ap t hat it ' s a g nar ly beast , Pub in lishfer: w hen actO'Reilly it ' s r at her easy t o use, y ou just hav e t o g et used t o it . Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Figu r e 1 1 -2 . N et I n fo M an ag er

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Each dir ect or y n ode in t he d at abase can, in addit ion t o holding subd irect or ies, h old a set of

pr oper t ies. Th ese p rop er t ies ar e display ed in t he b ot t om p art of t he Net I nf o Man ager int er face. As show n in Figur e 11 - 2, t h e users d irect or y cont ains sub dir ect or ies for each user on t h e syst em as w ell as a sing le pr oper t y, nam e, t h at cont ain s t he n am e of t he d ir ect ory . Becau se t he Net I nfo dat ab ase is in her it ed fr om NEXTSTEP an d is design ed t o ser v e as bot h a local and dist r ibut ed dir ect or y , it cont ain s m any ent r ies t hat y ou w on 't t yp ically u se on a sin gle local syst em . The t op - lev el subd irect or ies of g reat est u se on a local sy st em ar e: •

Table of Content s



Review s



Reader Rev iew s



Er r ata

gr oups •

Academic Con t ains a list ing of t he gr oups an d t he users t hat belon g t o each g rou p. Th e infor m at ion Things I Dig Pant her in t his Ten subd irect or y isAbout analogou s t o t he inf orm at ion st or ed in t he classic Unix / et c/ grou p Scheduling Tasks in Pant her file.

• •

Running Ma c O S X P ant he r By Jam es Duncan Davidson

users Pub lish er: O'Reilly PubCon Dat e:t ains Decem 00 3 a ber list2ing

of t he user s an d t he v ariou s pr oper t ies associat ed w it h t hose user s. This inf orm0-at ser I SBN: 59ion 6- 005 00v-8es t he sam e pu rp ose as t he Unix / et c/ passw d f ile.

Pages: 32 6

By dir ect ly usin g Net I nf o Manager t o ed it t h e local dir ect or y ser v ices dom ain, you could pot ent ially creat e m an y pr oblems and cau se you r syst em t o st art up incor r ect ly or n ot at all. Ex er cise gr eat care befor e g chan Ru nning Mac OSmXakin Pant her isges. t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e 11.4.1.1 Managing user information w ell on you r w ay. When y ou cr eat e an accoun t w it h t he Accoun t s pr efer en ce p anel, all t h e pr oper t ies ab out t hat user ar e st ored in t he local Net I nfo dat ab ase m an aged b y Open Dir ect or y . By select ing t he / user s d irect or y in Net I nf o, y ou' ll be ab le t o see all t he u ser s on y our sy st em , and w hen y ou select y our u ser nam e, y ou sh ould see som et h ing sim ilar t o Figur e 11 - 3. Ever y set t in g t hat cont r ols how a user behav es on t he sy st em is st or ed rig ht here. Th ese set t ings ar e ( in or der t h at t hey t y pically appear f or a user man aged b y t he Accoun t s pr efer en ce p anel) :

hint The p assw or d hint t hat get s display ed w h en a u ser ent er s an incor rect p assw or d mor e t han t h ree t im es.

shar ed Dir The n am e of t he f older in t he user 's Hom e f older t hat w ill be shar ed w it h ot h er u ser s. By defau lt t h is is t he ~ / Pub lic f older .

_w r it er s_passw d List s t h e users t hat are allow ed t o chang e t he passw or d for t his user. Typ ically y ou' ll only see t he user nam e of t he u ser r ecord t h is set t ing ap plies t o. How ev er, an adm in u ser can alw ays ch ange a passw ord f or a u ser in t he Accoun t s pr efer en ce p anel.

aut h en t icat ion_au t hor it y s • Table of Content •

Review s

I ndicat es t he aut hent icat ion r esour ce t o u se t o au t hent icat e t he user against . By d ef ault in Reader Rev iew s Pant h er t his w ill be ; ShadowHash; in dicat ing t hat t he sy st em sh ould aut hent icat e t h e user Er r ata against t he Sh adow Passw ord d at abase in / v ar / db/ shad ow . I f y ou cr eat ed an accou nt w it h Jagu ar Academic or a pr ev ious r elease of Mac OS X and m igr at ed it t o Pan t her, t his set t ing m ig ht be basic.Ten Things I Dig About Pant her

• • • • •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Figu r e 1 1 -3 . Ex am i ni ng a user su bdi r ect or y in N et I n fo M an ag er Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

nam e

The Unix u ser nam e f or t he u ser . Th is is t he sam e t hin g as t he Shor t Name field in t he Accou nt s p ref er ence pan el.

hom e The locat ion on t he f ilesyst em of t h e user' s Hom e fold er . •

Table of Content s



Review s



Reader Rev iew s



Er r ata

passw d •

Academic By def ault w h en t he aut h en t icat ion_au t hor it y is set t o ; ShadowHash; , t h e pr oper t y cont ains I Dig a set ofTen astThings er isk s. I f tAbout he autPant h enher t icat ion_au t hor it y is set t o basic, t h is pr oper t y cont ains t he Scheduling Tasks in Pant her passw ord f or t he user in a hashed f or m.

• •

Running Ma c O S X P ant he r By Jam es Duncan Davidson

_w r it er s_hint Pub lish er: O'Reilly PubList Dat e: ber 2 00 3 s tDecem h e users t hat

are allow ed t o chang e t he hint of t he u ser 's p assw or d. By default t his wI SBN: ill only 0- 59 cont 6- 005ain 00 -8t he nam e of t he u ser 's recor d.

Pages: 32 6

_shad ow _passw d A legacy k ey lef t f r om older v er sions of Mac OS X and NEXTSTEP. Cur r en t ly it 's n ot u sed. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir _w r item er s_pict uray e not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e syst . You m w ell on you r w ay. List s t h e users t hat can chang e t he pict ur e for t his user.

r ealnam e The lon g n am e of t he u ser . This p rop er t y cor r espon ds t o t he Nam e f ield in t he Account s pr efer en ce panel.

uid The n um eric u ser I D of t he u ser .

shell The d ef ault sh ell of t he user ; b y default t his w ill b e / bin/ b ash on Pan t her.

generat ed uid

A st r ing t hat ser v es as a u niqu e ident ifier f or t he u ser , not only on t h e local sy st em bu t any w her e in t he w or ld. This st r ing is used in sid e t he Sh adow Passw ord d at abase as a key t o find t he in for m at ion t o v alidat e passw or ds.

gid •

The p r im ar yofgrContent ou p I D Table s of t he u ser .



Review s



Reader Rev iew s

•_w r it er s_t im _passwor Er r ata d • •

Academic Tenk ey Things Pant her A legacy lef tI fDig r omAbout older v er sions of Mac OS X and NEXTSTEP. Cur r en t ly it 's n ot u sed.



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

pict ur e

Pub The lish er:u O'Reilly ser 's pict ur e. Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

_w r it er s_r ealnam e List s t h e users t hat can chang e t he real n ame for t h is user . Giv en access t o t his in for m at ion, it becom es v er y easy t o m ak e subst an t ial chang es t o t he user rRu ecor ds on y our em .her Forisex amult ple, if yeou antArtmy o chan ge TM) t h e ;defau lt shell for sa wuser nning Mac OS sy X st Pant t he im at Swwiss Knife( for pow er user h o wf rom ant t o / bin/om b ash bin/,t csh, ou ercan rop erThis t y as follow cust ize,t ot w/ eak and gy en allyedit r ev tuhe p shell t heir pMac. b ook t aks:es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e 1 . First mak e sur e y ou are aut hent icat ed by click ing t he p adlock at t he low er - left corn er of w ell on you r w ay. Net I n fo Manag er ' s w in dow . I f t he padlock is closed, you 'll n eed t o au t hent icat e as an adm inist r at ive user . 2 . Select t he user t hat y ou wan t t o m odify . 3 . Find t he shell p r opert y and doub le- click t he nam e of t he shell ( / bin/ b ash b y defau lt ) , as show n in Figur e 11 - 4. 4 . Ch ange t he v alue t o / bin/ t csh. 5 . Click t he p adlock icon t o pr event fu rt h er ch anges f r om being m ade, or use Secur it y Deaut h en t icat e. 6 . Sav e t he chan ge w it h Dom ain

Sav e Chan ges (

- S) .

Figu r e 1 1 -4 . Edi t in g a user ' s sh el l in N et I n fo M an ag er



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust 11.4.1.2 om ize,Managing t w eak , andgroup g en er ally information r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst . You a gr Mac ru tw henfor y ou ar t using t his book b ut once you 'v e r ead pan it , you The em on ly w aymt oayafnot fectbe t he oupguset ings a st user t he ,Account s pr ef erences el is'llt ob e w ell on you r w ay. gr ant t he user adm inist rat or perm ission s. No ot her g rou p man ipulat ion is exp osed. How ev er , using Net I n fo Manag er , y ou can d ef ine new g r oups on t h e syst em and associat e u ser s w it h t hem . For exam ple, t o giv e t he u ser nor m an ad m in ist r at iv e pr iv ileges, follow t his pr ocess: 1 . Nav ig at e t o t he / gr oups/ ad m in su bdir ect or y u sing t h e br ow ser w ind ow at t he t op of t h e Net I n fo Manag er in t er f ace. 2 . Select t he users p r opert y , as sh ow n in Figur e 11 - 5. 3 . Use t he Dir ect or y pr oper t y .

New Value ( Opt ion-

- N) menu t o cr eat e a new v alue in t he users

4 . Ch ange t he new _v alu e st r ing t hat w as insert ed t o nor m an. 5 . Sav e t he chan ge b y using Dom ain

Sav e Chan ges (

- S) .

When y ou check t he " Allow user t o ad min ist er t h is com pu t er" check box in t h e Accoun t s pr efer en ce panel, t he sy st em is sim p ly adding t h e user t o t h e adm in g r oup ( ju st as w e'v e don e her e) . Lik ew ise, w hen y ou un ch eck t h e adm inist rat ion checkb ox in t he Accou nt s p r ef er ence pan el, t he syst em r emov es t he user ' s nam e f rom t he / gr oups/ ad m in list in t h e Net I n fo d at abase.

Figu r e 1 1 -5 . Edi t in g t h e / g r ou ps/ adm i n su bdi r ect or y in N et I n fo

M a na ger



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst 11.4.1.3 em . You Creating m ay nota be nonhuman a Mac gu ruuser w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. I f you n eed t o cr eat e a n onhum an user , m ean in g an account t h at is used t o r un som e ser v er pr ogr am secur ely ( n ot an account for a dog or a fish) , it 's b est not t o cr eat e t hat user wit h t h e Accou nt s p ref er ence pan el, as a non hum an user doesn't need t o hav e a Home folder cr eat ed. I nst ead, y ou can cr eat e an accoun t by dir ect ly edit ing t he Net I nf o d at abase. Usually , it s easiest t o dup licat e an exist ing user and t h en edit t he v ar iou s pr oper t ies t o giv e y our n ew user t he corr ect set up. Her e's t he st ep- by - st ep g uide: 1 . Lau nch Net I nf o Man ager and aut hent icat e as an adm in user by click ing t he p adlock or using Secu rit y Aut h en t icat e. W hen p rom p t ed , ent er y our p assw or d an d hit Ret u r n. 2 . I n t he dir ect ory br owser at t he t op of t h e w indow , click t he users ent ry in t h e second colum n an d t hen select t he un kn ow n u ser as sh ow n in Figur e 11 - 6. 3 . Click t he d uplicat e bu t t on in t he t oolbar or use Ed it Du plicat e ( - D) . A du plicat e of t he un kn ow n u ser w ill be cr eat ed af t er y ou accept t he dialog box challenge. 4 . I n t he pr op er t y - v alu e edit or at t he b ot t om of t h e applicat ion w in dow , chang e t he uid ( user I D) pr opert y t o a num b er t hat isn' t alr eady assigned t o som e ot her u ser . By conv ent ion, y ou sh ould u se an I D bet w een 10 0 and 500 . I Ds less t han 100 ar e r eser ved for use by Mac OS X, and I Ds g reat er t han 5 00 appear in t he log in w ind ow . Be sur e not t o u se an I D alr ead y in u se. To be saf e, ch eck t h e var ious ot her user ent r ies t o m ak e su re you ar en't using t heir I D befor e pr oceed in g. Alt h ough Net I n fo Manag er is perf ect ly h appy allow ing y ou t o cr eat e m ult iple u ser ent r ies w it h t he sam e user I D , t he sy st em it self w on' t b e happ y w it h

t his sit uat ion . 5 . Assig n a gr oup I D t hat is t he sam e nu mb er as t he u ser I D. You'll cr eat e t he gr oup for t he user in a m inut e. 6 . I f t he u ser n eeds a Hom e dir ect or y ( n ot lik ely f or a n onhu m an u ser , bu t t h e docum ent at ion for t he sof t w are t hat y ou ar e creat ing t h e nonh um an user for m ay ind icat e t hat it is needed) , set t h e hom e p r opert y t o t h e filesy st em locat ion of t h e dir ect or y . I f you do assign a Hom eTable d irect y, yous ar e r espon sib le for cr eat in g t hat dir ect or y. You can alw ays add or • of or Content chang e t he hom e p r opert y lat er . • Review s •

Reader Rev iew s

7 . I f t he u ser n eeds t o use a sh ell ( once again, not lik ely but consult t he docum ent at ion f or Er r ata t he sof t w ar e t hat you ar e cr eat in g t he non hum an user for ) , set t he shell p r opert y t o t h e • Academic shell y ou'd lik e t o u se ( for ex amp le, bash, t csh , zsh ) . / usr / bin/ f alse, a pr ogr am t h at d oesn' t • Ten Things I Dig About Pant her do any t hing b ut r et ur n a n on- zer o exit code, is a g ood ch oice w hen y ou w an t t o m ake sur e • her t hat t heScheduling user can Tasks 't useina Pant shell. •

Running Ma c O S X P ant he r

. es SetDuncan t h e r ealnam By8 Jam Davidsone

p r opert y t o som et hing t hat m akes sense.

9 . Mov e t o t he g rou ps ent r y in t he b r owser . Pub lish er: O'Reilly

Dat e: Decem ber un 2 00kn 3 ow n g r oup. 1 0 .PubDu plicat e t he I SBN: 0- 59 6- 005 00 -8

1 1 . Ch ange t he nam e of t h e gr oup t o be t h e sam e as t he n ame of t he new u ser . Pages: 32 6 1 2 . Ch ange t he gid ( gr oup I D) n um ber t o mat ch t he user I D nu m ber.

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o Figu r e 1 1 -6 . D upl ica t i ng a u se r e nt r y cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

11.5 Configuring Shared Domains For m any u ser s, especially t hose t hat use t heir Macs at hom e, t he default local Net I n fo- based dom ain is all t hat 's n eeded. How ev er , u ser s in cor p orat e set t ing s w ill w ant t o t ak e adv ant age of t he ease of adm inist r at ion and flexib ilit y t h at u sin g shar ed dom ains allow s. When a shar ed u se, an y user scan log int o any m achine t hat is par t of t h e dom ain and access his •dom ain is in Table of Content Hom e fold er f r om a n • Review s et wor k ser ver . All t he set t ing s and dat a for all t he com pu t er s on t h e net w or k can b e cen t r alized. Also, b ecause t h er e is n o user dat a st or ed on an indiv idual m achine, • Reader Rev iew s t he dat a can be replaced or upg rad ed w it h ease. Wh en t he user log s in t o t h e new m achine, all • Er r ata of his d at a is j ust w h er e h e lef t it . •

Academic

•To enab le a Mac Ten Things I icipat Dig About her t o p art e inPant a sh ared dom ain, y ou need t o per for m a t w o- st ep pr ocess. Th e •fir st st ep is t o Scheduling Tasks in Pant her set u p t he shar ed d omain dir ect ory ser ver t h at y ou w ant t o use. The second is t o Running O S hent X P ant he rion set up t Ma h ecaut icat

r ules for y our sy st em. Bot h st eps can be perf or med w it h t he Dir ect or y Access ilit y ( Davidson / App licat ions/ Ut ilit ies) , show n in Figur e 11 - 7. By Jam es ut Duncan Pub lish er: O'Reilly

11.5.1 Pub DatConfiguring e: Decem ber 2 00 3 Open Directory Sources I SBN: 0- 59 6- 005 00 -8

When Pages: y ou lau 32 6nch D ir ect or y Access, t he f ir st t hing y ou'll see is t h e Ser v ices conf igur at ion, as show n in Figur e 11 - 7. Th is gives y ou a list of d ir ect ory sou rces t hat can be used wit h Op en Dir ect or y . These ar e t he sam e sour ces of in for m at ion d iscussed ear lier in t he ch apt er . By using Dir ect or y Access, y ou can enable an d disab le t hese sou r ces as w ell as conf igur e t h em . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o 11.5.1.1 Directory Server cust om ize,Using t w eakMac , andOS g enX er Server's ally r ev u pOpen t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst emfigur . Youe m not t o beu aseMac ru wbased hen y ou st aror t yt his b ut 'v eenr ead it , or you To con a ay client t he gu LDAPd irect serbook v ices, pr ovonce ided byou y Op Dir ect y 'll b e w ell on you r w ay. Serv er , select t he LDAPv 3 en t r y and click t h e Conf igur e b ut t on. Ev en if t he padlock icon at t he low er - left of t he w ind ow is un lock ed, y ou m ay st ill be challen ged for an adm inist r at or p assw or d. Aft er y ou aut h en t icat e, y ou' ll see t he p anel show n Figur e 11 - 8. The Use DHCP- su pplied LDAP ser ver box is ch eck ed b y defau lt . This m eans t h at if t he sy st em obt ain ed an I P add r ess f rom a DHCP ser v er t hat also is set t o pr ovide in for m at ion on w h er e t o fin d an LDAP serv er , it w ill go ahead and use it as a d ir ect ory ser vice. I f you ar e on a n et w or k w her e an LDAP ser ver isn' t conf igur ed t hr ough D HCP, or if y ou are u sin g a fix ed I P addr ess, y ou' ll need t o add y our serv er m anually . To d o t h is, click t he New b ut t on and ent er t h e follow ing inf orm at ion:

Figu r e 1 1 -7 . Th e Dir e ct or y Access ap pli cat ion u se d t o con fi gu r e Act iv e Di r ector y



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Con figur at ion Nam e This can be an y nam e y ou wan t t o assig n t o y our LDAP conf igur at ion.

Serv er Nam e or I P Add ress The h ost nam e or I P ad dr ess of t h e LD AP ser v er.

LDAP Mapp ings The t yp e of LDAP m apping s t o u se. For m ost pur poses, t he d ef ault " Fr om Ser ver " set t ing is app rop riat e. You 'll see how t o u se t he ot her op t ions in t his list in t he next sect ion.

SSL I ndicat e w het h er or not t o u se SSL t o cont act t h e LDAP ser v er . Th is w ill secur e t h e LDAP connect ion usin g a t he cer t ificat e cr ed en t ials pr ovided by t he ser v er.

This p rocedur e w or k s for most net w or k en vir onm ent s t hat u se Mac OS X Ser ver 's LDAP ser vices. How ev er , it 's a good idea t o v er if y t his inf or mat ion w it h t he ad min ist r at or of t he Mac OS X Serv er y ou ar e t ry ing t o con nect t o.

11.5.1.2 Using other LDAP servers Since Op en Dir ect or y Ser ver u ses t h e st andar d LDAP pr ot ocol w it h no sp ecial m odif icat ions, t he • Table of Content s Op en Dir ect or y clien t is alr eady LD AP sav vy . Th e only t hin g t hat Open D irect or y need s t o kn ow • Review s t o use any ot h er LDAP ser v er is h ow dat a in t he d ir ect or y is st ored. This is k now n as t he ser ver 's • Reader Rev iew s dat a m appin gs. The LDAP ser ver s y ou m ay u se f all int o t hr ee cat eg or ies: • • • •

Er r ata

Academic I Dig conf AboutigPant hert o pr ov id e seam less in t egr at ion w it h Mac OS X. The ser Ten ver Things is alr eady ur ed Scheduling Tasks in Pant her

The ver set Running Maser c OS X Pis ant he ru p

t o use st and ard Unix RFC 23 07 map ping s.

By Jam es Duncan Davidson

The ser ver r equir es you t o config ur e you r m appin gs on Mac OS X.

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Figu rI SBN: e 1 01 59 -86-.005 Conf 00 -8 igu r in g t he LDAP se r v er s t ha t O pe n Di r ect or y w ill u se Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Trusting the Network As t h is book w as b eing pr epar ed f or p ublicat ion, a st or y b rok e in t he pr ess ab out a secur it y v ulner abilit y in Mac OS X. I t st at ed an at t acker could t ak e over a m ach ine by exp loit in g Open D irect or y. I n or der t o perf or m t his at t ack , an at t ack er set s u p a • DHCP ser v erTable of net Content for a w or sk ( shut t in g d ow n an y ot her op er at ional DHCP ser ver s) , and • t hen config ur Review s es LDAP t hr ough DHCP t o let him log in t o an y mach in e t hat boot s on • t he net w orkReader Rev iew s . •

Er r ata ex ploit , bu t r at her is sy m pt om at ic of t he ch anges in net w ork ing . I t • This isn' t a new Academic

hat Things it w asI rDig ar eAbout t o mPant ov eher y our m achine b et ween net w ork s. You alw ays • used t o be tTen ser verTasks or at k new y our ad min s t ook car e of su ch t h in gs. • k new t he DHCP Scheduling in least Pant her Ther ef or pickin g uhe p rLDAP Running Maec O S X P ant

set t ing s fr om D HCP set t ings aid ed easy syst em conf ig ur at ion. Now , w it h m obile com put ing b eing such a p er v asiv e par t of lif e, it 's By Jam es Duncan Davidson m or e quest ionable t o m ake t his assum pt ion. I f Pub youlish h er: aveO'Reilly a lapt op t hat y ou car r y bet w een net w or ks, u ncheck t he Use DHCPsupp lied LDAP Pub Dat e: Decemser ber v2er 00 3box show n in Figur e 11 - 8, an d y ou w on' t b e su bj ect t o t h is kind of at t ack . I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Unless y our set up f alls in t o t h e fir st cat egor y , y ou'll most lik ely need t o get som e inf or mat ion fr om you r sy st em adm inist r at or t o con figu re t he LDAP d ir ect ory ser vice. I f you do need t o conf ig ur e y our ow n m apping s, select t he Cust om op t ion f r om t he LDAP map pings pull- dow n m en u. How up ther h ese app ings eniss ds on y our LDAP serv er pow and er is user b ey ond Ru nning Macyou OS set X Pant is m t he ult im atdeepSw Ar my Knife( TM) ; for s w ht he o wscope ant t o of t his om b ook. cust ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you 11.5.1.3 Configuring r w ay. Active Directory domain servers The ab ilit y t o u se Act iv e Dir ect or y , t he nat iv e dir ect or y ser v ice used by Micr osoft Wind ows 200 0 or Win dow s 20 03 Ser v er , is new in Pant her . This sup por t r elies on t h e fact t hat Act iv e Dir ect or y uses st andar d LD AP and Ker beros p r ot ocols. I n fact , if y ou w ant ed t o, y ou could connect t o an Act ive D irect or y ser v er sim ply b y con figu rin g it as an LDAP ser v er . How ev er , t h e m appin gs of dat a in an Act iv e Dir ect or y serv er don 't mat ch up w it h t he m ap pings need ed by Mac OS X. Fort unat ely , Apple h as pr ov ided Act iv e Dir ect or y - sp ecific f un ct ion alit y in Op en Dir ect ory t hat seam lessly m aps b et ween t he d at a m app in gs u sed by Micr osoft Window s an d t he m appin gs t h at Mac OS X ex pect s t o see.

What is Active Directory? Act ive D irect or y is Microsof t 's d irect or y t hat is pr ov id ed as p art of Wind ow s 200 0 Serv er and Wind ow s 200 3 Ser v er . I t perf or m s t he sam e k inds of d ut ies for a Wind ows- b ased net w or k t hat Apple's Open Direct or y in Mac OS X Serv er can pr ovid e • for Macin t osh Table ofem Content s sy st s. Since Act ive Direct or y is w idely deploy ed in en t er p rise • env iron mentReview s, Ap sple bu ilt in t he ab ilit y t o r un fr om Act iv e Dir ect or y int o Mac OS X t o • m ake it easier Reader s ins of Wind ows- b ased net w or ks t o w or k w it h Macs. f or Rev t heiew adm • Hopefu lly it Er atainspir e some of t he em ployees of t hose com panies t o sw it ch t o t he wrill • Mac. Academic •

Ten Things I Dig About Pant her it 's a onew ayinstPant r eether . Open D irect or y on Mac OS X can' t p rov ide all t he • At t his t im e,Scheduling Tasks

fu nct ionalit a Win Running Ma c OyS fXor P ant he r dow s- based

m achine t h at Act iv e Dir ect or y can. Being able t o r un a Mac on an Act iv e Dir ect or y - based n et w or k , how ev er , is a gr eat st ep f or w ard f or By Jam es Duncan Davidson int er operab ilit y . O'Reilly ActPub ivelishDer: irect or y com es w it h a slew of it s ow n t er m s lik e for est , w hich r ef er s t o a gr oup of Act ive Direct Pub Dat e: Decem ber 2 00 3or y t r ees. I t reuses t erm s lik e dom ain f or it s ow n pu rp oses. For t he most par t , y our I SBN: 0- 59 6- 005 00sy -8 st em adm inist rat or w ill pr ovid e t he inf or mat ion y ou need t o k nowPages: . You 32 can also get m or e infor m at ion fr om Act iv e Direct or y, 2nd Ed it ion , b y 6 Rob bie Allen , et al. ( O'Reilly & Associat es, I n c. , 2 003 ) .

To con figur e Open D irect or y t o u se an Act iv e Dir ect or y ser v er, select t he Act iv e Dir ect or y ent r y in Dirnning ect or yMac Access anPant d click urat e ebut t on. 'll bKnife( e pr esent it h ter heuser panselwsh in t o Ru OS X hert he is t Config he ult im Sw iss You Ar my TM) ; ed forwpow h oow wnant Figurom e 11 - 9.t wFill t he dg irenect , dom and com put er w sit hdeep t he in values p rovOS ided cust ize, eakin, and er ory ally for r evest up t heirain, Mac. This b ook t akI D esfields reader side Mac by ycor oure,net w ork adm and t he fBin X's r evealing t heinist innrat er or w ork ingt hen s of click Pant her or d t h but oset on w h. o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e Depend g on our set up , y ou m ay also w an t t o set t he f ollow in g ad van ced opt ion s: w ell on in you r w yay.

Cache last u ser log on f or off line op er at ion Let s y ou log in t o you r m ach ine even if t he Act iv e Dir ect or y serv er isn 't av ailab le. Th is is han dy w hen you h ave a lapt op and need t o u se it w hile y ou ar e aw ay f r om t he of fice.

Aut h en t icat e in m u lt iple dom ains Let s u ser s f rom any dom ain in t he Act ive Direct or y syst em for you r net w or k log in t o you r com put er .

Figu r e 1 1 -9 . Set in g u p Act i ve D ir e ct or y i n Di r ect or y Access



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Pr ef er t his dom ain ser ver Let s y ou specif y t he h ost nam e of t he Act iv e Dir ect or y serv er t hat y ou w an t t o use by defau lt . I f t his serv er is un available, Op en Dir ect ory w ill au t om at ically use an ot her ser v er t hat is par t of t he f or est if av ailable.

Map UI D t o at t r ibut e By def ault , Act ive Direct or y doesn't use u ser I Ds, b ut p r ef er s t o use long er GUI Ds ( Globally Unique I D ) . I f you r Act ive D ir ect ory ser ver h as been conf igur ed t o st or e a u ser I D for each user ( t y pically wh en Act iv e Dir ect or y has alr eady b een con figu r ed t o su ppor t Un ix com put er s) , you can specif y t he at t ribu t e w it hin Act ive D ir ect ory t hat is used t o st ore t he I D. I f y ou d on' t select t his opt ion , t hen a u ser I D is aut om at ically g en er at ed for you based on t he GUI D at t r ibut e in Act ive Direct or y.

Allow ad m inist rat ion by Specifies a list of Act ive Direct or y gr oup s w hose m em b er s w ill be con sider ed t o hav e adm inist r at ive pr iv ileg es by Op en Dir ect ory .

11.5.1.4 Configuring NetInfo-based domain servers •

Table of Content s

I f you r net w or k dir ect or y serv ices are b ased on Net I n fo, y ou can conf igur e Op en D ir ect ory t o use • Review s it b y select ing t he Net I nf o ser v ice t yp e and click ing t he Config ur e but t on. You 'll b e pr esent ed • Rev iew s w it h t he Net IReader nf o conf ig ur at ion panel show n in Figur e 11 - 10. As w it h LD AP, Open Dir ect or y is •conf ig ur ed t oEraut r ataom at ically discov er any Net I nf o ser v er set in D HCP. I n addit ion, you can set •Op en Dir ect or Academic y t o t r y t o con t act a Net I nf o serv er v ia a net w ork b r oadcast at t em pt , or you can •conf ig ur e it t Ten Things About o cont act Ia Dig specif ic Pant Net Iher n fo ser ver . Since dir ect or y in for m at ion in Net I n fo is alw ays •st or ed t h e sam Scheduling Tasks in Pant e w ay , t h er e's n o fher ur t her conf igur at ion t o p er f orm . Running Ma c O S X P ant he r By Jam es Duncan Davidson

11.5.1.5 Configuring NIS domain servers Pub lish er: O'Reilly

To con t he ber use2 00 of3 NI S- based d irect or y ser v ices, select t h e ch eck box n ex t t o t h e BSD Flat Pub figur Dat e: e Decem File and NI S en t r y in I SBN: 0- 59 6- 005 00D -8irect or y Access ( r ef er back t o Figur e 11 - 7) . Nex t , click t h e Con figur e bu t t on. You 'll b e pr esent ed w it h a pan el w here you can en t er t he NI S d omain nam e of y our Pages: 32 6 net w or k and , opt ionally , a list of NI S ser ver s. You can also conf igur e Op en Dir ect ory t o at t em pt t o locat e a NI S ser v er by u sing n et w or k b road cast s. As w it h Net I n fo, since t h er e is on ly one w ay t o st or e d at a in a NI S ser ver , t h er e is no fu r t her config ur at ion t o be p er f orm ed. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o 11.5.2 Configuring Authentication cust om ize, t w eak , and g enShared er ally r ev Domain u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst On ceem y ou . You havme ay setnot up be t h ea var Mac ious gu ru serwver hen s tyhou at pr st ar ovtide t hisshar book ed, dbom ut ain onced iryou ect'v ory e r ser eadvices it , you t o 'll y our be w ell m achine, on you y ou'll r w ay. be able t o access t h e resour ces defined by t h ose ser ver s. How ev er, t o u se t hose ser v ers f or au t hent icat ion an d t o let u ser s defin ed by t hose ser v er s log in t o y our m achine, y ou need t o conf ig ur e Op en Dir ect or y 's aut hent icat ion set t in gs. When you click t he Aut hent icat ion t ab, you 'll see t he in t erf ace sh ow n in Figur e 11 - 11. By d ef ault , y ou' ll see one ent r y : / Net I n fo/ r oot . Th is in dicat es t hat you r m ach ine is set up t o use only t he local dom ain for aut h en t icat ion .

Figu r e 1 1 -1 0 . Con fi gur i ng a cce ss t o N et I n fo base d di r ect or y ser v ice s



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w r wed ay.d omain dir ect ory ser vice t o be used for au t hent icat ion, chan ge t h e sear ch p ullToelladon d ayou shar dow n m en u t o Cu st om, as show n in Figur e 11 - 11. You 'll t h en b e able t o click t he Ad d but t on t o use an y of t he serv er s t hat you conf igur ed in t h e Ser v ices p anel. I n Figur e 11 - 11 I ' ve set up Op en Dir ect or y t o use t h e LDAPv 3 ser v er locat ed at ldap. r unn in gosx . com t o ser ve as an aut h en t icat ion d ir ect ory ser vice. This m eans an y user w it h an account defined by t hat ser ver w ill be ab le t o log on t he m achine. I f y ou hav e con figu r ed m ult iple serv er s, you can dr ag t hem int o t he ord er in w hich you w ant t h em t o be con su lt ed f or aut h en t icat ion pu rp oses. Not e t h at / Net I n fo/ r oot st ay s at t he t op of t h e list . This ensur es t hat t he local d omain alw ays t akes pr ecedence ov er inf orm at ion in any shar ed d omain . When y ou click t he Ad d b ut t on , y ou'll also not ice an en t ry for / BSD/ local . Th is set s u p Open Dir ect or y t o use t h e classic Un ix / et c/ passw d an d / et c/ grou p f iles for au t hent icat ion. I t let s y ou use t h ese f iles if y ou wish, but for all t he r eason s st at ed at t he beginnin g of t h e chapt er , y ou m ost likely don 't w ant t o u se t his opt ion .

Figu r e 1 1 -1 1 . Con fi gur i ng di r ect or y se r v ice s use d f or a ut he nt ica t i on



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

11.5.3 Configuring Shared Domain Contacts

Not only does Op en Dir ect or y h andle n et w or k serv ices and aut hent icat ion dut ies, bu t it can also pr ov ide cont act in for m at ion t o t h e Addr ess Book. To use shar ed dom ain serv er s for con t act dat a, simp ly ch ange t he search pull- d own m enu t o Cust om Pat h ( j ust as y ou did for Aut hent icat ion) and add t h e ser v er s y ou w ould lik e t o use.

Con figu ring shar ed con t act s in Open D irect or y isn 't t he on ly w ay t o t ak e adv ant ag e of LDAP ser v er s f r om t he Ad dr ess Book . You can set any n um ber of LD AP ser v ers in t h e Addr ess Book pr eferences t o use as sour ces of cont act in for m at ion.

11.6 Kerberos and Single Sign-on Kerb er os is a net w or k aut h en t icat ion pr ot ocol t h at w as d ev eloped at MI T t o allow app licat ions t o ident if y user s ov er open and insecu re n et wor k s. I t is u sed by g over nm ent s, lar ge cor por at ions, and hig her educat ion. Ker ber os is also t he n at ive aut hent icat ion pr ot ocol of Act ive D irect or y. Apple h as been m ov ing aggr essiv ely t o supp or t Ker beros in bot h Mac OS X Serv er •Since Jagu ar,Table of Content s and Mac OS X—as w ell as all of t he passw or d- using app licat ions in Mac OS X su ch as Mail, FTP, • Review s SSH, and Ap ple File Sh arin g. The reason Apple is m ak ing t his pu sh is t o enable sin gle sign - on . • Reader Rev iew s •

Er r ata

Single sign - on means t hat aft er a user en t er s a nam e and a passw or d in t he login w indow , ev er y • Academic app licat ion on t he sy st em t hat n eeds t o au t hent icat e it self f or a n et w or k serv ice, for ex amp le, •Mail w an t ing Ten Things t o log in tI oDig t h About e m ailPant serher v er , can do so aut om at ically wit h out requ iring t h e user t o •ent er a diff erScheduling Tasks in Pant her ent user nam e an d passw or d. Running Ma c O S X P ant he r

For users of Mac OS X, eit her Ker ber os is conf igur ed f or y our n et w or k an d it ju st w or ks ou t of t h e By Jam es Duncan Davidson box , or t here is a bit of configu r at ion w or k t o be accomp lished. I f y our net w ork falls int o t he second cat egor y , you 'll n eed t o get som e infor m at ion fr om y our sy st em adm inist rat or. Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

11.7 Command-Line Open Directory Tools Mac OS X pr ovides a suit e of comm an d- line t ools t o v iew an d man age t h e infor m at ion in Open Dir ect or y . The most usef ul of t hese t ools are: •

Table of Content s



Review s

• dscl

Reader Rev iew s



Er r ata

A g en erAcademic al- pu r pose int eract iv e comm an d- line t ool for w or k in g wit h d at a in any Open Dir ect or y dThings at a sour ceAbout including Ten I Dig Pant herLDAP, Net I nfo, SMB, and Rend ezv ous. Th is t ool is n ew in Pant h erScheduling and can Tasks also in b ePant used her in single- shot m od e.

• • •

Running Ma c O S X P ant he r By Jam es Duncan Davidson

nicl Pub lish er: O'Reilly

eractber iv e2 com PubAn Dat int e: Decem 00 3 man d- line

t ool for w or k ing w it h d at a in a Net I nf o dat abase. Unlik e dscl, tIhis t ool w ill not w ork wit h any ot her dat a sour ce. Th is t ool can also be u sed in sing le- shot SBN: 0- 59 6- 005 00 -8 m ode.

Pages: 32 6

nidum p Ex tMac r act sOS datXaPant fr omher a Net I n foultdat eitmy herKnife( leg acy Un f ile m at s h( such as ttohe Ru nning is t he im abase at e Swint issoAr TM) ; ix forflat pow er for user sw o w ant t he g/ et irectror int o Mac. a NetThis I nf o-bsp ecift ic for m at cust omfiles ize, f tound w eakin , and encerdally evy)u port heir ook ak raw es reader s .deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. niload Load s dat a fr om a flat file, eit h er a Unix / et c f or m at f ile or a Net I nfo r aw f orm at file.

niut il A sing le- shot t ool f or r ead ing and w r it in g Net I nf o d at abase infor m at ion. You shou ld consider using nicl in single- shot mod e inst ead of t h is t ool.

nifind Searches t h r ough a Net I nf o d at abase for direct or ies t hat mat ch a p at t ern .

nigr ep Searches t h r ough a Net I nf o d at abase for direct or ies or pr oper t ies t hat m at ch a p art icular pat t er n. Of t h ese com m ands, t h e m ost useful are dscl, nicl, nidum p , an d niload .

11.7.1 Backing Up and Restoring a NetInfo Database Befor e y ou get t oo cr eat iv e w it h y our Net I nf o d at abase, you shou ld m ak e sur e y ou h ave a good back up of it . You can cr eat e a b ack up simp ly by copy ing t he / v ar / db/ n et inf o/ local.n id b d irect or y. For exam ple, y ou can u se t he follow ing t o cr eat e a backu p: $ sudo Table cp -R /var/db/netinfo/local.nidb /var/backups/backup.nidb of Content s

• •

Review s



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

I• f you m anagReader e t o g Rev et tiew he sNet I nf o d at abase int o a st at e w h er e it can 't be u sed, you can boot in t o single- user m ode by holding dow n - S as t he com put er st ar t s u p. Wh en y ou ar e pr esent ed w it h • Er r ata t he sing le- u ser p rom p t ( # ) , ex ecu t e t he com m ands in Ex am ple 11 - 1.

Exa m pl e 1 1 -1 . Rest or in g t he N et I n f o da t a base in sin gl e- use r m ode Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub # lish/sbin/fsck er: O'Reilly

-y

Pub Dat e: Decem ber 2 00 3

# /sbin/mount -uw00 -8 / I SBN: 0- 59 6- 005 Pages: 32 6

# mv /var/db/netinfo/local.nidb /var/backups/damaged.nidb # cp -R /var/backups/backup.nidb /var/db/netinfo/local.nidb Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The f ir st comm an d m ak es su re t hat t he f ilesy st em is saf e. The second com m and mou nt s t he filesyst em in read/ wr it e m ode. Th e t hir d com m and m ov es t he dam ag ed dat ab ase out of t he w ay . The f our t h copies t he b ack up copy of t h e dat ab ase back int o place.

11.7.2 Using dscl The dscl com m and- lin e t ool is an int er act iv e p rog ram lik e t h e sh ell, w h ich m ean s t hat w hen you r un it , it st ay s act iv e. And, lik e t he sh ell, it feat ur es t ab- com plet ion and a h ist or y . This let s y ou nav igat e t hr ough t h e larg e am ount s of d at a t hat can be p r esent in Op en Dir ect ory . Th e best w ay t o lear n how t o use t h is t ool is t o go on a guid ed t ou r. Ex am ple 11 - 2 sh ows how t o launch dscl so t h at it w ill con nect t o Open Direct or y r unn in g on y our local sy st em .

Exa m pl e 1 1 -2 . La un ch in g dscl $ dscl . / >

The d ot is im por t an t . I t m eans conn ect t o Open D ir ect ory on t he local syst em . You' ll not ice t h at t he pr omp t chan ges t o t he gr eat er- t han ( >) sy m bol. Th is means t hat dscl is ready t o accept y our com man ds.Table 1 1- 1 list s t h e var ious com m and s you can use. The t op level of t h e dir ect or y t r ee t hat you ar e at w hen y ou st ar t dscl cont ain s t he v ar ious dir ect ory sou rces t hat Open Dir ect or y h as access t o. To see t h ese sour ces of dir ect or y inf orm at ion, use t he list com m and as show n in Ex am ple 11 - 3.



Table of Content s



Review s



Reader Rev iew s



Er r ata

• •

Academic Com m a nd

Tab le 1 1 - 1 . dscl com m an ds.

De scr ip t ion

Ten Things I Dig About Pant her Scheduling Tasks PrintinsPant ouher t the

• help

var ious com m an ds for d scl.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

list [path]

Pub lish er: O'Reilly Pub Dat e: cdpath

Lists the subdirect or ies of the giv en dir ector y. I f no pat h is given,th e subdir ectories of th e cu rr ent dir ect or y will be listed. Changes th e work ing dir ector y to the pat h giv en.

Decem ber 2 00 3

I SBN: 0- 59 6- 005 00 -8

Reads t he pr oper ties in a direct or y . I f n o pat h is giv en, t he cu rr ent path is used. You can specif y a specif ic key of a read [path [key]] pr opert y t o r ead. I f no k ey is giv en, all t he pr oper ties of th e path will be pr int ed. Pages: 32 6

searchpath key Sear ches f or r ecor ds that m atch a pat tern at th e given Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o val path. cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's coruser e, r evealing t he inn w ork ing s oft oPant hersyst f or em t h oseas w hao user w ant . t o g et can t h e most out of t heir auth Auterhen ticate t he You eit her syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it [password] specif iy a passw or d or let d scl prom pt you f or on e. , you 'll b e w ell on you r w ay. createpath [key [val]]

Cr eat es a path or a pr opert y with t he giv en k ey and v alu e at a path. This comm and will overw rite an y exist ing path or pr oper ty .

appendpath key val

Appen ds a pr opert y v alue to the pr oper ty at the giv en path.

mergepath key val

Appen ds a pr opert y v alue to the pr oper ty at the giv en path if t he v alu e does not already ex ist.

deletepath [key [val]]

Delet es a pat h or a pr oper ty value at th e given pat h.

changepath key oldval newval

Changes th e pr opert y v alue at t he giv en path .

changeipath key index val

Changes th e pr opert y v alue at a given index for the giv en path .

passwduserPath [newPassword]

Changes th e password f or th e user whose r ecord is at a given pat h.

quit

Qu itsd scl.

Exa m pl e 1 1 -3 . Usin g t he dscl l ist com m an d

/ > list NetInfo •

Table of Content s

• LDAPv3

Review s



Reader Rev iew s

• Er r ata PasswordServer •

Academic

Rendezvous • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

SLP Running

Ma c O S X P ant he r

By Jam es Duncan Davidson

SMB

Pub lish er: Search

O'Reilly

Pub Dat e: Decem ber 2 00 3 I SBN: Contact

0- 59 6- 005 00 -8

Pages: 32 6

/ >

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o To t ake a look at ,t he I nfo dat ab ves This as t he local or y serv ice dom ain,Mac u seOS t he cust om ize, t w eak andNet g en er ally r evase u pt hat t heirser Mac. b ook t akdir esect reader s deep in side cd an d t hen t he list com m ands as show n in Ex am ple 11 4. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Exa m pl e 1 1 -4 . Usin g t he dscl cd com m a nd

/ > cd NetInfo/ /NetInfo/root > list AFPUserAliases Aliases Config Groups Hosts Machines Networks Users

/NetInfo/root >

You' ll not ice t h e ex act sam e set of subd irect or ies in t he Net I nf o t r ee her e as y ou saw in Net I nf o Man ager, wit h on e key d if fer en ce, t he init ial let t er in each dir ect or y n ame is in up per case. This r ef lect s a m appin g f r om t he low er case n ames t h at Net I nf o uses t o t he new nam in g con vent ion •used by Op enTable of Content s can v iew t he pr opert ies of a su bdir ect ory r ecord w it h t he r ead Dir ect or y . You •com man d, asReview showsn in Ex am ple 11 - 5. •

Reader Rev iew s

To • t ake a look Er rat atat he Net I nfo dat ab ase t hat ser ves as t he local dir ect or y serv ice dom ain, u se t he cd an d t hen t he list com m ands as show n in Ex am ple 11 - 4. • Academic •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Exa m pl eO1S 1X P-5 . he Usin g t he dscl r e ad com m a nd Running Ma c ant r By Jam es Duncan Davidson

Pub lish er: O'Reilly /NetInfo/root > read Users/duncan Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 _shadow_passwd: Pages: 32 6

_writers_hint: duncan _writers_passwd: duncan _writers_picture: duncan Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS _writers_realname: X's cor e, r evealing t he duncan inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e _writers_tim_password: duncan w ell on you r w ay. sharedDir: Public AppleMetaNodeLocation: /NetInfo/root AuthenticationAuthority: ;ShadowHash; AuthenticationHint: GeneratedUID: A754A5A2-F4B3-11D7-A5F4-000A9599E492 NFSHomeDirectory: /Users/duncan Password: ******** Picture: /Library/Caches/com.apple.user501pictureCache.userImage PrimaryGroupID: 501 RealName: James Duncan Davidson RecordName: duncan UniqueID: 501

UserShell: /bin/bash /NetInfo/root >

ou sh nots ice t hat t his is b asically t he sam e inf or mat ion t h at y ou saw in Net I nf o •On ce ag ain, y Table ofould Content Man ager, but some of t he nam es ar e dif fer en t . You' ll also not ice t h e diff erence in capit aliz at ion • Review s du e t o a bit of t ran slat ion behin d t he scenes b et w een t he older Net I nfo st yle of n am in g an d t he • Reader Rev iew s new er Open Dir ect or y st y le. Table 1 1- 2 p r ovides a m apping of t h ese pr op er t ies. I f y ou ju st w ant • Er r ata t o read a sing le pr opert y fr om a user recor d, y ou can use t h e r ead com man d, as sh ow n in • Academic Ex am ple 11 - 6. •

Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Exa m pl e 1 1 -6 . Rea din g a p r oper t y fr om a user r ecor d By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 > read duncan PrimaryGroupID /NetInfo/root/Users I SBN: 0- 59 6- 005 00 -8

PrimaryGroupID: 501 Pages: 32 6

So f ar , y ou'v e on ly been r eading v alu es fr om t h e dat abase. To wr it e a v alu e, you 'll f irst need t o Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o aut h en t icat e and t hen use t he creat e com m and. For ex am ple, if you w ant ed t o set t he cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Aut h en t icat ionHin t p r opert y , y ou w ould use t he set of com m ands sh ow n in Ex am ple 11 - 7. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Exa m pl e 1 1 -7 . W r it in g a p r op er t y t o a u se r r e cor d

/NetInfo/root/Users > auth duncan Password:******** /NetInfo/root/Users > create duncan AuthenticationHint "The Usual"

Now , w hen you t ak e a look at t h e Aut h en t icat ionHin t p r opert y , y ou' ll see t hat it has ch anged, as show n in Ex am ple 11 - 8.

Exa m pl e 1 1 -8 . Che ck in g a m odi f ie d pr op er t y

/NetInfo/root/Users > read duncan AuthenticationHint

AuthenticationHint: The Usual



On e imp ort ant t hing t o n ot e abou t t h e aut h com m and is t hat it w ill on ly aut h en t icat e you in t he d irect or y dat ab ase t hat y ou ar e w or king in. For Table of Content s exam ple, if y ou hav e an LDAPv 3 direct or y config ur ed in Open Dir ect or y , Review s w hen you aut hent icat e in t he Net I nfo dat ab ase, y ou ar e not aut hent icat ed Reader RevLDAPv3 iew s in t he d at abase.



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

• •

When y ou ar e r eady t o leav e t h e dscl sh ell, use t h e qu it com m and. Running Ma c O S X P ant he r

You can also u se dscl in single- shot mod e—t his is w her e you can en t er a com m and dir ect ly at By Jam Davidson t he shesellDuncan p r omp t an d it w on' t r esu lt in an in t er act iv e sh ell. For ex am ple, fr om t h e com m and line w e can read t he Aut h en t icat ionHin t p r opert y as show n in Ex am ple 11 - 9. Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Exa mI SBN: pl e 0-15916--9 Usin g d scl i n si ngl e- shot m ode 005. 00 -8 Pages: 32 6

$ dscl localhost -read /NetInfo/root/Users/duncan AuthenticationHint AuthenticationHint: The Usual Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You 11.7.3 niclm ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The nicl com m and w or ks in m uch t he sam e w ay as t h e dscl com m and. The m ajor diff erence bet w een t h e t w o is t h at nicl p r esent s on ly dat a in t h e Net I n fo dat abase and p resen t s pr oper t y nam es in Net I nf o f or mat . To r un nicl, u se t he com man d sh own in Ex am ple 11 - 10.

Exa m pl e 1 1 -1 0 . St a r t i ng ni cl $ nicl . / >

When y ou ar e at t he nicl p r omp t , y ou can use t h e same com m and s as dscl, list ed in Table 1 1- 2. For exam ple, t o list t he d irect or ies at t he t op of t he Net I n fo t r ee, u se t he list com m and as show n in Ex am ple 11 - 11.

Tab le 1 1 - 2 . M app ing be t w ee n Ne t I n fo an d O pe n Di r ect or y st yl e user pr ope r t y n am e s

O pe n D ir e ct or y Pr ope r t y Key Aut hen ticationAuth or ity Aut hen ticationHint Gener at edUI D NFSHomeD ir ector y • Password Table of Content s • Pictur e Review s • Prim ar y GrReader oupID Rev iew s • RealNameEr r ata • RecordName Academic • UniqueID Ten Things I Dig About Pant her • UserSh ell Scheduling Tasks in Pant her

Ne t I n fo Dir e ct or y Pr ope r t y Key authent icat ion_ au thor it y hint gener ateduid hom e passwd pictu re gid r ealname nam e uid sh ell

Running Ma c O S X P ant he r By Jam es Duncan Davidson

ExaPubmlishpler:e O'Reilly 1 1 -1 1 . Usi ng t h e ni cl li st com m a nd Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

/ > 1

Pages: 32 6 list

users

2 groups Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o 3 om ize, tmachines cust w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir 4 em . You networks syst m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. 5 protocols 6

rpcs

7

services

8

aliases

9

mounts

10

printers

68

afpuser_aliases

72

config

You can see fr om t he out p ut in Ex am ple 11 - 11 t hat each dir ect or y in t he Net I nf o dat abase has a nu mb er associat ed w it h it as well as a nam e. To read t he p rop er t ies associat ed w it h a user , use t he r ead com m and as show n in Ex am ple 11 - 12.

Exa m pl e 1 1 -1 2 . Usi ng t h e ni cl r ea d com m an d

/ > read /users/duncan sharedDir: Public •

Table of Content s authentication_authority: ;ShadowHash; •

Review s

• Reader Rev iew s name: duncan •

Er r ata

• Academic home: /Users/duncan •

Ten Things I Dig About Pant her

• passwd: ******** Scheduling Tasks in Pant her Running Ma c O S X P ant he r

realname: James Duncan Davidson By Jam es Duncan Davidson uid: 501

Pub lish er: O'Reilly

Pub Dat e: Decem ber 2 00 3 shell: /bin/bash I SBN: 0- 59 6- 005 00 -8 Pages: 32 6 generateduid: A754A5A2-F4B3-11D7-A5F4-000A9599E492

gid: 501 picture: /Library/Caches/com.apple.user501pictureCache.userImage Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o hint: cust om foo ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir _writers_passwd: syst em . You m ay notduncan be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. _writers_hint: duncan _writers_picture: duncan _shadow_passwd: _writers_tim_password: duncan _writers_realname: duncan

11.7.4 nidump The nidum p com m and is pr im arily u sed for out pu t t ing t he cont en t s of t he Net I nf o d at abase in st andar d Unix for m at s an d f or m ak in g backu ps of t h e dat abase. For exam p le, t o out p ut t he u ser inf orm at ion in t he d at abase in t he t r adit ional for m at u sed by / et c/ passw d , y ou w ould use t he nidum p com m and as show n in Ex am ple 11 - 13.

Exa m pl e 1 1 -1 3 . Usi ng t h e ni dum p com m a nd

$ nidump passwd . nobody:*:-2:-2::0:0:Unprivileged User:/var/empty:/usr/bin/false root:*:0:0::0:0:System Administrator:/var/root:/bin/sh daemon:*:1:1::0:0:System Services:/var/root:/usr/bin/false •unknown:*:99:99::0:0:Unknown Table of Content s User:/var/empty:/usr/bin/false • Review s • smmsp:*:25:25::0:0:Sendmail Reader Rev iew s User:/private/etc/mail:/usr/bin/false •

Er r ata

lp:*:26:26::0:0:Printing Services:/var/spool/cups:/usr/bin/false • Academic •

Ten Things I Dig About Pant her

postfix:*:27:27::0:0:Postfix User:/var/spool/postfix:/usr/bin/false • Scheduling Tasks in Pant her Running Ma c O S X P ant he r

www:*:70:70::0:0:World Wide Web Server:/Library/WebServer:/usr/bin/false By Jam es Duncan Davidson

eppc:*:71:71::0:0:Apple Events User:/var/empty:/usr/bin/false Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 mysql:*:74:74::0:0:MySQL Server:/var/empty:/usr/bin/false I SBN: 0- 59 6- 005 00 -8

sshd:*:75:75::0:0:sshd Privilege separation:/var/empty:/usr/bin/false Pages: 32 6 qtss:*:76:76::0:0:QuickTime Streaming Server:/var/empty:/usr/bin/false cyrus:*:77:6::0:0:Cyrus User:/var/imap:/usr/bin/false Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o mailman:*:78:78::0:0:Mailman user:/var/empty:/usr/bin/false cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir appserver:*:79:79::0:0:Application Server:/var/empty:/usr/bin/false syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. duncan:********:501:501::0:0:James Duncan Davidson:/Users/duncan:/bin/bash

To m ak e a backu p of t he Net I n fo dat ab ase, h andy f or w hen you w ant t o mak e p ot en t ially har m fu l chang es, u se t he f ollow ing com man d: $ nidump -r / . > nibackup.txt

11.7.5 niload The niload com m and is comp lem ent ar y t o nidum p . Th is com m and can accept a v ar iet y of Unix / et c f iles as inpu t t o add dat a t o a Net I n fo dat abase. For exam ple, t h e follow ing comm and loads a / et c/ passw d - st y le file nam ed user s int o t he dat abase: $ niload passwd . < users To p er f orm a f ull d at abase r est or e f rom t he out put of a nidum p com m and, you w ould use t h e follow ing com man d: $ nidload -r / . < nibackup.txt

11.8 Further Explorations Sever al r esou rces ar e av ailab le t o help you d eepen you r un derst an ding of dir ect or y serv ices an d t he t echn ologies behind Open Dir ect or y . These ar e: • • • •

Table of Content s

Mac OS X Ser v er Open Dir ect or y Adm inist r at ion b y App le Com put er av ailable at Review s w w w .ap ple. com / m acosx / ser v er . Reader Rev iew s

Er r ata LDAP Syst em Adm inist r at ion , b y Gerald Car t er ( O' Reilly & Associat es, 2 003 )

• •

Academic

Kerb er os: e Definit e Guide b y Jason Garm an ( O' Reilly & Associat es, 2 003 ) Ten Th Things I Dig iv About Pant,her



Scheduling Tasks in Pant her

Also, you t or ref er t o t h e follow ing man pages: Running Ma m c Oay S XwPant ant he By Jam es Duncan Davidson

Dir ect ory Ser vice Pub lish er: O'Reilly

net info Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

dscl

Pages: 32 6

nicl nidum p niload Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS fsck X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 12. Printing The Mac' s im pr essive pr int ing capabilit ies dat e b ack alm ost 2 0 year s t o t he int r odu ct ion of t h e Post Script - based Laser Wr it er p r in t er in 1 985 . Dur ing t h e t r ansit ion t o Mac OS X, Ap ple r ed esign ed t h e pr int ing syst em t o m ake it easier f or pr int er s t o d ev elop d riv ers, an d also mad e it •m or e flexib leTable Content s is was by no m ean s a seam less t r ansit ion as it t ook t im e f or pr int er and of rob ust . Th •m anuf act ur ers Review t o r sewr it e t h eir d r iv er s. Bu t w it h Pant h er , t he pay of f for t h is w ork has been •r ealized: seam Reader s fr om an y applicat ion t o any Mac- or Win dow s- based pr int er an d less Rev p riniew t ing •bey ond t o PDEr Fr ata gener at ion an d b uilt - in fax capab ilit ies. What once w as dif ficult , if not im possib le, •is now ver y easy Academic t o do. •

Ten Things I Dig About Pant her

giv es y ou Tasks an over v iew •This chap t er Scheduling in Pant herof h ow t h e pr int sy st em w ork s, how t o ad d an d con figu re local and wXorPkant prhe int Running Manet c OS r er s, and how t o w or k w it h pr in t ers fr om t h e com m and line. By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

12.1 Print System Overview Mac OS X' s pr int ing syst em m ak es use of t he f ollowin g t echn olog ies: Qu art z and PDF f or cr eat in g p r in t - r ead y out p ut f r om app licat ions.



Table of Content s



Review Com m on Un ixs Prin t in g Syst em ( CUPS) for m anag ing pr int ers, p r in t er dr iver s, and pr int Reader Revaccep iew s t s pr int job s using t he I nt er net Prin t in g Prot ocol ( I PP) . The CUPS job s. CUPS also r atabe foun d on t h e I nt er net at w w w .cup s.or g/ . pr oj ect Er can

• • •

Academic

Sam ba Ten 3 f or connect t o Pant Win her dow s SMB- b ased pr int er s and f or r eceiv ing pr int job s fr om Things I Diging About Wind ows client s. Tasks Add itinional Scheduling Pant inf heror mat ion on Sam ba can be foun d at w w w .sam ba. or g/ .

• •

Running Ma c O S X P ant he r

Op en Dir ect or y f or locat ing pr int ers w it h LDAP, Net I nfo, Rendezv ous, and SMB.

By Jam es Duncan Davidson

Gener ally t he pr int er s t h at y ou w ill use com e in t w o var iet ies: Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 32 6ed LocallyPages: at t ach

Pr int ers t hat are dir ect ly connect ed t o y our m achine v ia USB or Fir eWire. You can alw ay s access t hese pr int er s and , if you choose, shar e t hem w it h ot her com put er s on t he net w ork by g oing t o Sy st em Pr ef er ences Shar ing Serv ices and en abling Pr in t er Shar ing. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Net w ork accessible syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Pr int ers t hat are eit h er con nect ed dir ect ly t o t he net w ork ( su ch as m any laser pr int er s in off ice en vir onm ent s) or are at t ached t o ot her com pu t er s t h at h ave enab led pr int er shar ing . Becau se Mac OS X un derst an ds a var iet y of net w or k pr ot ocols, it can con nect t o p r in t er s host ed by Wind ow s- and Unix- based m achines as w ell as by ot her Macs. I n addit ion t her e ar e t w o v ir t ual t y pes of p rint er s t h at ar e b uilt int o t he p r in t sy st em :

Fax From any p rint dialog, you can pr ess t h e Fax but t on an d fax a docum ent w it h t h e mod em bu ilt int o you r Mac.

PDF I nst ead of p rin t ing t o h ard copy , y ou can easily g en er at e PD F files.

12.2 Managing Printers The Pr int er Set u p Ut ilit y ( / App licat ions/ Ut ilit ies) is t he p rincipal applicat ion u sed t o define an d m anage pr int ers fr om t h e GUI . You can eit her launch t his ap plicat ion dir ect ly or fr om t h e Pr in t & Fax pr efer en ce p anel. When launched, it display s a list of t h e pr int er s t hat y ou can use, as show n •in Figur e 12 - 1. Table of Content s •

Review s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling FiguTasks r e 1in2Pant -1 her . Th e

Each pr int er in t he list show s w h et h er it app ear s in Pr int dialog's menu , t he nam e of t he p r in t er, • Reader Rev iew s it s cur r en t st at u s, t he k ind of pr int er it is, an d t he host it is at t ached t o.

Pr i nt er Se t u p Ut il it y w i ndow

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

I n t he f ig ur e, t w o p rin t er s ar e local t o t he m achine ( Qu icksilv er. local ) , an d on e pr int er is b eing shar ed f r om anot h er m achine ( TiBook . local ) . Th e defau lt pr int er , w hich is sh ow n in bold face in t he Prin t er Set u p Ut ilit y, is used au t om at ically by t he sy st em w h en ev er a d ocu ment is pr int ed. You can select t he def ault p rin t er by hig hlight in g t h e nam e of t h e pr int er and click ing t he Make Defau lt bu t t on. Dou ble- clicking a pr int er in t he p rint er list br in gs u p a w indow sh ow in g t he pr int qu eu e ( a list of pend in g pr int j obs) for t h at p rin t er alon g wit h t h e st at us of t h e pr int er , as show n in Figur e 12 - 2.

Figu r e 1 2 -2 . A pr i nt er que ue st a t u s w ind ow sh ow s a p r in t j ob be in g sen t t o a pr i nt er



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: can g et32m6 ore

You in for m at ion about a p rin t er by hig hlight ing it in t h e Pr int er Set up Ut ilit y list and click ing t he Sh ow I nf o bu t t on, or by g oing t o t h e Pr in t ers Show I n fo ( - I ) m enu . This w ill br ing up a dialog w ind ow as show n in Figur e 12 - 3. Th e w in dow sh ows t he n ame an d locat ion of t he pr int er ( bot h f ields can be ed it ed for a local pr int er ) , t h e nam e of t h e pr int queue ( u sed by t he und er ly in g CUPS syst em t o rou t e pr int job s) for t he p rint er , an d t he host t he p rint er is locat ed on. also ains ll- diss own enu t hatTM) giv;esforyou access t os tw heh op rin t er t o Ru nning MacThis OS wXindow Pant her is cont t he ult imaatpu e Sw Ar m my Knife( pow er user w ant m odel or tmat ion, and as wgell t h e rinst le opt ions, such as du , extsradeep paper t r ay Mac s, and cust ominf ize, w eak enas er ally ev uallab p t heir Mac. This b ook t akplexer es reader in side OS inst allable m em or y tthe h atinn arer e av ailable o tPant he prher int er X's cor e, r evealing w ork ing s tof f or. t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e To r iev e tr hweay. list of pr int er s t hat you r Mac k now s ab out , go t o t he com m and line and u se t he w ellr et on you lpst at - a com m and as show n in Ex am ple 12 - 1.

Figu r e 1 2 -3 . Th e pr in t e r i nf o w in dow



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Exacor me,plr eevealing 1 2 -1 .t he See heingcom pu ther e r sf ora tt ht aose chwed a tM ac X's innin er gw tork s of Pant h o twoant og et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. $lpstat -a DESKJET_990C@TiBook accepting requests since Jan 01 00:00 HP_LaserJet_2200 accepting requests since Jan 01 00:00 Stylus_Photo_900 accepting requests since Jan 01 00:00 Internal_Modem accepting requests since Jan 01 00:00

The ou t pu t f rom t he lpst at - a com m and list s t he p rint er s b y queue nam e and, in t h e case of a pr int er locat ed on a rem ot e m achine, t h e nam e of t he machin e t hat host s t h e pr int queue f or t h e pr int er .

Tw o it em s m ay show u p in t h e out pu t f r om lpst at - a t hat don' t ap pear in t he Prin t er Set u p Ut ilit y. These w ill be labeled I n t ern al_M odem an d Blu et oot h- Mod em . Th ese dev ices ar e u sed by t h e und er ly ing pr int sy st em t o han dle fax ing f rom applicat ions v ia t h e Prin t Dialog box .

To see t he default pr int er f rom t he com m and lin e, use t he lpst at - d com m and, as show n in Ex am ple 12 - 2.

Exa m pl e 1 2 -2 . See in g t he de f au lt pr i nt e r f r om t he comm a n d l in e •

Table of Content s



Review s

•$lpstat -d Reader Rev iew s • Er r ata •system default Academic destination: HP_LaserJet_2200 • Ten Things I Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

To set t he def ault p rin t er t hat is in u se by t he sy st em fr om t h e comm an d line, u se t he lpopt ions d com m and w it h t he qu eu e nam e of t h e pr int er t o mak e t h e defau lt qu eu e. Ex am ple 12 - 3 sh ows Pub lish er: O'Reilly t he use of t his com m and. Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Exa m pl e 1 2 -3 . Set t in g t he d ef au lt pr i nt er fr om t h e com m an d l in e

$lpoptions -d Stylus_Photo_900 Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS job-sheets=none,none X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

12.3 Adding and Configuring Printers Man y pr int ers, in clu ding t hose t h at ar e dir ect ly con nect ed t o y our m ach in e v ia USB or FireWir e and t h ose t hat ar e shar ed by ot h er Macs, au t om at ically ap pear in t he list of pr int er s in t he Pr int er Set up Ut ilit y , m ak in g t hem r ead y t o use almost imm ediat ely. How ev er , if y ou w ant t o use t er t hat •a n et wor k - based Table pr of in Content s isn 't shar ed by a Mac or use a p rin t er for w h ich y our Mac can 't fig ur e out t he d riv er t o use aut om at ically , y ou' ll hav e t o add it y our self . • Review s •

Reader Rev iew s



Scheduling Tasks in Pant her

To ad d a pr int er , click t he Add Pr int er bu t t on ( or use t h e Pr in t ers Add Pr int er m enu) . Af t er a • Er r ata few mom ent s, a dialog sh eet ( sh ow n in Figur e 12 - 4) pops u p t hat allow s y ou t o ad d t he pr int er • and specif y itAcademic as t he d ef ault . Th e pull- d own m enu at t he t op of t he d ialog h as t he f ollowin g •opt ion s t o choose Ten Things I Dig About Pant her f r om: Running Ma c O S X P ant he r By Jam es Duncan Davidson

Figu r e 1 2 -4 . Addin g a pr in t e r u si ng Pr in t U t il it y Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Can't Print to an LPD/LPR Printer? The v er sion of CUPS t h at ships in Pan t her im plem ent s a chang e w hich m ak es some older LPD / LPR pr int ser v er s r eject j obs. I f you hav e t h is pr oblem, you can find a w or kar oun d at w w w .m acosxh in t s. com / ar t icle. ph p?st ory = 20 031 118 180 912 371 . •

Table of Content s



Review s



Reader Rev iew s



Er r ata

•App leTalk

Academic



Ten Things I Dig About Pant her

Scheduling Let s y ou add andTasks confinigPant ur e her a p r in t er using t he legacy App leTalk p rot ocol. You can select t h e local AppleTalk zone an d fr om any ot her zones t h at y our com pu t er k now s abou t. By Jam es Duncan Davidson •

Running ant he fr Ma omc O prSinX tPers onr

Pub lish er: O'Reilly Pub I P Pr in tDat inge:

Decem ber 2 00 3

I SBN: 0- 59 6- 005 00 -8

Let s y32 ou6 Pages:

add and conf ig ur e a p r in t er con nect ed t o a serv er ( eit her a st an dalone m achine or an em b ed ded ser ver inside t h e pr int er ) u sin g an I P- based p r ot ocol. These p rot ocols include: LPD/ LPR, a Un ix - b ased pr int ing pr ot ocol t h at h as become a de- f act o indu st ry st andar d ; I nt er net Pr int in g Pr ot ocol( I PP ) , a new er pr ot ocol based on HTTP t hat is int end ed t o pr ovid e bet t er int er operab ilit y over I nt er net - b ased net w or ks; and HP's Jet Dir ect pr ot ocol, w idely deployed in HP net w or k- enabled pr int ers. Because t hey ar e I PRu nning Mac tOS X Pant is can t he be ult im at e tSw iss m Arunicat my Knife( forerpow er ond useryou s wrhlocal o w ant t o based, h ese p rot her ocols u sed o com e w itTM) h pr; int s bey cust omnet ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS w or k. X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Op en Dir ect or y Let s y ou add a p r in t er defined in t he v ar iou s Dir ect or y Ser vices t hat you r comp ut er has access t o. For ex am ple, if y our net w ork adm inist rat or set up infor m at ion about t he com put er s on you r net w or k in an LDAP ser ver t h at y our m achine con nect s t o, t hat inf orm at ion show s up h er e.

Rend ezv ous Let s y ou add Rend ezv ous- enabled pr int er s t hat don' t aut om at ically show up in y our pr int er list bu t t h at ex ist on t he n et w or k .

I f you ar e using a USB pr int er at t ached t o an Air Port Ex t r eme b ase st at ion, t he pr int er w ill show up in t h e Rend ezv ous sect ion.

USB

Let s y ou add any USB p r in t er t hat isn 't already set up on y our mach in e. Typ ically , only USB- based pr int er s f or w hich Mac OS X can't f ig ur e out t he p r oper dr iver t o use app ear her e inst ead of b ein g au t om at ically add ed t o t he list of p rin t er s.

Window s Pr int ing • • •

Let s y ou Table connect of Content t o any s p rin t er t hat is bein g sh ared by a Window s or Window s Ser v er m achine. The list of p rin t er s is or g anized b y w ork gr oup or d om ain ; y ou can select t he Review s w or kg rou p or dom ain t o look f or pr int er s. Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Managing Printers over the Web with CUPS

Running Ma c O S X P ant he r By Jam es Duncan Davidson

The Pr int er Set u p Ut ilit y isn 't t he on ly int erf ace for man aging t he pr in t sy st em . You can t he CUPS lay er of t he p r in t sy st em direct ly by load in g Pubaccess lish er: O'Reilly ht tPub p: / Dat / localhost 632100in e: Decem :ber 3 t o a w eb br ow ser . Th is pr esent s a w eb- based in t erf ace t hat allow sI SBN: you 0-t o59dir ect ly 6- 005 00 -8int er act w it h t he diff er ent par t s of t h e CUPS syst em . Pages: 32 6

The m ost usef ul p ar t of t h e CUPS w eb in t er f ace is t he Pr int er s sect ion. Th is list s t he sam e kin d of inf or mat ion , and let s y ou p er f orm t he sam e k inds of t ask s, as t h e Pr int er Set up Ut ilit y . I t s m ain adv ant age is t hat it is accessible fr om ot her m ach in es on t he n et wor k w h en pr int er shar ing is t u rn ed on. For m ore sopOS histXicat edher cont erim how d t oTM) exer gr eat secur Ru nning Mac Pant isr ol t heovult at e CUPS Sw iss wArork mys an Knife( ; cise for pow er er user s w it h yo w ant t o ov er pu tgerenwerork s as or k-Mac. accessible pr intt ak ser yous can edin it side t he Mac OS cust omhow ize, yt our w eakcom , and ally r eva unet p tw heir This b ook esv er, reader deep plaint exr tevealing con figurtat hat ing CUPS ses her t h atf or ar et hlocat edh oinwt ant h e / tet cu ps X's cor e, heion innfiles er wt ork s of uPant ose w o c/ g et t h e most out of t heir dir ect y . You can f ind docum iony for con rinbook g an ,d bad in ist er ing syst emor . You m ay not be fu a llMac gu ruent wat hen ou st ar figu t t his utmonce you 'v eCUPS r ead it , you 'll b e .cup s.or g , or by follow ing t he Docum en t at ion link fr om t h e CUPS wonline ell on at youwrwwway. conf ig ur at ion web int er face.

No m at t er w h ich t y pe of conn ect ion is used t o connect t o a p rin t er , y ou' ll need t o select in t he pr int er m odel b y using t he Pr int er Model pu ll- d ow n m enu at t he bot t om of t he Add Prin t er dialog. This w ill set t he p r in t sy st em t o use t h e corr ect dr iv er for t h e pr int er . App le sh ips w it h dr iv er s f or pr int er s fr om Ap ple, Br ot her, Canon , Ep son , HP, Lex m ark , Tek t r onix, and Xer ox . For dr iv er s f or ot her p rin t er s, y ou' ll need t o check y our m anuf act u r er ' s w eb sit e.

Sup por t f or m any p rin t er s t h at w er e pr eviously un su ppor t ed und er Mac OS X h as been ad ded t hank s t o CUPS and Gim p- Print , a set of op en sour ce pr int er d riv ers for m any old er ( as w ell as new er ) pr int ers. You can ev en fin d a dr iv er f or t h e or ig inal Ep son 9 - pin dot mat rix p rin t er by look in g un der ESP in t h e Pr in t er Model p ull- dow n in t he Add Pr int er dialog. You can fin d m or e inf or mat ion on Gim p- Pr int at gim p pr in t .sou rcefor ge.n et / .

On ce a pr int er h as been ad ded, y ou need t o mak e sur e t h at it is configu r ed pr oper ly. There are m any set t ings, such as w het her or not a pr int er h as a d uplexer f or t w o- sided pr in t ing, or how m uch mem or y it h as inst alled; t hese it ems can 't alw ays b e aut om at ically con figu red for you . To exam ine t he conf ig ur at ion for a pr int er , select it in t h e list and click t h e I nfo but t on, or select Pr int ers Show I n fo ( - I ) f r om t he menu bar .

12.3.1 Determining IP-based print queue names To ad d an I P- b ased pr int er , y ou'll need t o kn ow t he I P addr ess or host n ame of t he ser v er, possibly t he nam e of t he q ueue f or t he p r in t er you w ant t o use if t he serv er han dles mor e t han one p r in t er, and t he m odel of t h e pr int er . To get t h e nam e of a q ueue f or a p r in t er , you can et w or adm inist r at or or u se t he lpst at - a - h com m and, as show n in Ex am ple 12 - 4. •eit her ask a nTable of kContent s •

Review s



Reader Rev iew s

Exa m pl e 1Er2r ata -4 . Usin g l pst a t - h t o li st qu eu e na m es on a m a ch ine • •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

$ lpstatMa-a Running c O S-h X P TiBook.local ant he r By Jam es Duncan Davidson

Internal_Modem accepting requests since Jan 01 00:00 Pub lish er: O'Reilly DESKJET_990C@TiBook accepting requests since Jan 01 00:00 Pub Dat e: Decem ber 2 00 3

HP_LaserJet_2200@Quicksilver accepting requests since Jan 01 00:00 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Stylus_Photo_9001@Quicksilver accepting requests since Jan 01 00:00

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o The ou t pu t in Ex am ple 12 - 4 con t ain s m or e pr int er s t han t hose conn ect ed t o t h e m ach ine t hat t he cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS inf orm at ion w as r eq uest ed f rom . I t also includes t h e ot her shar ed p rin t er queue n am es on t h e X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir net w or k and ind icat es t h e host nam es t hat t hose q ueues are on. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

12.3.2 Vendor-specific connections Depend in g on t h e dr iv er s y ou hav e inst alled, t her e m ay be sever al add it ional it em s in t he Add Pr int er pu ll- d ow n m enu. These are pr ovided by p r in t er m anuf act u r er s t o hand le sit u at ions t h at ar en 't cover ed b y t he b uilt - in capab ilit ies of Mac OS X.

12.4 Anatomy of a Print Job Ev ery pr int j ob st art s as out p ut fr om an applicat ion. Th e fir st st ep, alb eit one t h at is alr eady per for m ed f or y ou, is t o pr odu ce out pu t f rom an applicat ion an d t ell it w hat size p aper y ou w an t t o use and t he orient at ion of t hat pap er . I n m ost app licat ions t his is usually accom plish ed by dar dof File Page Set u p ( Sh ift - - P) com m and , w hich b r in gs u p t h e dialog sh ow n in •using t he st an Table Content s Figur e 12 5. Most of t he t im e y ou' ll w ant t o leav e t he d ef ault set t ing s in t his dialog or j ust • Review s chang e t he or ient at ion of y our pag e. How ev er, if y ou ar e pr int ing a 4 x 6 p hot o or an en velope, • Reader Rev iew s y ou' ll w ant t o select a pr int er at t ached t o y our sy st em w hich w ill g iv e y ou access t o t he pag e • Er r ata sizes it can h andle. •

Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Not all applicat ions h ave a Page Set up d ialog box , an d t hose t hat do don' t alw ays hav e t he Sh if t - - P key boar d sh ort cut .

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly

The second st ep in get t ing out p ut fr om an app licat ion is t o p rin t a docum en t u sin g t he st andar d Pub Dat e: Decem ber 2 00 3 File Pr int ( - P) com m and , w hich b r in gs u p t h e dialog sh ow n in Figur e 12 - 6. Fr om her e y ou I SBN: 0- 59 6- 005 00 -8 can pr in t t o a p r in t er , sav e t o a PDF file, or fax docum en t s any w her e in t he w or ld. This rat h er Pages: 32 6g ives access t o a w ealt h of opt ions t hat can be p er f orm ed by b ot h t he syst em an d simp le dialog by in divid ual p rin t er dr iv er s. The dialog let s you select t he pr int er t o pr int t o, list ing bot h local pr int er s and r emot e pr int ers. I t also giv es you t he oppor t un it y t o use a set of pr eset set t in gs an d t o cu st om ize t h e pr int er - , and p ossibly , app licat ion- specific set t ings. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn Figu er w ork r e ing 1 2s-5 of .Pant Thher e Pa f orge t h ose Setwup h o wdia ant log t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 1 2 -6 . Th e st an dar d pr i nt di al og



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

The f ollow in g set t ing s ar e alway s av ailable: I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Cop ies & Pages Let s y ou specif y how m an y cop ies of a docum ent you w ant t o pr in t . Som e app licat ions put Ru nning X Pant her he ult im att oe allow Sw iss you Ar my ; forcon pow w hino twerant addMac it ionOS al cont r ols intis o tt his p ane t o Knife( specif TM) y w hat t enert tuser o prsint m s ttohat cust ommize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac ake sense f or t he applicat ion. For exam p le, w h en y ou pr in t f r om Microsof t Excel, youOS X's corhav e, reevealing t heerinn er sh w eet orksing ofint Pant h ose w h o w ant t o g et t h e most out of t heir cont r ol ov t he t ospr outher of faorwtor kb ook. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. Lay out Giv es you t h e abilit y t o p r in t u p t o 16 pag es on on e sid e of a sheet of p aper and t he opt ion t o pr int on b ot h sides of t h e sheet , if y our pr int er supp ort s dup lex t w osided pr int ing . Con fusing ly en ough , y ou can' t con t rol t he or ient at ion of pr int ing her e—you hav e t o set t hat using t he Page Set up dialog befor e y ou pr int .

Ou t put Opt ions Giv es you t h e abilit y t o sav e y our p rint j ob as eit h er a PDF or a Post Script f ile.

Scheduler Let s y ou sch ed ule a p rin t j ob t o be pr int ed at som e t ime in t h e fu t ur e. You can ev en place a j ob on t he pr int er q ueue, and hold it in definit ely un t il a t im e w h en y ou ar e r eady f or it t o be p r in t ed. This last opt ion is usef ul for w h en y ou ar e t rav elin g an d don' t h ave access t o y our p rint er back at t h e off ice, b ut w ant t o cr eat e p r in t j obs b ef or e arr iv ing at y our dest inat ion.

Paper Hand ling Let s y ou cont r ol how t he p ages ar e or dered w hen p r in t ed, or t o pr int only even- or od dnu mb er ed pages. This is h andy wh en y ou w ant t o m anu ally p rin t t w o- sided docum en t s on a p r in t er t hat doesn't supp ort du plex pr int ing. •

Table of Content s



Review s



Reader Rev iew s

Color Syn c •

r ata Set s w Er het her or n ot y ou w ant t he t r ansf orm at ion fr om t he docum ent ' s color space t o t he Academic pr int er 's t o be perf or med by t h e pr int er . Usu ally you w ant Mac OS X t o per for m t h is w ork • Dig AboutmPant un less Ten y ouThings hav e Ialready od ifher ied t h e color s in t he docum en t t o pr int corr ect ly on t h e • Scheduling Tasks in Pant hergiv es y ou access t o filt ers, such as app lying a sepia t one or t ar get p r in t er. This pan e also Running Ma cer OS X P ant heayscale r conv t ing a gr docum ent t o b lack an d w h it e, t hat are perf or med by Quar t z. •

By Jam es Duncan Davidson

SumPub m lish ar yer:

O'Reilly

Pub Dat e: Decem ber 2 00 3

Giv es 0-a59t ex t r epr I SBN: 6- 005 00 -8esent at ion of all t h e cu r rent set t in gs f or a p rin t j ob. Pages: 32 6

I n addit ion t o t hese st an dar d set t ing s, man y pr int er dr iv er s ad d ad dit ional opt ions t o t his m enu . For exam ple, t h e HP Laser Jet pr int er d riv er add s panes t o let y ou select w hich p aper t r ay t o u se, w het her or n ot t o gener at e a cov er page, an d t he r esolut ion y ou w ant t o pr int at . As anot her exam ple, t h e Ep son St y lus Phot o pr int er d riv ers add panes allow ing you t o select t h e kin d of pap er you ar e pr int ing on since diff erent pap er s r eact dif fer en t ly t o p hot ogr aph ic pr int ing . Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust ize, eakhav , and en er ally t heir deep in side OS Somom et im es tywou e t oglook car efr ev ullyu p her e f orMac. a setThis t ing byook ou wt ak anes t t oreader use. sFor ex am ple, Mac t he dr iv er X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of for HP's I nk Jet p r in t ers t hat su ppor t dup lex p rint in g don' t allow y ou t o set u p t w o- sided pr intt heir ing syst emt he . You ay pane; not beinastMac w hen stsided ar t t his book b ut once 'v e r and ead accessib it , you 'll le be using Laym out ead,gu a ru separ at ey tou w op rin t ing, pane is pryou ovided w ell on you r w ay. v ia t he low er p ull- dow n menu . Of cour se w e can' t t est an d d et ail t he q uirk s of each pr in t er m odel her e, but t he point is you 'll n eed t o check out all t h e opt ions t hat you r pr int er dr iv er gives y ou.

12.4.1 Saving Print Settings The Pr int dialog' s Pr eset s m enu let s you cr eat e pr eset s of y our chosen set t ing s across all t h e opt ion pan es, allow ing y ou t o qu ick ly set up a p r in t j ob. For ex amp le, you m ight w ant t o p rov ide a D ouble- Sided set t ing so y ou can q uickly op t f or du plex pr in t ing. Anot her g ood p reset is a Phot o pr eset t hat set s t he pap er t yp e and Color Sy nc opt ion s for you r par t icular pr int er . To sav e a set of p r in t set t ings, sim ply use t h e pu ll- d ow n m enu and select t h e Sav e As opt ion. On ce ap plied , t he nam e t hat y ou choose f or a gr oup of pr int set t ing s w ill alway s ap pear in t his m en u.

12.4.2 The Simplified Print Panel Som e app licat ions t hat aim for an ease- of - use int er face, such as iPhot o, can ch oose t o p resen t a simp lif ied pr int pan el as show n in Figur e 12 - 7. Th is panel p resen t s sev er al of t he set t ing s locat ed in t he v ar ious sect ions in a sin gle int er face w hich man y of t he m or e com plex set t ing s of t he r eg ular pr int pan el. You can get t o all t h e opt ions by click ing t he Ad van ced Opt ion s bu t t on.

Figu r e 1 2 -7 . Th e si m pli fi ed pr i nt pa ne l



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

12.5 Printing from the Command Line Since t he Mac OS X pr int in g in fr ast ru ct ur e is bu ilt on t op of v ar ious Unix t ools, it sh ould be no sur pr ise t hat you can pr int f r om t he com m and line. You can p rin t plaint ex t , PD F, and Post Scr ipt files f rom t he com man d lin e by u sing t h e follow ing comm and : • •

Table of Content s

lpfilename

Review s



Reader Rev iew s



Er r ata

You can p rin t t h e follow ing kin ds of f iles f rom t he com m and lin e t o an y pr int er : • • •

Academic

Plain- t ex Ten t f iles Things I Dig About Pant her Scheduling Tasks in Pant her

PDF Running Ma c O S X P ant he r By Jam es Duncan Davidson

Post Script

Becau Pub se lish er: Mac O'Reilly OS X supp or t s all t hese t echnologies in it s pr int sy st em, you don 't hav e t o w orr y abou t sending Post Pub Dat e: Decem ber Scr 2 00 ip 3 t t o a n on- Post Scrip t pr int er —even if t he p rin t er is an old dot m at r ix pr int erI.SBN: For 0-exam ple, t 59 6- 005 00 -8o pr int out t he cont ent s of a Post Scrip t f ile nam ed r eq uirem ent s.p s, y ou w ould Pages: use t he com m and as show n in Ex am ple 12 - 5. 32 6

Exa m pl e 1 2 -5 . Pr in t i ng a t e xt f il e t o a p r in t er Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS $lp ~/requirements.ps X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e request id is HP_LaserJet_2200-10 (1 file(s)) w ell on you r w ay.

CUPS t ells y ou t hat t he j ob h as been sub m it t ed and p rov ides y ou wit h an ident if ier f or t h e job . The id en t ifier is comp osed of t w o p art s: t he n am e of t he p rin t er t hat t he j ob w ill b e pr int ed on, in t his case HP_Laser Jet _22 00 , an d a seq uence num b er , in t his case t he num ber 1 0 in dicat es t hat t his is t he t ent h j ob p r in t ed f r om t his m achine since CUPS was lau nched. When called by it self , lp p r in t s t o t he d ef ault p r in t er on t he sy st em . To pr int t o anot her pr int er , y ou h ave t o specify it s q ueue t o t he lp com m and. But how d o y ou kn ow t he nam es of t he pr int er s at t ached t o y our com pu t er? Use t h e lpst at com m and ( r ef er back t o Ex am ple 12 - 1 t o see t his in act ion) . Ar m ed w it h t his inf or mat ion , y ou can use t h e lp com m and using t he - d op t ion as sh ow n in Ex am ple 12 - 6 Th e - d op t ion t ells lp w h ich pr int er t o select as it s dest in at ion .

Exa m pl e 1 2 -6 . Pr in t i ng a PDF f il e t o a spe cif i c p r int er

$lp -d Stylus_Photo_900 ~/test.pdf

request id is Stylus_Photo_900-14 (1 file(s))

12.5.1 Working with PostScript •Pant h er has ad Table Content dedof sever alsf eat u r es t o w or k dir ect ly w it h Post Scr ipt files. For ex am ple, y ou can •open Post ScrReview ipt files s ( w hich usually hav e t he . ps ex t ension) u sin g Pr ev iew . Wh en y ou do,

Pr er Rev t t he Scr ip t t o PDF an d t hen d isp lay t he r esu lt . • ev iew w ill conv Reader iewPost s •

Er r ata

Ther e' s also • exam ple, t o •

aAcademic com m and - lin e t ool, pst opd f, w hich w ill con ver t a Post Scr ipt file t o PDF. For conv er t a Post Scrip t f ile n am ed st at s.p s, y ou w ould use t he f ollowin g com m and: Ten Things I Dig About Pant her



Scheduling Tasks in Pant her $pstopdf stats.ps Running Ma c O S X P ant he r By Jamcr This eseat Duncan es a Davidson st at s.p df f ile. To specif y a d iff er ent out pu t f ilenam e, u se t he - o op t ion:

$pstopdf stats.ps -o results.pdf Pub lish er: O'Reilly

e: Decem ber 2 00 3 AnotPub h erDathelp fu l ut ilit y is enscr ipt w h ich conv er t s plain- t ext files t o Post Scr ipt . Th is comm and I SBN: 0- 59 in 6- 005 00nt -8ax : uses t he follow g sy Pages: 32 6

enscript -p outputfile filename w her e t he out p ut f ile ar g um en t is t h e nam e of t h e file t o sav e Post Scr ip t d at a t o and t he filen am e ar gum ent is t he p lain - t ext file t o conv er t . For ex amp le, t o conv ert y our . bash_p r ofile f ile t o Post Script , y ou could use t h e follow ing comm and : Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t -p w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS $enscript profile.ps .bash_profile X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst emcall . You m ay a Mac ru dw hen ar tt ions, t his book , bput 'ver e tr ed eadPost it , Scr youipt 'll b e I f you enscr iptnot w itbe h out t he -gu p an out pyutou f ilestop it will rinonce t t h e you conv w ell on you r w ay. out p ut dir ect ly t o t he d ef ault pr in t er on t he sy st em .

12.5.2 Command-Line Printing to AppleTalk-based Printers For t he most par t , pr int in g t o an AppleTalk pr int er f rom t he com m and lin e is as easy as pr int ing t o any ot h er p r in t er , as long as y ou h ave set up t he p rint er usin g t he Pr int er Set up Ut ilit y so t hat it h as a p r in t q ueue on y our sy st em . I f y ou d on't hav e t h e AppleTalk pr int er set u p on y our syst em , t he fir st t hin g y ou should do is eit h er set it up or f ind a shar ed pr int q ueue f or t hat pr int er on anot her sy st em. Life is mu ch sim pler w hen CUPS t ak es car e of t hin gs. I f you d on't , or can' t , set up t h e AppleTalk pr int er using t h e Prin t er Set u p Ut ilit y , t hen you 'll n eed t o use t he at pr int com m and. Un lik e lp, t h e at pr int com m and doesn't w or k w it h files. I nst ead, it t ak es it s inpu t f rom t he ou t put of ot her com m ands and send s it eit her t o a p rin t er t hat you specif y or t o t he d ef ault AppleTalk pr int er ( w hich is not t he sam e as t h e default pr int er f or t he syst em set in t he Pr int er Set up Ut ilit y) . You also hav e t o b e car efu l t o send t h e r ig ht kind of d at a t o t he p rint er . I n t he case of m ost App leTalk p rint er s, t his means t hat you hav e t o sen d Post Script dat a. Ex am ple 12 - 7 sh ows how t o sen d a Post Scr ipt file t o a p rin t er usin g at pr int .

Exa m pl e 1 2 -7 . Sen din g a Post Scr ip t f i le t o an Apple Tal k pr i nt er

$cat manuscript.ps | atprint Looking for PET:LaserWriter@*. Trying to connect to PET:LaserWriter@*. atprint: printing on PET:LaserWriter@*. •

Table of Content s



Review s



Reader Rev iew s

•I f t he d at a y ou Er r ata w ant t o send isn 't in Post Scr ip t f or mat , you 'll n eed t o con ver t it fir st ( if possible) •using enscr iptAcademic . Ex am ple 12 - 8 sh ows how t o pr int t he cont ent s of a p lain - t ex t file t o an Ap pleTalk •pr int er n amed TenPET. Things I Dig About Pant her •

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Exa e 1 2Davidson -8 . Pr in t i ng a pla in - t e xt f il e t o a n App le Ta lk pr in t e r By Jamm es pl Duncan Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

$cat .bash_profile | enscript -p - | atprint PET I SBN: 0- 59 6- 005 00 -8

Pages: 32 6

Looking for PET. Trying to connect to PET:LaserWriter@*. [ 1 pages * 1 copy ] left in Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust atprint: om ize, printing t w eak , andon g en PET:LaserWriter@*. er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. The at _cho_ pr n com m and is used t o set t h e default pr int er f or use by at pr int . You 'll n eed t o execut e t h is comm and asr oot , as show n in Ex am ple 12 - 9.

Exa m pl e 1 2 -9 . Set t in g t he d ef au lt a t pr i nt pr i nt er

$ sudo at_cho_prn Password: Zone:*???????????^@????????????`?????????` ? 1: ff01.04.9dtPET:LaserWriter

ITEM number (0 to make no selection)?1 Default printer is:PET:LaserWriter@*

status: idle

All in all, w hile t he at pr int com m and is han dy in a p in ch , t he rig ht t hing t o d o is t o set up t he pr int er in t he Print er Set u p Ut ilit y and lever age t h e pow er of CUPS and t h e r est of t he Mac OS X pr int in g sy st em t o y our ad van t age. •

Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

12.6 Further Explorations To lear n mor e ab out CUPS, you can access t he CUPS docum en t at ion on y our Mac by opening Safar i and br ow sing ht t p: / / localhost : 63 1/ docu m ent at ion. h t m l . You m ay w ant t o ex plor e t he follow ing m anpag es for m or e inf orm at ion abou t h ow t o use t he p rin t ing sy st em fr om t he •com man d line. Table of Content s • •

Review s

lp

• •

Er r ata

lpst at

• •

Reader Rev iew s Academic Ten Things I Dig About Pant her

lpopt ions Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

pst opd f

By Jam es Duncan Davidson

enscr ipt Pub lish er: O'Reilly

atDat pr int Pub e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

at _cho_ pr n Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Chapter 13. Networking Net w ork ing has alw ay s been easy on t he Mac. The or iginal Mac shipp ed w it h Apple- Talk, w hich m ade it easy t o connect a gr oup of comp ut er s and pr int er s. Hist or ically , ot h er sy st ems hav e had a h ar der t im e, usin g a v ariet y of st and ard s t hat w ere som et imes p rop riet ar y and t h at d id not •alw ays wor k Table w ell tofogContent et h er .s Th e r ise of t h e I nt er net , how ev er , h as m ean t t h at f or all pr act ical •pu rp oses t h erReview e is nsow one pr im ar y n et w or k st and ard t h at all m achines u se: t he suit e of •pr ot ocols based Reader s er net Pr ot ocol, m ore com m only k now n as I P. I n t he d ev elop m en t of on Rev t h eiew I nt •Mac OS X, ApErple r atahas g one t o gr eat lengt h s t o mak e I P as easy t o use as p ossible, app roachin g •t he ease of use Academic of Ap pleTalk . For t h e m ost par t , t h e syst em w ill t r y t o aut oconf ig ur e it self t o at ev er net orAbout k is av ailab •w or k w it h w hTen Things I w Dig Pant herle, m ak ing it easy t o use in t h is day of cafe- com put in g. e Wif i w Tasks it h you lat her t e?) •( Wou ld y ou lik Scheduling in rPant Running Ma c O S X P ant he r

This chap t er giv es a fu ndam ent al view of how I P w or ks and how t o exam ine t he v ar iou s By Jam es Duncan Davidson net w or kin g set t ing s as w ell as m onit or y our n et wor k f r om bot h t h e com m and line an d t he GUI . Also, you 'll see how dial- up net w or kin g, v irt ual pr iv at e net w or ks ( VPNs) , and fir ewalls can be lished er:. O'Reilly confPub ig ur Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

13.1 The Internet Protocol I P is t h e dom inant net w or k st andar d in use t oday b ecau se it s nam esak e, t he I nt er net , w as successf connect ing t he w or ld' s v ariou s net w or ks t oget her. I P is bu ilt on a set of assum pt ions t hat br eak t he of net w or kin g in t o a set of lay er s, as sh ow n in Figur e 13 - 1. Each lay er act s in dependent ly of t he one allowofing f lex ibilit y in h ow each lay er is imp lem ent ed. •and below it ,Table Content s •

Review s



Reader Rev iew s



Figur e 13 - 1 is act u ally a simp lif ied v iew of t he ab st r act 7- layer n et w or k ing m odel t h Er r ata



y ou' ll find in m any book s on I P n et w or k ing. I n pr act ice, h ow ev er, m ost people u su a Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

simp lif y t hin gs t o t he 4 - layer v iew pr esent ed her e.

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Figu r e 1 3 -1 . A con ce pt u al v ie w of t h e ne t w or k in g st a ck Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

I n addit ion t o t his layer ed ap pr oach , I P b reak s dat a int o separ at e self- cont ained pieces, k now n as p w hich are t ran sm it t ed indiv idually f rom t heir point of or ig in t o t heir d est inat ion. Each packet can , if t ak e a d iff er ent rou t e fr om it s orig in t o it s dest inat ion. This let s infor m at ion flow ev en in t he f ace of net w or k t opolog ies. The con nect ion s bet w een net w or ks can go dow n or chang e, but as long as t h e n can find a n ew r out e, pack et s w ill ev ent ually f ind t heir w ay t hr oug h. By using a lay er ed m odel, and by usin g packet s t h at can flow over v irt ually any k ind of t r ansmissio inf rast r uct ur e, I P can and does r un ov er a v ar iet y of m edium s in clud ing w ir ed Et her net , w ir eless 80

fib er - opt ic lin es, f ireWir e, and m ore. I t ' s been j ok ed t h at I P w ou ld w or k j ust f in e ov er slips of p aper by car r ier p igeon ( you can read t he f ull j oke at w w w .iet f. or g/ r fc/ r fc11 49. t x t ) . I P p rov ides one ot her feat ur e t hat is essen t ial in t oday 's n et w or k ing w orld : it ' s r out ab le. Th is means net w or ks can conn ect t o each ot h er and t hat pack et s can be rou t ed acr oss t hose net w or ks t o r each dest inat ion. This is how t he I nt er net w as built in t h e fir st place, as a collect ion of net w or k s at u niv e gov ern m en t labor at or ies t hat had int er con nect ion s placed bet w een t h em . Abov e I P ar eTable t w o of pr Content ot ocolss t hat t he ap plicat ion s on you r m ach ines use t o access t he n et w or k : • •

Review s



Reader Rev iew s



Er r ata

•Tr ansm issionAcademic Cont rol Pr ot ocol ( TCP) • Ten Things I Dig About Pant her

Know n Scheduling as TCP/ I P, Tasks or TCP in Pant over her I P, t h is pr ot ocol specif ies h ow pack et s of dat a sh ould be t r ansm f ashion. TCP m ak es su re t hat all t he d at a t r ansm it t ed b et ween t w o m ach prDuncan esent ed t o an ap plicat ion in t he ord er in w hich it w as t r ansm it t ed and receiv ed. Th is is ver y By Jam es Davidson im por t ant becau se I P doesn't gu aran t ee t hat pack et s will b e t r ansm it t ed in any p art icular or d usually t h ey ar e sent in t h e or der in wh ich t h ey ar e g en er at ed, but becau se of ch anging n et w o Pub lish er: O'Reilly condit ions, t hey m ay arr iv e in any or der . TCP also perf or ms er r or checking . I f a pack et is cor r Pubdoesn' Dat e: Decem 3 t ar rber ive,2 00 TCP aut om at ically requ est s r et r ansm ission of t he dat a f rom t he sender w it hou I SBN: 0- 59 6005of 00t-8 int er vent ion h e applicat ion. Th is means applicat ion w r it er s don' t h ave t o w or r y about t he w Pages: 6 a is t ran sp or t ed acr oss t he net w or k . To an app licat ion, a n et w or k connect ion can be w hich32dat as a con sist ent st ream of d at a w hen in f act t h at d at a is b eing split in t o sever al par t s and mov t he net w ork in ind iv idu al un it s. •

Running ovMa erc IOPS in X Paant r eliable he r

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust ize, w eak er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Userom Dat agrtam Pr,otand ocolg (en UDP) X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst emUDP . You ay not be a dat Maca gu w hencom y ou ster arst w t his , b utum once you 'v ead e r ead it , you 'll b it e d oe is m u sed t o send betruw een put it h book a m inim of ov erh . Unlike TCP, w ell onguyou r w ay. aran t ee t hat t he or der in w hich packet s ar r ive w ill b e t he sam e as w hen t hey w er e t r ansmit it d oesn' t requ est redeliver y of bad pack et s. Because of t h is, UDP is consid er ed an u nr eliab le bu t d on't let t h e negat iv e connot at ion of t he w ord un reliable f ool y ou. UDP is used ext en siv ely per for m ance needs ar e par am oun t , and t h e dat a er r or s being t r ansm it t ed can be w or ked ar ou even ignor ed. For ex amp le, UDP is used b y m any v ideo conf er encing applicat ions, such as iCh Becau se of it s low ov er head and t he fact t h at if a dat a fr am e r ep resen t ing a m om ent in t im e i r eceived, t her e is no need t o ret r ansm it it as it is n o long er valid. I n con jun ct ion w it h I P, t w o ot h er imp ort ant p r ot ocols w or k at t he low er lay er s of t h e pr ot ocol st ack:

I n t ern et Con t rol M essage Pr ot ocol ( I CMP) I CMP is used b y t he n et w or k , at t he I nt er net lay er, t o send m essages t o it self. For ex am ple, t par t s of a net w or k can inf or m each ot h er t hat er r or s hav e occu rr ed or t hat a p art icular net w o seg m en t is cong est ed wit h t oo m uch t raf fic. I t can also det er min e if a par t icular net w or k add r being used or not . I CMP is also u sed t o t est t he connect ions b et w een n et wor k s.

Add ress Resolut ion Pr ot ocol ( ARP)

At t he ph ysical lay er , an ent ir ely diff er ent set of net w ork addr esses is used. For ex amp le, all E card s hav e a uniqu e Media Access Cont r ol ( MAC) ad dr ess t o ident if y it . ARP is used t o m ap t h add resses u sed by t he I nt er net lay er of t he n et w or k st ack int o t he p hy sical add r esses used by equipm ent on t he local net w or k seg m en t .

13.1.1 Network Addressing and Masks •

Table of Content s

Ev or host • ery device,Review s , t h at u ses t h e I P net w or k in g st ack h as an addr ess so t hat packet s can be sent add ress has t o be uniqu • Reader Rev iewes t o t he net w or k t hat t he com pu t er is par t of. A t r adit ional I nt er net net w ork (• also k now n Er asr ata an I Pv4 add ress) is a sequ en ce of 32 bit s ( 4 by t es) , usually w r it t en as a ser ies of fou sep arat ed v alues in t he f orm # . # . # . # , w here each # is a decim al int eg er bet w een 0 an d 255 r ep r e • Academic one of t he f our by t es of t he addr ess. For ex am ple, 66. 93 . 174. 2 9 is a v alid I P ad dr ess. •

Ten Things I Dig About Pant her

•An I Pv4 add ress Scheduling Pant her is alsoTasks cominposed of t w o par t s, albeit ind ir ect ly . Th e fir st p art ident if ies t h e local ne Running Ma second c O S X P ant w hile t he parhet rid en t ifies t he h ost in t hat net w or k. Conf usin gly , t he bound ar y bet w een t hese in By Jam an es I Pv Duncan 4 addrDavidson ess var ies dependin g on t h e net w or k. A net w or k m ask is used t o delin eat e bet w een net w or k and host par t s of t he addr ess. Net w or k m ask s can come in m any f or m s, but t y pically y ou' ll follow t hrO'Reilly ee net w or k m ask s in use ( list ed b ot h in dot t ed n ot at ion an d in t h e hexid ecim al for m t h Pubing lish er: see Pub in som e of t he com m and- line ut ilit ies) : Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

25 5. 255 . 255. 0 or 0 xf ff ff f0 0 Know n as a Class C m ask , t his in dicat es t hat t he f ir st t hr ee by t es of t he add ress ar e t he net w add ress. Ther e can b e 254 host s on a Class C net w ork . Th is is t he m ost com m on mask y ou' ll Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o day - t o- d ay use. cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay. 25 5. 255 . 0. 0 or 0x ff ff 000 0 Know n as a Class B m ask, t his ind icat es t h at t h e fir st t w o by t es of t he ad dr ess ar e t h e net w or add ress. Ther e can b e up t o 6 5, 00 0 h ost s on a Class B n et wor k .

25 5. 0. 0. 0 or 0x f f00 000 0 Know n as a Class A m ask, t his ind icat es t h at t h e fir st by t e of t he add ress is t he net w ork addr e t he rem aining by t es ident if y t he h ost on t he n et w or k . Ther e can be up t o 16. 7 m illion host s on A n et wor k . Net w ork addr esses for host s connect ed d irect ly t o t he I nt er net m ust alway s com e fr om an of ficial so y our I nt er net Ser v ice Pr ov ider ( I SP) . Your I SP ow ns t h e rig ht s t o use a block of addr esses on t he I n and assig ns y our com pu t er an I P addr ess, or block of I P add resses, as p art of y our conn ect ion t o t h I nt er net .

13.1.1.1 IPv6 Addresses The I Pv 4 addr essing scheme was cr eat ed at a t im e w h en t h er e w ere relat iv ely f ew com p ut ers ru nni pr ot ocol. The origin al desig ner s didn 't imag in e t hat t he I n t er n et w ould ex pan d t o t h e point it is t od a

y ou can easily access it fr om m ost of t h e count r ies on t he p lan et . Becau se of t h is exp ansion , as w el ant icipat ion t hat in t he n ear f ut u re t here w ill be an ex plosion of devices su ch as mob ile p hones an d ent er t ainm en t cent er s t hat w ill access t he I nt er net , a new add r essing schem e k now n as I Pv6 is st ar deploy ed. I Pv6 ad dr esses are 128 bit s lon g an d are u sually w rit t en as a ser ies of 8 colon- separ at ed , 16 - bit va w r it t en in hex adecim al f orm . An ex amp le of an I Pv 6 addr ess is: •

fe80:0000:0000:0000:0203:93ff:feef:baa5 Table of Content s



Review s



Reader Rev iew s

Unlike I Pv 4 addr esses, I Pv6 add r esses don' t r equir e a separ at e n et w or k m ask. • Er r ata •

Academic

I Pv6 isn' t in w ide use y et , at least in m ost of t h e net w or ks t hat y ou ar e likely t o find y our self using. • Ten Things I Dig About Pant her t o t he lim it ed nu m ber of I Pv4 add resses, m any n et wor k s, esp ecially in Asia w h er e t h e I Pv4 add ress • Scheduling Tasks in Pant her allocat ion s hav e alr ead y r un out , ar e st ar t ing t o mov e t o I Pv6 . I n ad dit ion, m an y of t he p rim ar y I nt Running Ma c O S X P ant he r back bone ser vice pr ov iders are mov ing t heir n et w or k s t o I Pv 6 in p repar at ion for a f ull deploy m en t . By Jam es Duncan Davidson

Mac OS X nat ively sup por t s I Pv6 add r esses and, ev en t h ough y ou mig ht not b e using an I Pv6 net w o few Pub mor lisheer:y ears, O'Reillyy ou' ll see t hese addr esses as y ou w ork w it h t h e var ious net w ork t ools. Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8

13.1.2 Examining Network Settings Pages: 32 6 Ther e ar e sev eral w ays t o see wh at I P addr ess ( or add resses if y ou hav e m ult iple int er faces act ive) using . The f irst , b ut not t he m ost conv enient , p lace m ost p eop le w ill go t o f in d t his inf orm at ion is t h Net w ork pr ef er ence pan el ( Syst em Pr efer en ces Net w ork ) , show n in Figur e 13 - 2 Th is giv es a heads of he varMac iousOS n etXwPant or k set and heator in w net w ork ions ill be pt ed. Ru tnning hert ings is t he ult tim e der Sw iss Arhich my Knife( TM)conn ; forect pow er w user s wat h toem w ant to cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS A b et t er place t o look is t h e Net wor k Ut ilit y ( / App licat ions/ Ut ilit ies) applicat ion, as show n in Figur e 1 X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir Net w ork Ut ilit y display s t he in for m at ion about t he n et w or k int er face t h at is cur r ent ly being used t o syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e t he net w ork , also k now n as t h e defau lt in t erf ace. You can select fr om t h e v ariou s net w or k int erf aces w ell on you r w ay. t he popu p m enu.

Figu r e 1 3 -2 . N et w or k Pr e f er e nce Pa ne st a t u s displ ay



Table of Content s



Review s



Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her



Scheduling Tasks in Pant her

Running Ma c O S X P ant he r By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3 I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Figu r e 1 3 -3 . N et w or k U t il it y sh ow i ng in f or m a t i on on a n act i ve i nt e r f a

The in for m at ion y ou' ll see in t h is display consist s of t he f ollow ing :

Har dw ar e Addr ess •

Table of Content s

Display s t he p hy sical MAC ad dr ess of t h e int er face. This is t h e addr ess used at t he p hy sical la Review s m ove dat a t o and f r om t he n et wor k .

• •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

I• P Add ress

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

Display s t he I P addr ess of t he int er face.

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

Link Sp eed and Link St at u s I SBN: 0- 59 6- 005 00 -8

Pages: 6 Pr ovid32es

t he speed of t h e connect ion as well as w h et h er it is act iv e or not .

Vendor and Model Ver sion Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS Pr ovid es t he m ak er of t he ph ysical int er face as w ell any v er sion inf orm at ion in t he f ir m w ar e o X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir int er face. syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e w ell on you r w ay.

Tr ansfer St at ist ics Pr ovid es som e inf or mat ion on how t he int er face is p er f orm ing . Ty pically as y ou use t h e net w o see t he sent an d receiv ed p ack et s coun t er s incr easing . You shouldn 't see an y err or s or collisio som et h in g is w ron g w it h y our n et w or k . On t he menu , y ou' ll not ice desig nat or s lik e ( en 0) , ( en 1) , or ( fw 0) . The oper at ing syst em uses t hese ident if ier s t o t r ack t he v ariou s int er faces. Th e ident if ier s y ou m igh t see ar e:

lo0 This is t he loopback in t er f ace, w hich allow s net w ork - aw ar e pr ogr am s t o com m un icat e w it h ot pr ogr am s on t he sy st em w it hout sen ding pack et s ont o t he net w or k . This int er face alw ay s has ( inet ) addr ess of 127 .0 .0 . 1 an d t he I Pv 6 ( in et 6 ) ad dr ess of : : 1 .

en0

The p r im ar y Et hern et int er face of y our m achine. This will alw ay s be t he bu ilt - in Et hern et cont y our Mac.

en1 An Et h er net in t erf ace. Ty pically en1 w ill be t he Air por t card in you r com put er ( if y ou hav e one Table of Content s second Et hern et car d. I n addit ion t o t he I Pv 6 ( in et 6 ) an d I Pv 4 ( inet ) ad dr esses, t he MAC add Review s giv en u sin g t h e et her p ar amet er .

• • •

Reader Rev iew s



Er r ata



Academic



Ten Things I Dig About Pant her

fw • 0

Scheduling Tasks in Pant her

Running Ma c O S X P ant he r

The f ir eWir e int er face f or y our m achine. This in t er f ace is disab led un t il y ou man ually t ur n on as a net w ork ing opt ion in t he Net w or k pr efer en ce p anel.

By Jam es Duncan Davidson

Pub lish er: O'Reilly Pub Dat e: Decem ber 2 00 3

gif0

I SBN: 0- 59 6- 005 00 -8 Pages: 32 6

This is t he gener ic int er face t un nel w hich is used t o t unn el net w or k packet s f r om one m achine anot h er , m ost oft en t o conn ect t w o I Pv 6 n et w or k s ov er a link t h at u ses t h e I Pv4 pr ot ocol or t o t w o I Pv 4 net w ork s ov er a link t hat uses t he I Pv 6 p rot ocol. By default , t his int er face is n ot act i m an gif f or m or e inf orm at ion. Ru nning Mac OS X Pant her is t he ult im at e Sw iss Ar my Knife( TM) ; for pow er user s w h o w ant t o cust om ize, t w eak , and g en er ally r ev u p t heir Mac. This b ook t ak es reader s deep in side Mac OS X's cor e, r evealing t he inn er w ork ing s of Pant her f or t h ose w h o w ant t o g et t h e most out of t heir syst em . You m ay not be a Mac gu ru w hen y ou st ar t t his book , b ut once you 'v e r ead it , you 'll b e st f0 w ell on you r w ay. The 6 t o4 t unn el int er face is used t o let I Pv 6 h ost s on one net w or k comm u nicat e t r anspar en t ly I Pv6 h ost s on an ot her net w or k ov er an I Pv 4 lin k. By defau lt , t his int er face is n ot enab led and used wh en a mach in e is used as a r out er b et w een an I Pv 6 an d I Pv 4 net w or k. See m an st f f or inf orm at ion. To g et m or e det ailed inf orm at ion abou t t h e cur rent st at e of all t h e net w or k adapt er s conn ect ed t o y use t h e ifconf ig com m and line t ool, as sh own in Ex am ple 13 - 1.

Exa m pl e 1 3 -1 . Usin g i f conf ig t o look a t t he st a t u s of t h e ne t w or k con ne ct

$ifconfig lo0: flags=8049 mtu 16384 inet6 ::1 prefixlen 128 inet6 fe80::1 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000

gif0: flags=8010 mtu 1280 stf0: flags=0 mtu 1280 en1: flags=8863 mtu 1500 inet6 fe80::203:93ff:feef:baa5 prefixlen 64 scopeid 0x4 • • • • •

Table of Content snetmask 0xffffff00 broadcast 10.0.1.255 inet 10.0.1.2 Review s

ether 00:03:93:ef:ba:a5 Reader Rev iew s Er r ata

media: autoselect status: active Academic



Ten Things I Dig About Pant her



supported autoselect Scheduling media: Tasks in Pant her

Running Ma c O S X P ant he r

en0: flags=8863 mtu 1500 By Jam es Duncan Davidson

ether 00:0a:95:99:e4:92 Pub lish er: O'Reilly Pub Dat e: media: Decem ber autoselect 2 00 3

(none) status: inactive

I SBN: 0- 59 6- 005 00 -8

supported Pages: 32 6

media: none autoselect 10baseT/UTP 10baseT/UTP