So you want to buy a Mac…

…in fact, probably a portable. You've been fascinated by the glossy interface, by the sleek aluminum case, and your geek soul knows that a blasoned UN*X is working inside for you. You come from a Linux environment, and after several years you're pretty used to have a few things in place.

This page gathers the various tricks, tips, and fixes that I had to do to “convince” my Mac to be usable. Trivial stuff, like copying a CD, listening to Ogg Vorbis audio files, watching a movie full-screen (yes, it's true, QuickTime doesn't do it if you don't pay!) and watching DVDs coming from any region. Or having a decent keyboard combination to simulate the delete key (yes, it's true, you have no delete key on a MacBook).

Getting into the free world

Some very good people distribute free software for the Mac using a combination of precompiled binaries and compilation from sources. First of all, install Apple's developer kit. Then install Fink, following carefully the instruction. In particular, you must source a setup file in your .bashrc:

if [ -f /sw/bin/init.sh ]; then
        . /sw/bin/init.sh
fi

Now you can install precompiled binaries using apt-get, and compile on demand using fink. textutils, fileutils and findutils are a good start.

Tweaks

It is a bad idea to have a MacBook wake up every time it's opened, as it is easy to open the lid for a second and the close it: this leads to crashes. You can stop your MacBook from waking up by typing

sudo pmset lidwake 0
at the terminal.

If you are using a regional keyboard, the presence of a single ALT/Option/whatever key might turn your typing into a nightmare. DoubleCommand is a great utility that traps at the kernel level keyboard events and lets you install some precompiled transformations, which include turning the useless keypad enter key into an ALT/Option/whatever key and making Shift-Backspace to produce a Delete. Note also that in Parallels and other virtualisation software you can press Control+Option to simulate the AltGr modifier of a PC keybaord.

For unknown reasons, an operating system with a high-tech PDF-based rendering engine uses by default the C locale; for instance, this will prevent you from checking out a subversion repository with UTF-8 filenames. Moreover, the terminal application provided by Apple is set up in such a way you can't write characters beyond ASCII. You must do as follows:

  1. add the following lines
    export LANG=en_US.UTF-8
    eval $(locale)
    
    to your /etc/profile;
  2. configure the terminal application so that it does not escape non-ASCII characters and that it uses UTF-8 as encoding;
  3. check that your .inputrc file contains
    set meta-flag on
    set convert-meta off
    set output-meta on
    

This is far from perfect—there are problems when editing command lines containing non-ASCII caracters; at least it's a start.

Note that the OS X file system uses UTF-8 filenames, but with a different normalisation than the rest of the world (letters with diacriticals are broken into a combining diacritical and a standard letter). This can cause all sort of problems with software like rsync. And the filesystem is not case-sensitive.

The function keys by default control the “hardware features” (this is Applespeak for volume, etc.), but you really want them by default to control the “software features” (e.g., being completely normal function keys). You can set this behaviour in the keyboard preferences.

By default Finder won't show all files. This can be a nuisance, but it is easy to fix typing the following command:

defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

If you're eager to use iChat in multiperson video conference, you might (as many other people) be very disappointed: iChat often miunderstands the configuration of your Mac (in particular, the network bandwidth) and will keep you from videotalking with more than one person. Cocktail (not free, but very cheap) can really help (sure, it helped me!): the network section lets you set the actual speed of the network you're using (or a fake speed that will make iChat happy). Cleaning all caches (always with Cocktail) is reported to help, too. If iChat disconnects often and randomly (something that appears to be fairly common), install Chax, which provides, among many additional options, automatic reconnection.

Useful stuff

…but, more importantly, if you have a motion sensor you cannot live without MacSaber.

Programming

As we already mentioned, Apple distributes for free its development kit, which contains also an IDE. Java and some related utilities (most notably, ant) are already installed. Eclipse is easily installable and works very well (albeit SWT for OS X is not usually so up to date as the Windows or Linux version). Ruby is already installed, but you might want to update it.

Many applications export an interface that make them scriptable. The situation is very similar to what was available on the Amiga using AREXX (for the few who can remember). Interestingly, even if by default scripts must be written in AppleScript (and you don't want to do that) there are bridges (e.g., for Python and Ruby) that make it easy to script applications in other languages. For instance, the following Ruby script will extract the track number from Ogg Vorbis files and poke that information into iTunes (which by default does not read track numbers from such files); the script requires the Ruby vorbisfile extension:

require "appscript"
require "vorbisfile"
include Appscript

it = app("iTunes")
vf = Ogg::VorbisFile.new
old = it.fixed_indexing.get
it.set(it.fixed_indexing, :to => true)

it.library_playlists[1].file_tracks.get.each do |track|
  path = track.location.get.path
  if path[-4..-1] == ".ogg" then
    f = File.new(path)
    vf.open(f)
    puts path
    tn = vf.comments(-1)["tracknumber"]
    if tn != nil then it.set(track.track_number, :to => tn.to_i) end
    f.close
  end
end

it.set(it.fixed_indexing, :to => old)

LaTEXing

The tools for writing in LaTEX are a pretty damn religious choice. After some fiddling I decided to use TeXlipse for editing and PDFView for previewing. The two tools can interact fairly happily, if the previewer is set to the following script in TeXlipse (note that I installed PDFView in Application/Extras):

#!/bin/bash
/usr/bin/open -a /Applications/Extras/PDFView.app "$1"
osascript -e "tell application \"PDFView\" to display tex line $2 of file \"$(pwd)/$1\""

Of course, you must setup the viewer preferences in TeXlipse so that the viewer is started using the above script, and the first parameter passed is %file whereas the second one is %line.

The idea is that of firing PDFView, and then move it on the right line using the built-in AppleScript interface. You need the pdfsync package, which generates positional info. Inverse search is also supported—just set up things in PDFView using a custom external command and create a script like this (note that I installed Eclipse in Application/Extras, too):

#!/bin/bash

java -classpath $(ls -1 /Applications/Extras/eclipse/plugins/net.sourceforge.texlipse_*/texlipse.jar | tail -n 1) \
	net.sourceforge.texlipse.viewer.util.FileLocationClient -f "$1" -l $2 &>/dev/console # $1 = file, $2 = line 

This command tells TeXlipse to move on the right spot: you must of course pass %file as first parameter and %line as second parameter (yes, the parameter syntax in TeXlipse and PDFView is the same). Note that this setup will work only if you compile using pdflatex.

This is valid HTML 4.01