Setting up Erjang with MacPorts

To setup the JVM based Erlang VM (i.e. Erjang) follow this recipe:

  1. Install the Erlang port: sudo -i port install erlang
  2. Follow the build instructions on the Erjang wiki.
  3. export ERL_ROOT=/opt/local/lib/erlang
  4. Enjoy! 🙂
Advertisements

Learning to love Finder

Let’s face it.

The venerable OS X file manager, the Finder, is not a perfect tool. Finder is probably one of the aspects of OS X I like the least. It’s good for cruising around file systems in “column mode” and for browsing media files with Coverflow but for serious file management work I tend to want to drop into the Terminal as soon as possible. Problem is that the new Terminal window will not be in the same folder as to where I’ve navigated in Finder, causing me to lose context – every time.

Recently I stumbled on cdto – a little app that adds an icon to Finder that open a Terminal window. With the current working directory set to the folder shown in Finder! No context lost!

And remember, the opposite operation  – opening a Finder window in the current working directory of a Terminal – is trivial with the always useful open command:

$ open .

When applied together, these two small tips makes it possible to use Finder only for the tasks where it shines.

Put a Spotlight on a MacPort

OS X essentiality MacPorts has a convenient command line user interface for querying and browsing available software packages. For instance a simple "ports info pine” will net:

pine @4.64 (mail)
Variants:             darwin_9, ssl_plain
Description:          Pine is a tool for reading, sending, and managing
                      electronic messages that was designed with novice
                      users inmind.
Homepage:             http://www.washington.edu/pine/

Platforms:            darwin
License:              unknown
Maintainers:          sean@fuzzymagic.com

A more graphical option for the occasional port lookup is to use OS X built-in file indexing system Spotlight that happily provides as-you-type matching of available ports in the local ports tree.

The corresponding port file directory will typically be the top match when searching for well-known unix software.

OS X Essentials: MacPorts

There is plenty of great  Mac software available. Among my favorites are the instant messaging client Adium, the editor TextMate and the media center Plex. This is software that is OS X-only – stuff I really miss when I run Linux. However there is now way around the fact that Linux has an advantage when it comes to general Unix software. Most stuff is only an apt-get away in Debian-derived Linux distributions, while you need to Google around to find a disk image when you are on a Mac, or – even uglier – download and untar something under /usr/local or similar.

However it is in fact perfectly possible to achieve an apt-get level of convenience on a Mac! The silver bullet is MacPorts – a Mac implementation of the BSD ports system. The only problem is just that MacPorts is a ports implementation meaning that only source code is pulled from the net, all binaries are built locally (in the case of MacPorts with the Apple Xcode tool chain). MacPorts is thus a bad fit for the impatient (especially if one for instance would aspire to install the Gimp port with all its dependencies). I’ve no complaints with regard to the user interface (command line based just as apt-get) or port availability and upstream synchronization frequency. Everything I have desired to install so far has successfully been pulled down, configured, built and installed under the MacPorts prefix /opt/local.

I was delighted to find that MacPorts even provided a port of Java build tool staple Maven.

OS X Essentials: MenuMeters

My Mac is dead silent. Even more so after I replaced the already quiet hard drive with a completely silent SSD.

With no audible indication of e.g. swapping/thrashing I was in dire need of some kind of system monitor, capable of at least displaying CPU and memory usage. I wanted the monitor to visible on the desktop all the time but at the same time I’m quite stingy with my screen real estate. This disqualifies CPU monitors implemented as Dashboard Widgets since Widgets are only displayed on the screen when a special key is pressed. It is possible to hack OS X to always display widgets on top of the desktop but widgets steel screen estate. I’m not a big fan of widgets anywhere really – not on cell phones, not in Vista nor in OS X. I find them distracting toys for the most part.

The option I finally settled on was Menumeters which is informative, unobtrusive, pretty (enough) and highly configurable through its own pane in “System Preferences”.

MenuMeters lives (surprise, surprise!) in the rightmost portion of my Snow Leopard menu bar thus preserving my screen estate. Wide-screen monitors generally have ample free space in the OS X menu bar.

Restoring PC keyboard sanity on OS X

Purist Mac-heads thinks that pressing Alt+Shift ⇑+8, Alt+Shift ⇑+9 and Alt+7 to produce {, } and | respectively is just the way of nature. As a Mac OS X user and programmer of C syntax programming languages I beg to differ. Personally I very much prefer the less finger acrobatic Alt+7, Alt+9 and Alt Gr+< routines I’m familiar with from the Windows and Linux world for producing the same characters.

I’d not define myself as a Mac-head, my background is mainly in PC:s and Linux even though a SSD-equipped Mac Mini is my primary at-home-computer. OS/X is elegant, fast and has that so desirable it-just-works quality that even current state of the art Linux distributions seem to not yet fully have achieved. Hooking up a PC-keyboard with a Swedish layout to the Mini just works – as expected. But for the the left curly brace, the right curly brace and the pipe character the just works ends there if your are not willing to submit to the arcane finger acrobatics described above.

The fix

  1. Download Ukulele.
  2. Ukulele is a keyboard layout editor, but for our purposes we do not need to edit anything, just grab the .keylayout file for your locale from the Logitech Keyboard Layouts directory of the Ukele disk image and copy it to ~/Library/Keyboard Layouts
  3. Tick the keyboard layout in the Input Sources tab of the Language & Text pane in System Preferences.
  4. Rejoice – curly brace and pipe character frustrations are now a thing of the past!

N.B. the keys mentioned in this post are those found on a PC keyboard with a Swedish language keyboard layout. The general problem described is likely similar for other Nordic and European keyboard layouts, even though there may be some differences to the character↔key mapping.