inamidst.com · topic

OS X Notes

Applications

Stuff that's usually in my Dock:

Other stuff I've found helpful:

Other

(These are old notes from 2006 that I thought I ought to publish; they may be out of date in several respects.)

Around August 2006 I started using OS X more regularly, and in doing so came across a variety of problems and ideas and so on that I'm sure other people will run into.

The Galliard Saga

I tried to install ITC Galliard on OS X but Font Book gave me the error message "Missing OpenType data", so I searched on how to fix that and found the advice to convert the font using fontforge. So I tried to install that using DarwinPorts, but I got the following error message:

checking for gcc... gcc
checking for C compiler default output file name... 
   configure: error: C compiler cannot create executables
See `config.log' for more details.
make: *** [builds/unix/unix-def.mk] Error 77

There was quite a bit of advice on how to fix this, mainly dicussing XCode 1.1 and its "lazy installation" method. The first thread that I found vaguely suggested reinstalling XCode, so I searched about a bit more and found a neat script called bomcheck from a fink thread that showed pretty much what I'd already suspected about the lazy installation was true.

So I reinstalled XCode and tried again but it didn't work. So I reinstalled the DeveloperTools.pkg package separately, and also tried running "sudo port -d selfupdate". This latter gave me the following error:

-fno-common darwinports.c -o darwinports.o
i686-apple-darwin8-gcc-4.0.1: fork: Resource temporarily unavailable

And this happened when trying to install fontforge again, so at least it was a new error. I used to get this problem sometimes on Cygwin, so I employed the same fix as for there: rebooting. When I booted up again, fontforge installed just fine.

$ time sudo port install fontforge  
[...]
--->  Installing fontforge 20060125_0
--->  Activating fontforge 20060125_0
--->  Cleaning fontforge
real    11:26.61s
user    5:54.93s
sys     3:13.89s
cpu     79%

Then of course I had to figure out how to convert the font. It appears that fontforge is an X11 program, and doesn't really have a command line interface for conversion, but thankfully the FAQ was fairly explanatory. I had to start X11 and then use fontforge in the terminal that X11 brings up (I wonder how I can get it to use better colours etc.), then it was a simple matter of changing the en-size from 1000 to 1024 to stop it from complaining, and saving in the dfont format.

Double clicking the *.dfont files and choosing "Install Font" worked just fine. Phew.

(Written up on the 28th August 2006.)

Choosing Hex Colours

I wanted to get Vim.app to highlight the background colour of the selected line, like TextWrangler does, and indeed wanted to use the same colour as in TextWrangler. So I found a Vim Tip on how to do it, and after finding that I needed to set guigb rather than termbg (makes sense), I then needed to get the hex colour code of the TextWrangler highlight.

So I took a screenshot and then opened it up in Preview to see if there was a way to select a point and inspect the properties of its colour, but I couldn't find an obvious way to do so. So instead I tried ToyViewer, but again there wasn't any way that I could find in there either, though the "Colours" dialogue seemed like it ought to be able to do it, only I couldn't find how.

Instead I tried loading Gimp.app, but it crashed right away (it had been working up until then). This was rather distressing, but rather than debugging that I decided to install Inkscape and see if that had some way of doing this. Perhaps it does, but I didn't get to find out since once again Inkscape.app, another X11 application, crashed too. Actually with Gimp, X11 kept running whilst Gimp crashed, but with Inkspace, X11 crashed and Inkscape kept running.

At any rate, I Googled about for hex picking in OS X, and found a few solutions. One was HTMLColorPicker, but that didn't say anything about being a Universal Binary so I avoided that. Instead, via MAB Blog I found HexColorPicker, which installs itself as an extra tab in the Colours dialogue, and is also a Universal Binary, so I downloaded and tried that instead. It worked a charm, so now, deciding to use green as the Normal Mode background highlight, I've got the following code in my ~/.gvimrc:

se cursorline
hi CursorLine guibg=#e6ffe6
autocmd InsertLeave * hi CursorLine guibg=#e6ffe6
autocmd InsertEnter * hi CursorLine guibg=#ffffe6

Though now I need to work out how to make the right gutter have a grey background, as in TextWrangler...

User Folders

In the sidebar of Finder you can add your own directories if you like. I did this for a couple of mine, but the bottom one keeps dropping off. Whatever I do, even if I add several more, only the very first folder that I'd put in is retained. I haven't been able to find a fix for this problem yet.

Setting up ntpd

For a while I'd been using tock.usno.navy.mil to synchronise my computer's clock, using the wonderful Automachron on Windows. But on switching to OS X I decided to use UK time servers.

Theory

Unfortunately this presents quite a problem since OS X isn't really set up to let people use non-Apple time servers. You'd think that letting people use NTP pools etc. would alleviate the load on Apple, but there you go.

So after ages of searching around for instructions on how to do it, I found a page on apple.com that described more or less the same thing. I'd contacted the National Physical Laboratory about acceptable poll rates on their servers, and so I had a decent ntp.conf file all ready to go.

Practice

It... kinda worked, but when I restarted ntp I got the following message:

SystemStarter[16248]: Running command (16249):
/System/Library/StartupItems/NetworkTime/NetworkTime restart Stopping network
time synchronization Starting network time synchronization Looking for host
time.euro.apple.com and service ntp host found : interweb.euro.apple.com
SystemStarter[16248]: Finished network time synchronization (16249)
SystemStarter[16248]: none left

Why is it still talking about euro.apple.com? I checked that the process was indeed using my configuration file and it seems that it is:

$ ps -Auww | grep ntp | grep -v grep
root     16284   0.0  0.0    27720    420  ??  Ss    5:10PM   0:00.34
   ntpd -f /var/run/ntp.drift -p /var/run/ntpd.pid -c /etc/myntp.conf

So what's up with the message, I wonder? Looking at man nftpd confirms that -c is the correct flag to use for a user configuration file, so beyond that it's a bit mystifying.

Text Editors

I use a variety of text editors, depending on which platform I'm using. Since we only generally interact with the computer using a keyboard and mouse (or trackpad), it's only possible to publish things using some kind of a text editor; so it's important that text editing is optimised.

As a programmer, I'm interested in ways of making better, more efficient text editors. I've written a couple myself, and a series of notes on them too, and am hoping to consolidate a few of my thoughts here.

The Editing Paradigm

The first editors were line mode based, and had no visual editing capabilities. One of the first editors to have the functionality of displaying a whole screenful of text was Bill Joy's vi. This was also a modal editor: it hadn't occured to Joy to use modifier keys, or that there was any other way of doing it. Later came emacs, which did use modifier keys instead of modes, and was more extensible than vi.

As a Tale of Five Editors says, "the fact that the religion of ed persists says a great deal that is worth noting about the Unix mindset".

Joy later said that he believed vi would be overtaken due to its inextensibility, though vim seems to have saved it from that to some extent. He, like the other early unix developers, seems to have believed mouse chording and other innovative features to be the future, and so to focus more on the Plan 9 editors like sam and wily. I wonder about dual carets and the like.

The Singular Taste

If one were to create a decent line mode editor now, what would it be like? I actually wrote a line mode editor for RDF called RDFe that had a lot of very good smarts in it. It would be interesting to see if such smarts could scale up to editing other text structures.

One of the main problems with RDFe was actually that though I entered only a small amount of data, it was giving me a lot of context (necessarily) back, so it was a bit hard to follow a session. It would have been nicer had it added the data to a continually evolving Notation3 file, selecting the most relevant instance of a node or arc to modify.

It's also quite possible that I only think that this is a problem because I'm used to visual editors, since pretty much all modern editors are visual, except for sed (and ed, for those who still use it).

Sean B. Palmer, 2007-05-07