Archive for June 2009

Mac Home and End Keys

I am using the aluminium Apple keyboard which includes the numeric keypad and cursor keys arranged in an inverted T shape.

One thing that I cannot get used to is the behaviour of the Home and End keys. Being from a DOS/Windows/Linux background, I expect the Home key to move the cursor to the beginning of the line and the End key to move the cursor to the end of the line.

The default Mac behaviour of the Home key is to scroll to the beginning of the edit control and the End key is to scroll to the end of the edit control. The cursor position is not changed.

Thankfully, Jon Evans has written a very useful blog article describing how to change the behaviour of the Home and End keys to match that of DOS/Windows/Linux.

Summarising Jon’s blog …

Edit ~/Library/KeyBindings/DefaultKeyBinding.dict (create the file if necessary) and add the following lines to the file …

{
        /* Remap Home / End to be correct :-)  */
        "\UF729"  = "moveToBeginningOfLine:";                   /* Home         */
        "\UF72B"  = "moveToEndOfLine:";                         /* End          */
        "$\UF729" = "moveToBeginningOfLineAndModifySelection:"; /* Shift + Home */
        "$\UF72B" = "moveToEndOfLineAndModifySelection:";       /* Shift + End  */
}

I think you then have to either logout or reboot, I’m not sure which as I haven’t done either yet.

Connect a Mac to a Linux NFSv4 Share

WARNING: I’ve made some mistakes in this post. Sorry. Upon further research, I’ve discovered that the Mac automount defaults to NFSv3. I have not yet found a way to force it to use NFSv4. :-(

There is alpha support for NFSv4 when manually mounting an NFS share. The mount command becomes …

$ mount -t nfs -o vers=4.0alpha hostname:/nfsv4_share mountpoint

Once I work out how to get the Mac automount to use NFSv4, I’ll update this post again.


I run NFSv4 on my Linux box to share various directories. I wanted to take advantage of the Mac’s ability to automatically connect to an NFS share by changing directory to /net/hostname/nfs_share. Unfortunately, every attempt to connect resulted in an error message. (No, I can’t remember the error message now.)

The Linux box’s /etc/exports file contained …

# NFSv4 exports.
/srv/nfs4               *.camden.airport.au(ro,sync,fsid=0,crossmnt,no_subtree_check)
/srv/nfs4/flac          *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/john          *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/mp3           *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/photo         *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/public        *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/richard       *.camden.airport.au(rw,nohide,sync,no_subtree_check)
/srv/nfs4/video         *.camden.airport.au(rw,nohide,sync,no_subtree_check)

Googling revealed what the problem was. I needed to add the insecure keyword to the definition of each NFS share. The Linux machine’s /etc/exports file now reads …

# NFSv4 exports.
/srv/nfs4               *.camden.airport.au(ro,sync,fsid=0,crossmnt,no_subtree_check,insecure)
/srv/nfs4/flac          *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/john          *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/mp3           *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/photo         *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/public        *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/richard       *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)
/srv/nfs4/video         *.camden.airport.au(rw,nohide,sync,no_subtree_check,insecure)

After restarting the NFS server the Mac is now able to connect to the NFSv4 shares.

However, there is one quirk that you should be aware of. When connecting to an NFSv4 from another Linux machine, the mount command is …

mount -t nfs4 hostname:/richard /local_mount_point

When connecting to the same NFSv4 share from the Mac, the cd command is …

cd /net/hostname/srv/nfs4/richard

You should notice that Linux NFSv4 client is able to omit the /srv/nfs4 part of the export definition because of the way that that part of the exported directory tree is configured. The Mac does not have the ability to omit the /srv/nfs4 part of the export definition.

iTerm — Alternative to Mac’s Terminal.app

If you haven’t already noticed, the Mac’s Terminal.app is not the best terminal that you’ve ever used. It works, but it’s not great.

Last night, I discovered iTerm. iTerm appears to be a better terminal emulator than Terminal.app, but it does have its own quirks …

  • The not–so–obvious way to configure the default terminal settings. It took me a while to discover the Bookmarks–>Manage Profiles option to be able to change the default window size, the default font and a couple of other things. Now that I know, it’s not so bad.
  • The weird Bonjour behaviour for connecting to ssh servers. The default behaviour is to execute the command ssh your_username@host_ip_address. Why use the IP address? The name of the host is known, so why not use that? I’ve already got entries in my ~/.ssh/config using the remote ssh hostname, so why would I need another one for the host’s IP address? I’ve ended up creating my own login command for my ssh hosts, so I no longer need to rely on the default Bonjour behaviour. All in all, it’s a good idea, but just seems to be poorly implemented.
  • The best feature of iTerm is that it implements a 256 colour xterm. It’s brilliant. :-)

I’m getting used it iTerm. The more I use it, the more I like it. Congratulations to the developers of iTerm.

Getting email working with GPG

I’ve downloaded MacGPG2 and GPGMail but haven’t installed them yet.

Installing New Fonts on Mac

Another newbie Mac lesson.

I wanted to install Microsoft‘s Consolas font and the Bitstream Vera fonts.

All I had to do was copy the .ttf files to ~/Library/Fonts and the fonts were installed and were available the next time the font selection dialogue box was opened. Pretty impressive.

Compare this with the jiggery-pokkery that you have to go through to install a new TrueType font on your Linux system.