Mac OS X Changes To Unix

By Xah Lee. Date:

This blog is some random notes on Mac OS X.

Recently, i was helping my friend, professor Richard Palais install and fix some svn repository issues at his os x server at uci. I've been doing senior unix sys admin work during 1998 to 2002 on Solaris. But I haven't really been doing any serious sys admin since. It is a pleasure to dive into the unix quagmire again.

As discussed in my The Unix Pestilence page, the best resource for unix admin is not some commercial books, but rather, the documentations published by the unix maker itself.

The current documentation for Mac OS X 10.6 (Snow Leopard) is at: Mac OS X Server Guides. They are excellent.

Changes To Unix

Mac OS X, made many fundamental changes to the incompetent unix in the past decade since it adopted unix. Here's some of them as far as i know:

The login account management and infrastructure has changed. No more “useradd” or “groupadd”. It was replaced by Netinfo, but NetInfo got replaced by Lightweight Directory Access Protocol mechanism in 10.5 (Leopard, 2007). My unix expertise is quite still classical, so i am not really familiar with NetInfo or LDAP.

OS X's Launchd, replaces several unix's start up processes and background processes. Here's Wikipedia quote (slightly edited):

launchd is a unified, open source service management framework for starting, stopping and managing daemons, programs and scripts. It was introduced with Mac OS X v10.4/Darwin v8.0, and is licensed under the Apache License.

The launchd daemon is essentially a replacement for init, rc, the init.d and rc.d scripts, SystemStarter (Mac OS X), inetd and xinetd, atd, crond and watchdogd (Mac Os X).

Of these replaced tech, i particular know about inetd and xinetd. The xinetd replaces the incompetences of inetd. The unix story is all about these replacements. You have sudo replacing the stupid root system, sh csh tcsh bash perl, ed sed vi, grep sed awk perl, c csh c++, ftpd proftpd, rcp rsync, telnet ssh, … [see The Unix Pestilence: Tools and Software]

mds Process Problem

On his server, i noticed that the mds process is hogging cpu 100%. Apparently, something is wrong. A search on the web found many posts about it. Basically, the problem is solved by making Spotlight to re-index the hard drives. (mds is one of the process of Spotlight)

To have Spotlight re-index drives, go to Control Panel, Spotlight, then Privacy Tab. Drag drives to the window. Wait for some 30 seconds for it to take effect. This will delete Spotlight's indexed files (i presume). Then, Remove the drives by clicking the minus sign.

Mac OS X SSH Session Disconnection


While is was doing sys admin work 8 years ago, i use vi occasionally. That means few times a week, when i have to login to remote servers that doesn't have emacs installed. Long story short, today, i have to use vi again, so have to brush up some commands i forgot. So, i extended by vi tutorial here: Emergency vim .

The reason i have to use vi is a bit complex. Mac OS X has emacs bundled. I have 2 machines. My main machine is a PC running Windows Vista, my secondary machine, which sits on the side, is a PPC Mac running OS X 10.4.x. I can access the server either by ssh from my Windows, or from my Mac, or using the remote desktop software Timbuktu (software) on my Mac. Using the remote desktop software is not a luxury, because i actually need to access the Mac GUI for several reasons. For example, i need to access the various OS X's sys admin GUI utilities. Also, i need to give instructions about using various GUI software on the server. Also, when i use Timbuktu, he can watch while i work on the server, it helps communication. (we also are chatting in voice on Skype)

Normally, if i need to read some doc on the web, or do command line work, i use my main machine, which is Windows. However, due to the Mac ssh idle drop out problem, it makes ssh from Windows to OS Server a problem. The ssh program on my Windows is PuTTY. Every time i got disconnected, i have to type the damn long server name and login and password and cd to the dir i was working. A pain. So, for command line work, i work on my Mac thru Timbuktu.

To make things clear, let me repeat: I use my Mac, and Timbuktu, to connect to the server. So, i see the server's screen inside a window on my Mac. Then, i start Terminal there. While in Terminal, i could start emacs in the command line, or, start the GUI emacs Carbon Emacs. But it's not a good option. Because, i've been using emacs for 12 years, and have developed a complete custom designed set of basic shortcuts [see ErgoEmacs Keybinding], as well as over a thousand lines of custom elisp code. On the remote server, i don't remember what state of my emacs init files there are. Remember, the key confusion would be very complex, because i'm using a PC keyboard, connected to my Mac, going thru Timbuktu, then running Terminal on the server, then running Emacs. Also, my Mac is setup to use the Dvorak layout, and so is my account on the server. When i type a key combination on my keyboard, the keystrokes goes thrue several layers of translation to reach the emacs on the server. Adding the fact that i'm used to a different shortcut set that is different than the emacs default. So, if i just want to make some simple edit in some simple file once, it's easier to just start vi. (or, TextEdit)