HACKER Q&A
📣 yaris

Books about OS X internals


It happened so that I've got a Macbook as my work laptop and I'm feeling helpless with it. In Linux world I'm considering myself as advanced/expert user, but OSX feels so different. I know that OSX comes from (Free?)BSD family but since I'm 0-level in BSD also this knowledge does not help much. Are there any good books that explain how OSX works internally and what advanced tools there are to work with it? Examples of what I already miss are: strace, ip * (ip netns, ip route), binutils, firewall management


  👤 ksherlock Accepted Answer ✓
Another book is "Mac OS X Internals: A Systems Approach", although that was published in 2006 and does not include any networking (and the web site disappeared a couple years ago).

"Given the book's length, I chose to exclude several topics that are well covered in other texts. The TCP/IP stack is an example -- there is no "networking" chapter in the book since the Mac OS X TCP/IP stack is largely a derivative of the FreeBSD stack, which is already well documented. In general, information that is generic across Unix variants and can be found in standard texts is not included in this book."

The author, Amit Singh, was the original author os the MacFuse project.


👤 Wowfunhappy
I mean, it might be more than you're looking for, but if you really want the nitty gritty, I think this is basically the seminal work?

http://newosxbook.com/index.php


👤 Someone
What kind of work do you do? If it doesn’t involve writing Mac OS software, chances are you don’t need to know about that lower-level stuff. Even if it does, most programs nowadays use higher-level libraries than those working directly with the OS proper, so you might not need to know details there.

If you’re supposed to use the Mac as a tool, I would just start using it as a tool, and Google specific problems/issues if and when I ran into them. You seem to know the basics from your Linux experience, so chances are you’ll be fine that way.

I would think “advanced/expert Linux users” wouldn’t know about strace, the IP stack, etc. either.


👤 jen20
The canonical book has already been recommended in a sibling comment, but to talk to some of your other points:

- `dtruss` can be used in place of `strace` - you may need to modify the SIP settings to allow Dtrace usage though.

- macOS uses llvm which does not require GNU binutils

- The traditional `ifconfig`, `route` etc are available, and scutil for DNS.

- The firewall is pf, which originally comes from OpenBSD. There are other interfaces, but `pfctl` works (and has a man page).


👤 GekkePrutser
MacOS has a lot of BSDisms under the hood. For example it still comes with OpenBSD's pf firewall. You can access it with the pfctl command and it's documented in the man pages.

Note that this is not the application firewall that can be activated in system preferences. It's entirely separate and only accessible from the console or third party software like icefloor.


👤 bluedino
Advanced Mac OS X Programming from Big Nerd Ranch is old but a decent read. You can pick a copy up used for ~ $5.

Reminds me of the Linux programming books from Wrox press back in the old days.