Category: Unix Notes

Rightfully (moving forward) I should rename this to OS X Things and remove the Mac.

Of course almost all of the posts really do refer to “Mac OS X Things”, so I should leave it alone.

There is a post about postfix getting stepped on.

There should be a post about the removal of /private/etc/apache2/users/* which sort of messed up my web serving since I actually included those files. Well, not me, the apache2 port in MacPorts caused them to be included.

I am back up and running pretty much completely in OS X (as opposed to Mac OS X) not server.

After installing OS X 10.8 Mountain Lion, a few things in our web development environment stopped working (namely Apache with multiple vhosts, BIND/wildcard DNS, Phusion Passenger and the rmagick2 gem, and postfix). The reason being is that Apple overwrites all of the configuration files that those tools rely on (although the old ones are all backed up with an appended ~previous, so fixing is relatively straightforward). We rely on postfix for sending mail locally via smtp using PHP’s mail() (i.e. sendmail) or Rails’ ActionMailer.

The behavior of ‘bash’ is changed by more files that .bash_profile. In particular, the ‘readline’ settings are found in .inputrc – bashed my head against the wall for a while on a system that didn’t ignore case on filename completion.

There are several hints on this site for unmounting a partition at login, but a better way to make this happen can be used. You need to create an entry point in your filesystem table to tell the OS not to mount that specific volume, and this is relatively easy. In Mac OS X, and under Linux and others unix systems, the volume mounting configuration file is located in /etc/fstab. This file in Mac OS X Tiger is empty in Panther, its commented, but type man fstab in Terminal to read some important information.

To enable your Leopard system to receive network syslog submissions edit /System/Library/LaunchDaemons/com.apple.syslogd.plist and uncomment the lines specified in the comments so that the end of the file looks something like this.
<key>NetworkListener</key>
<dict>
<key>SockServiceName</key>
<string>syslog</string>
<key>SockType</key>
<string>dgram</string>
</dict>

NB – the NetworkListener is part of the Socket dict entry!!!

Then execute the following commands (wait a few seconds between commands):
sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist
sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

That is enough to get an apple base station to dump it’s log into the system log.

Sed is the ultimate stream editor. If that sounds strange, picture a stream flowing through a pipe. Okay, you can't see a stream if it's inside a pipe. That's what I get for attempting a flowing analogy. You want literature, read James Joyce.

Anyhow, sed is a marvelous utility. Unfortunately, most people never learn its real power. The language is very simple, but the documentation is terrible. The Solaris on-line manual pages for sed are five pages long, and two of those pages describe the 34 different errors you can get. A program that spends as much space documenting the errors than it does documenting the language has a serious learning curve.

Do not fret! It is not your fault you don't understand sed. I will cover sed completely. But I will describe the features in the order that I learned them. I didn't learn everything at once. You don't need to either.

This HOWTO covers how to enable building with ccache. It is a compiler cache. It uses the gcc -E switch and a hash to detect when a compilation can be satisfied from cache. The effect is that packages frequently compile 5-10 times faster than they would otherwise.