<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Red Sweater Blog &#187; Darwin</title>
	<atom:link href="http://www.red-sweater.com/blog/category/articles/darwin/feed" rel="self" type="application/rss+xml" />
	<link>http://www.red-sweater.com/blog</link>
	<description>Mac &#38; Technology Writings by Daniel Jalkut</description>
	<lastBuildDate>Tue, 17 Jan 2012 22:03:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>The Power Of Plist</title>
		<link>http://www.red-sweater.com/blog/2083/the-power-of-plist</link>
		<comments>http://www.red-sweater.com/blog/2083/the-power-of-plist#comments</comments>
		<pubDate>Wed, 03 Aug 2011 19:12:50 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Xcode]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=2083</guid>
		<description><![CDATA[Most Mac and iOS developers know that when you build an application, you advertise a number of details about the application in the &#8220;Info.plist&#8221; file, located inside the application bundle. You can examine any application on your Mac and see what kind of information the developer has conveyed about it: Navigate to a .app file [...]]]></description>
			<content:encoded><![CDATA[<p>Most Mac and iOS developers know that when you build an application, you advertise a number of details about the application in the &#8220;Info.plist&#8221; file, located inside the application bundle. You can examine any application on your Mac and see what kind of information the developer has conveyed about it:</p>
<ol>
<li>Navigate to a .app file in the Finder, e.g. /Applications/Mail.app</li>
<li>Control-click the app icon and select &#8220;Show Package Contents&#8221;</li>
<li>Navigate to Contents/Info.plist</li>
<li>Open with a plist editor or your favorite text editor.</li>
</ol>
<p>These files advertise a number of interesting attributes including the application&#8217;s official version and copyright strings. They also include important clues to the system about what kinds of files the application knows how to read and write, and what its minimum system requirements are.</p>
<h3>Minimum System Requirements</h3>
<p>Declaring the right Info.plist values not only allows a developer to control which operating systems a product should run on, but which of the application&#8217;s architectures should be considered for a particular operating system. For example, <a href="http://www.red-sweater.com/blackink/">Black Ink</a> uses a number of keyed values describing its requirements:</p>
<pre>	&lt;key&gt;LSArchitecturePriority&lt;/key&gt;
	&lt;array&gt;
		&lt;string&gt;x86_64&lt;/string&gt;
		&lt;string&gt;i386&lt;/string&gt;
		&lt;string&gt;ppc&lt;/string&gt;
	&lt;/array&gt;
	&lt;key&gt;LSMinimumSystemVersion&lt;/key&gt;
	&lt;string&gt;10.4.0&lt;/string&gt;
	&lt;key&gt;LSMinimumSystemVersionByArchitecture&lt;/key&gt;
	&lt;dict&gt;
		&lt;key&gt;i386&lt;/key&gt;
		&lt;string&gt;10.4.0&lt;/string&gt;
		&lt;key&gt;x86_64&lt;/key&gt;
		&lt;string&gt;10.6.0&lt;/string&gt;
		&lt;key&gt;ppc&lt;/key&gt;
		&lt;string&gt;10.4.0&lt;/string&gt;
	&lt;/dict&gt;
</pre>
<p>Notice the fidelity of some of these options. Black Ink is an application that is compiled with binary code for three separate architectures embedded into it: 64-bit Intel, 32-bit Intel, and 32-bit PowerPC. In order to give the user the best possible experience after they double-click the application icon, the system consults the Info.plist values to determine which binary is most appropriate to load on the current system.</p>
<p>The options for Black Ink start by indicating that all things being equal, it prefers to run as 64-bit Intel, but will settle for 32-bit Intel or PowerPC in a pinch. Next, it conveys that it should not be run on any operating system earlier than Mac OS X 10.4. Finally, it adds an additional restriction by architecture, stating that in the case of 64-bit Intel, the system should consider Mac OS X 10.6 the minimum required OS.</p>
<p>Why so picky? For example, Mac OS X 10.5 will run on computers that are new enough to support 64-bit Intel code, but the 10.5 operating environment itself doesn&#8217;t contain enough compatible libraries to make it very useful to a full-featured Cocoa application. So we need to convince the 10.5 system <em>to ignore our 64-bit Intel code.</em> And this is how it&#8217;s done.</p>
<h3>Embedding Info.plist</h3>
<p>This is all well and good for applications, but what about other code that may be run on a variety of hardware and operating systems? In particular, command-line tools do not come in the same bundled-folder format that applications do. Fortunately, Apple thought of this when they implemented support in their developer tools for embedding the contents of an Info.plist directly into the binary itself. You just have to pass the Info.plist path to Apple&#8217;s linker tool when it&#8217;s constructing your binary file. (Thanks to <a href="http://www.noodlesoft.com/">Paul Kim</a> for reminding me of this functionality). What this means in practice is adding arguments like this to your Xcode target&#8217;s &#8220;Other Linker Flags&#8221; build setting:</p>
<pre>-sectcreate __TEXT __info_plist $(INFOPLIST_FILE)
</pre>
<p>This instructs the linker to crete a new text segment named &#8220;__info_plist&#8221; in the resulting binary, and to fill it with the contents of the referenced Info.plist file. To make sure the INFOPLIST_FILE expands correctly, just make sure you set it in the separate build setting for identifying the Info.plist (the one you&#8217;d normally use in an app, and that is just ignored by default for a command-line tool target).</p>
<p>I brushed up on all this information because I wanted to help ensure that some recent work I did to create a <a href="https://github.com/danielpunkass/peg-multimarkdown">standalone MultiMarkdown tool</a> would be backward compatible with older systems. This required <a href="https://github.com/danielpunkass/peg-multimarkdown/commit/ca523bac1fb03b9cfdcf540805e677086c063704">adding an embedded plist</a> much as I&#8217;m describing here.</p>
<p>(<strong>Note:</strong> I have gotten some feedback to the effect that the __info_plist segment&#8217;s minimum system version requirements may not actually be consulted properly on Mac OS X 10.5. This would be a bummer, and in fact sort of reject the whole point of embedding the Info.plist in this case. I&#8217;m going to see if I can confirm whether it doesn&#8217;t in fact work.)</p>
<p>You could technically embed all kinds of stuff in the binary, with different section names. But the contract in this case is that when Mac OS X is determining information about an executable, it will consult <strong>the bundle&#8217;s Info.plist file</strong>, if it happens to be an executable in a bundle, or <em>the binary&#8217;s __info_plist segment</em>, if it happens to have one.</p>
<p>Another common reason for needing to embed Info.plist information into a standalone binary is if you are using Apple&#8217;s code signing mechanism to sign an individual binary tool. Code signing uses information from the Info.plist of a product, and in the case of standalone binaries, the only product-cohesive place to put this is in the binary itself.</p>
<h3>Examining Binary Info.plists</h3>
<p>After you&#8217;ve performed the magic above, you&#8217;ll probably be keen to inspect your command-line tool&#8217;s Info.plist to see if it worked. To do this, you can use the otool command from the Finder. If you run otool with the &#8220;-l&#8221; option to show all load commands, it will include the load command that identifies the __info_plist segment. Use grep to narrow it down to the part you&#8217;re interested in:</p>
<pre>otool -l ./yourTool | grep info_plist -B1 -A10
</pre>
<p>Any results at will confirm that there is Info.plist information in the binary, but how does it look? The &#8220;-s&#8221; option to otool lets you examine the contents of a specific segment in a binary, but it dumps it out as hex code. Fortunately, another system-bundled tool called &#8220;xxd&#8221; is capable of easily converting between hex-dump and text formats. As it turns out, some of Apple&#8217;s bundled developer tools (at least on my Mac) contain these embedded __info_plist sections, so if you don&#8217;t have a command line tool of your own to try this on, you can peek at what the &#8220;atos&#8221; tool has to say for itself:</p>
<pre>otool -s __TEXT __info_plist /usr/bin/atos | xxd -r
</pre>
<h3>In Summary</h3>
<p>Info.plist values are important for conveying information about your product, from the crudest, most obvious stuff like version number, to the most nuanced details such as which architectures are supported. Knowing how to specify an application or tool&#8217;s requirements as precisely as possible will ensure that the product performs optimally on whatever supported system your user happens to be using. I&#8217;ve barely scratched the surface here with a few common deployment keys that control execution behavior on Mac OS X. Be sure to skim Apple&#8217;s <a href="http://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html">Information Property List Key Reference</a> to see if there are other useful bits of information you can share for your application <em>or for your command-line tool.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/2083/the-power-of-plist/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sudo Or Die</title>
		<link>http://www.red-sweater.com/blog/1104/sudo-or-die</link>
		<comments>http://www.red-sweater.com/blog/1104/sudo-or-die#comments</comments>
		<pubDate>Thu, 14 Jan 2010 14:19:23 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Links]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/?p=1104</guid>
		<description><![CDATA[Dave Dribin offers a couple really handy tips for modifying the behavior of the &#8220;sudo&#8221; command-line tool, which allows ordinary admin users to acquire superuser powers for editing files, changing permissions, etc. Handy Sudo Settings &#8211; Dave Dribin&#8217;s Blog I knew about the ability to change the sudo timeout, but have never gotten around to [...]]]></description>
			<content:encoded><![CDATA[<p>Dave Dribin offers a couple really handy tips for modifying the behavior of the &#8220;sudo&#8221; command-line tool, which allows ordinary admin users to acquire superuser powers for editing files, changing permissions, etc.</p>
<p><a href="http://www.dribin.org/dave/blog/archives/2010/01/13/handy_sudo_settings/">Handy Sudo Settings</a> &#8211; Dave Dribin&#8217;s Blog</p>
<p>I knew about the ability to change the sudo timeout, but have never gotten around to looking into exactly how it&#8217;s done. Now, I&#8217;ll be annoyed a lot less often when I&#8217;m in an &#8220;administrative&#8221; frame of work.</p>
<p>Dave&#8217;s post inspired me to finally do a little more research into sudo and the configuration options. For starters, now that I&#8217;ve upped my timeout value to something longer than the default 5 minutes, I might want to occasionally &#8220;logout&#8221; of my sudo authenticated session. The &#8220;kill&#8221; option does just this, putting you back in a &#8220;password required&#8221; state:</p>
<pre>
% sudo -k
</pre>
<p>As for the options Dave described, they and many others like them are described in the &#8220;sudoers&#8221; man page:</p>
<pre>
% man 5 sudoers
</pre>
<p>Hmm. What&#8217;s this option called <strong>insults</strong>? I turned it on, but Apple appears to have &#8220;cleaned up&#8221; this option in Mac OS X. It doesn&#8217;t do anything. On the Linux installation that runs <a href="http://www.red-sweater.com/">red-sweater.com</a>, I turned on the option to see what would happen:</p>
<pre>
yarn% sudo ls
daniel's password:
... and it used to be so popular...
daniel's password:
You do that again and see what happens...
daniel's password:
It's only your word against mine.
sudo: 3 incorrect password attempts
</pre>
<p>One of the things I love about UNIX heritage is the sense of humor that pervades most of the software. The Mac used to have much more of this itself. I guess we traded it in for a greater sense of professionalism and solidity, but I still miss the corny humor sometimes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/1104/sudo-or-die/feed</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Taming Launchd</title>
		<link>http://www.red-sweater.com/blog/245/taming-launchd</link>
		<comments>http://www.red-sweater.com/blog/245/taming-launchd#comments</comments>
		<pubDate>Sat, 30 Dec 2006 19:58:18 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Software Reviews]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/245/taming-launchd</guid>
		<description><![CDATA[Developers, and some power users who are reading this have probably heard of launchd. It&#8217;s Apple&#8217;s &#8220;mama process,&#8221; responsible for launching other processes at startup, login, at regular intervals, or on demand. If you open the Activity Monitor application, and view &#8220;All Processes, Hierarchically,&#8221; you&#8217;ll see that there are only two top-level processes: kernel_task, and [...]]]></description>
			<content:encoded><![CDATA[<p>Developers, and some power users who are reading this have probably heard of <a href="http://developer.apple.com/macosx/launchd.html">launchd</a>. It&#8217;s Apple&#8217;s &#8220;mama process,&#8221; responsible for launching other processes at startup, login, at regular intervals, or on demand. If you open the Activity Monitor application, and view &#8220;All Processes, Hierarchically,&#8221; you&#8217;ll see that there are only two top-level processes: kernel_task, and launchd. The kernel sits there and does its thing, while launchd spawns all the other processes that make up your Macintosh computing experience.</p>
<p>
One big benefit of launchd to end-users is that <em>most</em> of what gets launched can be easily examined by perusing the configuration files. Launchd looks in five well-defined locations for launchable items:
</p>
<p>
/System/Library/LaunchDaemons<br />
/System/Library/LaunchAgents<br />
/Library/LaunchDaemons<br />
/Library/LaunchAgents<br />
~/Library/LaunchAgents
</p>
<p>
So all you have to do to get a feel for (most of) what launchd is up to is start poking around in those directories. For each independent &#8220;launch&#8221; that launchd controls, you&#8217;ll find a corresponding configuration property list file. For instance, you&#8217;re guaranteed to find a bunch of examples in /System/Library/LaunchDaemons, and depending on which third-party packages you&#8217;ve installed, you might find things in other places, as well.
</p>
<p><h3>Launchd In Context: FTP</h3>
<p>Take a quick look at <a href="file://localhost/System/Library/LaunchDaemons/ftp.plist">ftp.plist</a>, one of the system launch daemons. Depending on how you&#8217;ve configured your system, you&#8217;ll either see that a &#8220;Disabled&#8221; key is present and set to &#8220;true,&#8221; or it is absent. This corresponds directly to the &#8220;FTP Access&#8221; item in the System Preference&#8217;s &#8220;Sharing&#8221; panel. Go ahead and toggle the setting in your preferences, and observe that the ftp.plist file is immediately updated to reflect the new setting. This tells launchd that it should no longer consider launching the ftp daemon when an incoming ftp connection is attempted.
</p>
<p>
What constitutes an incoming ftp connection? Look further down the ftp.plist and you&#8217;ll find an entry with key name &#8220;SockServiceName&#8221; and a value of &#8220;ftp&#8221;. Launchd uses this name to lookup the socket port/protocol information for the named service from /etc/services. In this case, when an incoming connection is attempted on port 21, launchd will, if this item is not disabled, launch the daemon at /usr/libexec/ftpd, in order to handle the incoming connection. Groovy, huh? <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/Articles/LaunchOnDemandDaemons.html">Read more</a> about network handlers and other on-demand daemons.
</p>
<p><h3>Boot-Time King</h3>
</p>
<p>
I said above that these configuration files reveal &#8220;most of&#8221; what launchd is up to with regard to running things on your system. Because launchd can&#8217;t handle all types of configurations, and because its introduction has been sort of gently staged, it&#8217;s responsible for running a lot of the older mechanisms like /etc/rc, StartupItems, etc. This means that launchd is basically responsible for everything from when the kernel gets loaded on. That includes booting your Mac!
</p>
<p>
Things have been in such flux over the past few years that it&#8217;s hard to keep a straight answer when it comes to exactly what takes place at boot time. Excellent overviews such as <a href="http://www.kernelthread.com/mac/osx/arch_startup.html">Mac OS X System Startup</a> by Amit Singh, or <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPSystemStartup/index.html">The Boot Process</a> by Apple, are liable to become outdated as launchd continues to evolve.
</p>
<p>
Fortunately, the entire process is transparently observable, because launchd is <a href="http://launchd.macosforge.org/">open source</a>. If you&#8217;re ever in doubt about any nuance of the startup process, just look at the <a href="https://svn.macosforge.org/projects/launchd/browser/trunk">source code</a>. The repository even contains the boot-time configuration file &#8220;/etc/rc&#8221;, and the source for antiques like SystemStarter. You can even check out how the boot process is going to look in <a href="https://svn.macosforge.org/projects/launchd/browser/branches/Leopard">Leopard</a>. (Note: free registration on macosforge.com required). I couldn&#8217;t figure out how to check out those repository URLs from the command-line, but I discovered an <a href="http://svn.macosforge.org/repository/launchd/trunk/">alternate URL</a> that works, and doesn&#8217;t seem to require registration.
</p>
<p><h3>Editing Launchd Configuration Files</h3>
</p>
<p>
It won&#8217;t take you long to discover that the launchd configuration files, while elegant and modular, are a bit of a pain to read, let alone edit. Fortunately, a couple of third-party solutions exist to ease this task.
</p>
<p>
<a href="https://sourceforge.net/projects/lingon/">Lingon</a>, by Peter Borg, is a very powerful editor which also serves as a sort of browser for all the existing configuration files on your Mac. You can selectively start or stop any existing configuration, and it takes care of asking you to authenticate for editing those system-owned files (after warning you profusely not to do so!). It even sports a &#8220;wizard&#8221; interface that asks in relatively plain English what it is you&#8217;re trying to accomplish, and guides you through the creation of <em>new</em>, custom launchd configurations.
</p>
<p>
While Lingon is essentially easy to use, it has some rough edges which scream for refinement. I&#8217;d really like to see the application receive a UI overhaul. Lots of little awkward UI elements and poorly phrased dialog make it slightly less than a 100% success. But it sure beats editing in vi, or even Property List Editor.
</p>
<p>
One of Lingon&#8217;s nicest features is its &#8220;Expert&#8221; pane, which allows you to examine and edit the raw XML of a configuration at any time. This is so useful that I&#8217;d like to see if featured as a full-time view, perhaps in a hideable split view pane. It would be fun to be able to watch the changes live in the XML source while tweaking details in the UI. But Lingon is, in the spirit of launchd itself, open source. So any shortcomings that ultimately get me down can be remedied to my own (or your own) liking.
</p>
<p>
Apparently I wasn&#8217;t the only person to object slightly to the UI of Lingon. <a href="http://www.codepoetry.net/products/launchdeditor">Launchd Editor</a> is a $5, closed-source alternative that bites off a much smaller feature set, while trying to improve on the UI of Lingon. It&#8217;s clear by observing some of the configuration panes that Launchd Editor was inspired by Lingon (or vice-versa, I&#8217;m not positive which came first, but I&#8217;d guess Lingon did). Some of the control layout is almost identical to Lingon, but touched up a bit in alignment and wording, mostly for the better.
</p>
<p>
Launchd Editor is limited by its adoption of a document-centric model, such that the user has to specifically locate and open a configuration file. It also lacks the start/stop/load features of Lingon. Overall I&#8217;d say it&#8217;s worth using Lingon in spite of its rough UI, but minimalists might prefer Launchd Editor.</p>
<h3>Launchd For Developers</h3>
<p>So far I&#8217;ve talked about how the system uses launchd for its services, and sort of alluded to the fact that you might come up with your own configurations to suit your personal needs. But developers should also take heed of launchd as a mechanism for automating tasks on behalf of users. One example of this is Noodlesoft&#8217;s <a href="http://www.noodlesoft.com/hazel.html">Hazel</a>, which uses launchd configuration rules to periodically check the status of &#8220;watched folders&#8221; and perform housekeeping tasks on them. By saving configurations to the user&#8217;s LaunchAgents folder, and then loading them with the <a href="file://localhost/bin/launchctl">launchctl</a> command-line tool, it pushes off timing responsibility to launchd. Nifty!</p>
<h3>Summary</h3>
<p>Launchd is a super addition to Mac OS X, and a stellar example of Apple&#8217;s commitment to improving Unix for both end-user and architectural benefit. Hopefully if you hadn&#8217;t gotten a chance to take a close look at it before, you&#8217;ll be encouraged to do so after reading this article.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/245/taming-launchd/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Good To The Last Kernel</title>
		<link>http://www.red-sweater.com/blog/236/good-to-the-last-kernel</link>
		<comments>http://www.red-sweater.com/blog/236/good-to-the-last-kernel#comments</comments>
		<pubDate>Sat, 16 Dec 2006 05:38:39 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/236/good-to-the-last-kernel</guid>
		<description><![CDATA[Greg Miller describes in excruciating detail (or glorious detail, depending on your perspective) the steps required to compile, load, and unload a simple OS X Kernel Extension. It&#8217;s this kind of detailed analysis combined with a casual writing style that makes for great technical blog entries. File this one under &#8220;understanding what the eff is [...]]]></description>
			<content:encoded><![CDATA[<p>Greg Miller describes in <a href="http://unixjunkie.blogspot.com/2006/12/kernel-extension-by-hand.html">excruciating detail</a> (or glorious detail, depending on your perspective) the steps required to compile, load, and unload a simple OS X Kernel Extension. </p>
<p>
It&#8217;s this kind of detailed analysis combined with a casual writing style that makes for great technical blog entries. File this one under &#8220;understanding what the eff is going on with my custom kernel extension.&#8221; You&#8217;d have no idea where to look if you just took Xcode&#8217;s template as a black box.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/236/good-to-the-last-kernel/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WWDC For All</title>
		<link>http://www.red-sweater.com/blog/166/wwdc-for-all</link>
		<comments>http://www.red-sweater.com/blog/166/wwdc-for-all#comments</comments>
		<pubDate>Thu, 27 Jul 2006 17:55:47 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Business]]></category>
		<category><![CDATA[Carbon]]></category>
		<category><![CDATA[Cocoa]]></category>
		<category><![CDATA[Darwin]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/166/wwdc-for-all</guid>
		<description><![CDATA[John Siracusa recently wrote about Apple&#8217;s almost universally condemned strategy of distributing recorded conference materials after the show is over. He asks &#8220;Why does Apple jealously guard the content presented at WWDC?&#8221; It&#8217;s a good question, and it probably has to do with compelling future attendance at conferences. After all, Apple is probably thinking, if [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css"><!-- .caption { border-style:dashed; border-width:1px; border-color:#BBBBBB; margin-left:20px; padding:10px;}--></style>
<p>
John Siracusa <a href="http://arstechnica.com/staff/fatbits.ars/2006/7/21/4727">recently wrote</a> about Apple&#8217;s almost universally condemned strategy of distributing recorded conference materials after the show is over. He asks &#8220;Why does Apple jealously guard the content presented at WWDC?&#8221;
</p>
<p>
It&#8217;s a good question, and it probably has to do with compelling future attendance at conferences. After all, Apple is probably thinking, if you can get the milk for free, why &#8230; uhm, go to the cow? By &#8220;jealously guarding&#8221; the content that makes up the &#8220;intellectual reward&#8221; for conference attendees, they&#8217;re making it clear that the best way to stay on top of Mac OS X technical issues is by attending the conference.
</p>
<p>
This rationale makes sense on paper, but there are major problems with it.
</p>
<p><h4>Being In The Room</h4>
</p>
<p>
The first mistake is in assuming that reproduced content will approximate the value of &#8220;being in the room.&#8221; I&#8217;ve watched a fair number of the WWDC 2005 videos through the (painful) streaming ADC Select interface. Aside from the benefits of being able to pause, rewind, and skip the boring parts, let me tell you, it&#8217;s no conference. I am roughly able to absorb all the data that my peers who attended did, but they benefitted from a much richer experience.
</p>
<p>
Watching the WWDC sessions from home is like watching the New York New Years Eve party on television. You are a passive recipient of the information, but you don&#8217;t get to participate. You know when the new year arrives at very close to the same moment as all the thousands of people in the crowd, but you don&#8217;t get the satisfaction of washing the champagne stains out the next morning.
</p>
<p>
Even though the <em>information</em> (the passing of the year) from this great event is free and widely spread, the event is hugely successful. Why do those thousands of people travel to downtown NYC to participate in an event they could watch at home? It&#8217;s about being in the room.
</p>
<p>
The value of being in the room at WWDC is about 10 bajillion times greater than being in the room at new years. At WWDC, you can ask questions. If the line was too long and you missed your chance, you can recognize the speaker in the halls and track her down for clarification. At WWDC, you can participate in hands-on sessions, working through the new technology as you learn about it. At WWDC you can visit the labs and work in an environment where smart people are hovering about, waiting to answer your questions. Unless you&#8217;ve found a particularly well-stocked IRC room, these benefits are not available to you at home.
</p>
<p><h4>Being Outside The Room</h4>
</p>
<p>
The other major motivation for attending WWDC has nothing to do with the conference itself, but with the milieu surrounding it. There is quite simply no other time of year that such a concentration of like-minded Mac software developers exists in any one point on the globe. The closest thing you&#8217;ll find to this amazing congregation of Mac nerds, is the sizable number of them that reside permanently during working hours in Cupertino, California. The rest of us are lucky if we&#8217;ve found a half-dozen similarly inspired people within a 50 mile radius of where we live or work.
</p>
<p>
Apple takes this benefit to the ultimate level by opening its own doors for one evening during the conference, inviting attendees to relax, have a beer, and mingle with conference attendees and Apple employees on the Apple campus. This degree of access is totally incomparable to anything a developer can hope for via the web, email lists, chat rooms, or forums. The Apple campus on one summer Thursday becomes an absolutely sizzling hotbed of Mac nerdiness for 3 hours every year.
</p>
<p>
And Apple&#8217;s party is only the tip of the iceberg. Events like the Buzz Andersen&#8217;s <a href="http://weblog.scifihifi.com/2006/07/23/party-time-excellent/">annual party</a> are gaining momentum with each passing year. The number of extra-cirricular activities is so great that groups of developers with niche interests find it <em>difficult to find a spare lunch or evening</em> in which to meet. In summary? WWDC produces a week of nearly non-stop hot developer-on-developer action. You can&#8217;t buy that at home (ahem &#8211; nor, with that particularly risque choice of words, would you want to!).
</p>
<p>
To top it all off, WWDC has for the past several years been held in San Francisco, one of the most attractive tourist destinations in the world. The conference is epic, the scenery is epic, the attendees are epic. Attendance is an almost irresistible proposition for companies and developers alike. Apple has nothing to fear from making <em>the information</em> free.
</p>
<p><h4>Ask For What You Want</h4>
<p>The value of WWDC is about 5% information and 95% being in the room and being with your peers. If New Years were celebrated like WWDC, only a few thousand people would be running around on January 1 knowing whether it had truly come to pass. I agree with John Siracusa &#8211; it&#8217;s time to free the WWDC content. We want high quality, downloadable archive versions of all WWDC sessions. These should be available to any ADC member at any level of membership under the terms of their NDA.
</p>
<p>
If you also agree, let&#8217;s stop talking about it and start telling about it. Telling Apple, that is. Use the ADC <a href="http://developer.apple.com/contact/">contact form</a> to let Apple know how you feel. You want this information freed! This is not just for whiny non-attendees, either. Those of you who attend every year have also bemoaned the loss of DVD archives of the sessions, for instance. Take this opportunity to make yourself heard. We&#8217;re all in this together!
</p>
<p>
I encourage you to write whatever you feel in your feedback to Apple, but this is what I am writing and it might spark some motivation in you to &#8220;make the call&#8221;:
</p>
<p><div class='caption'>
Dear ADC:</p>
<p>
Regarding the video and slide content of WWDC sessions, I am writing to encourage the adoption of a more liberal policy for publicizing this information starting in 2006 and moving forward.
</p>
<p>
In the past, content has been available only by DVD distribution for conference attendees, or streaming video for ADC members of a certain paying level. This information is begging to be free, as it will improve the developer community and ultimately benefit Apple through the production of higher quality software for our (and your) customers. Developers are placed in an uncomfortable position of having access to the information that their peers do not. For most of us, this is in conflict with the sharing spirit of software development.
</p>
<p>
For more of my opinions on why sharing this information liberally would not be detrimental to the business side of WWDC, please see my article on the subject at the following URL:
</p>
<p>http://www.red-sweater.com/blog/166/wwdc-for-all</p>
<p>
Thank you for considering my opinion in the development of an improved strategy,
</p>
<p>
Daniel Jalkut</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/166/wwdc-for-all/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The Network Domain</title>
		<link>http://www.red-sweater.com/blog/106/the-network-domain</link>
		<comments>http://www.red-sweater.com/blog/106/the-network-domain#comments</comments>
		<pubDate>Thu, 23 Mar 2006 21:35:53 +0000</pubDate>
		<dc:creator>Daniel Jalkut</dc:creator>
				<category><![CDATA[Apple]]></category>
		<category><![CDATA[Darwin]]></category>
		<category><![CDATA[Hacking]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[Usability]]></category>

		<guid isPermaLink="false">http://www.red-sweater.com/blog/106/the-network-domain</guid>
		<description><![CDATA[A much-overlooked perk of Mac OS X&#8217;s BSD underpinnings is the presence of full-fledged support for NFS (network file system) in every shipping version of the operating system. This support serves as the underlying technology for the &#8220;Network Domain,&#8221; the fourth member of a family of directory hierarchies that also includes the System, Local, and [...]]]></description>
			<content:encoded><![CDATA[<style type="text/css"><!-- .caption { border-style:dashed; border-width:1px; border-color:#BBBBBB; margin-left:20px; padding:10px;}--></style>
<p>A much-overlooked perk of Mac OS X&#8217;s BSD underpinnings is the presence of full-fledged support for NFS (network file system) in every shipping version of the operating system. This support serves as the underlying technology for the &#8220;Network Domain,&#8221; the fourth member of a <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/Domains.html">family</a> of directory hierarchies that also includes the System, Local, and User domains. Within each of these domains, a predictable directory layout allows for the storage of applications, preferences, fonts, etc., in such a way that a properly-written application can transparently make such resources available to the user as a unified whole.</p>
<p>
Most users are probably not familiar with the concept of file-system domains at all. Among those who are, it probably boils down to a vague understanding that stuff in /Library is shared, stuff in the home directory is private, and stuff in /System should not be modified. The mysterious /Network directory is occasionally used to sluggishly locate shared directories from other computers on the LAN (local area network), but is rarely configured to fulfill its complete potential as the Network domain.
</p>
<p>
A <a HREF="http://www.red-sweater.com/fastscripts/">FastScripts</a> user recently contacted me. He works in a newspaper office, and is curious about whether there is any facility in FastScripts for sharing a directory of scripts to his entire team. Frustratingly, I have to tell users like this one that there is support for just such a setup &#8211; the network domain &#8211; but that setting it up is about the most convoluted Mac OS X task imaginable. It&#8217;s so beyond the scope of what any average user should be asked to do, that I&#8217;m tempted to implement a custom inter-computer sharing system, just so I can offer my customers a &#8220;do it for me&#8221; switch. Apple&#8217;s advice? &#8220;Implementation of the network domain is the responsibility of the network administrator.&#8221;
</p>
<p>
But the network domain is an awesome idea! So it looks like you get to be the network administrator. By setting it up correctly you gain a centralized share for all users of a LAN that benefits not only FastScripts, but any other application that correctly iterates the four domains for supporting files! For this reason, it&#8217;s worth knowing how to set up, and worth pressuring Apple to make the setup easier for everyday users. The remainder of this article details the steps you may take to both publish a shared &#8220;Library&#8221; folder from one computer and subscribe to it from any number of other computers on your LAN.
</p>
<p><h4>Configuration: A High Level Overview</h4>
<p>Before you tackle the task of setting up your network domain Library folder, you should be familiar with some terms used by the technologies on the Mac.
</p>
<p>
<a href="http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/additionalfeatures/chapter_10_section_9.html">NetInfo</a> is a unique Mac OS X technology inherited from NeXT. NetInfo is a database that manages many of the attributes of a computer and network that would, on more conventional UNIX systems, be managed entirely with text-based configuration files. Among NetInfo&#8217;s many responsibilities is the management NFS automount server and client information for particular machines on a network.
</p>
<p>
NFS is a UNIX technology for exposing shared directories from one system and mounting them to another. Unlike Apple&#8217;s legacy AppleShare system, where mounted servers appear functionally identical to mounted disks, NFS volumes can be attached virtually anywhere in the filesystem you desire (this is true for regular disks as well, but is rarely exploited). For instance, if you want to publish your music collection from one computer and have it show up on all other computers at the path &#8220;/MyStuff/ObscurePath/Whatever/Music/&#8221;, NetInfo can make that happen. The arbitrary location at which you decide to attach the shared directory is called a &#8220;mount point.&#8221;
</p>
<p>
A cool feature of NFS is a sort-of lazy loading technique whereby a mount point can remain unconnected until it is actually needed by some application. The technology responsible for this magic is called &#8220;automount.&#8221; What&#8217;s really cool about automounting an NFS shared volume is that it gracefully handles the absence of either the server or the client. So when you wander outside the realm of your LAN, the funky Music mount point described above  simply fails to locate the network resource. Instead of starting a 4-alarm fire, you simply get an &#8220;empty&#8221; directory.
</p>
<p>
So bringing this all together, how do we employ the underlying technologies such that we achieve our primary goal? We want a shared network domain Library folder, and the way to do that is by publishing an NFS volume that gets subscribed to with an automount mount point at &#8220;/Network/Library&#8221;.
</p>
<p><h4>On the Server: Publish an NFS Volume</h4>
</p>
<p>
First things first, we need to pick a directory on our &#8220;server&#8221; box and publish that to the LAN via NFS. In NFS terminology this is called an &#8220;export,&#8221; and the way this is configured on Mac OS X is via a top-level NetInfo directory entry called &#8220;exports.&#8221; NetInfo can get really complicated and to make things simple I&#8217;m just going to show you how you can add a plain-vanilla NFS export for a folder located at &#8220;/Library/MyNetworkShares/Library&#8221;. The &#8220;nicl&#8221; command-line utility makes this relatively straightforward:
</p>
<div class="caption">
<pre>
sudo nicl . -create /exports/&#92;&#92;/Library&#92;&#92;/MyNetworkShares&#92;&#92;/Library opts alldirs maproot=nobody</pre>
</div>
<p>
Note the crazy backslash overload. That&#8217;s because we want to get slashes into the actual name of the directory entry in NetInfo. The same task could be accomplished from the NetInfo Manager application, where you can also confirm visually that the configuration has been made as expected:
</p>
<p>
<img src="http://www.red-sweater.com/blog/images/NFSExports.jpg"/>
</p>
<p>
Once the NetInfo database has been updated, you can either attempt to ensure that all of the required <a href="http://www2.astcomm.net:2080/tech/nfs_howto/server/#daemons">daemons are reset</a> and recognize the new exports settings, or you can just reboot, which should get the NFS startup item to reload and configure everything corectly. By default the NFS server is enabled, and starts at boot time if there are any exports defined.
</p>
<p>
To confirm the NFS export is set up and your daemon is operational, simply run the showmount command from the command line on the server:
</p>
<div class="caption">
<pre>
showmount -e
Exports list on localhost:
/Library/MyNetworShares/Library           Everyone
</pre>
</div>
<p>
Now from another machine (or the same &#8211; doesn&#8217;t really matter), confirm the ability to actual mount the &#8220;volume&#8221;. My server machine is identifiable on the local network as &#8220;danielG5.local&#8221;, so I mount the exported directory on my laptop with:</p>
<div class="caption">
<pre>
mkdir /tmp/testmount
mount_nfs danielG5.local:/Library/MyNetworkShares/Library /tmp/testmount
</pre>
</div>
<p>Et voila! /tmp/testmount now looks and acts exactly as the /Library/MyNetworkShares/Library folder on the server.
</p>
<p><h4>On the Client: Configure the Network Mount Point</h4>
</p>
<p>
Now that we&#8217;ve confirmed the ability to mount the server on a whim, we need to arrange for the client machine to automatically &#8220;wire up&#8221; to the server whenever the /Network/Library directory is accessed. We do that by configuring a similar NetInfo node to the &#8220;exports&#8221; item above.
</p>
<p>
This time, the node resides in &#8220;mounts&#8221; and serves to inform the automounter about where the network resource is and where it should appear on the local machine. Run the following commands in the terminal, substituting the appropriate computer name for &#8220;danielG5.local&#8221;:</p>
<div class="caption">
<pre>
sudo nicl . -create /mounts/danielG5.local:&#92;&#92;/Library&#92;&#92;/MyNetworkShares&#92;&#92;/Library
sudo nicl . -append /mounts/danielG5.local:&#92;&#92;/Library&#92;&#92;/MyNetworkShares&#92;&#92;/Library type nfs
sudo nicl . -append /mounts/danielG5.local:&#92;&#92;/Library&#92;&#92;/MyNetworkShares&#92;&#92;/Library dir /Network/Library
sudo nicl . -append /mounts/danielG5.local:&#92;&#92;/Library&#92;&#92;/MyNetworkShares&#92;&#92;/Library opts ""
</pre>
</div>
<p>
And another visual confirmation from NetInfo Manager puts me at ease:
</p>
<p>
<img src="http://www.red-sweater.com/blog/images/NFSMounts.jpg"/>
</p>
<p>
Again, rebooting is probably the safest way to ensure that the changes are picked up by the automount daemon, but since automount is normally running by default, you should be able to simply restart the daemon:
</p>
<div class="caption">
<pre>
sudo kill -1 `cat /var/run/automount.pid`
</pre>
</div>
<p>
Go ahead and try it out &#8211; navigate in the Finder to /Network/Library. You should see the contents of &#8220;/Library/MyNetworkShares/Library&#8221; from the server computer. I have found the Finder&#8217;s concept of /Network to sometimes be a little flakey, so if it doesn&#8217;t seem to be working, try changing to the directory from the Terminal instead. I think this kind of thing irons itself out after a reboot. Once you&#8217;ve got it wired up, you can start putting junk in the folder that you want to have at your disposal on all machines on the LAN. Fonts, Scripts, etc. If an application doesn&#8217;t behave as you expect it to with the Network domain, let the application&#8217;s author know (in fact, FastScripts could benefit from a few tweaks to improve its functionality, though it basically works). This is a powerful and very cool infrastructure that more of us should be taking advantage of.
</p>
<p><h4>Simplifying the Process</h4>
<p>If repeating this process on all the clients in your LAN sounds daunting, fear not. A real network administrator would probably have some kind of sophisticated NetInfo hierarchy through which she could easily manipulate the &#8220;mounts&#8221; values for all of the machines in the network, but I&#8217;m going to assume you&#8217;re like me and are just hacking together a solution for a few machines in your house. We can use the &#8220;nidump&#8221; and &#8220;niload&#8221; commands to essentially copy and paste the successful settings from one client to another. First, obtain a raw text format copy of the mounts data:
</p>
<div class="caption">
<pre>
nidump -r /mounts . &gt; MyEasyMounts.txt
</pre>
</div>
<p>
Now take that text file to whatever client you like, and load it into that client&#8217;s NetInfo database:</p>
<div class="caption">
<pre>
sudo niload -m -r /mounts . &lt; MyEasyMounts.txt
</pre>
</div>
<p>
Don&#8217;t forget to either reboot or confidently reset the automount daemon again. </p>
<p>
The process described above can be repeated for other top-level Network domain folders like &#8220;Applications.&#8221; Just make a different folder on the server and add appropriate exports and mounts entries to the server and clients. Have fun, and enjoy your Network domain!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.red-sweater.com/blog/106/the-network-domain/feed</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
	</channel>
</rss>

