Nasty upgrade bug: if you upgraded OS X 10.4 to 10.5, the installer left your old manpages in place. It also added the new ones, gzip compressed, but man finds the old ones first.
The summarized fix:
find /usr/share/man -exec test -e {}.gz \; -exec tar rzvPf ~/man.tgz {} \;
sudo find /usr/share/man -exec test -e {}.gz \; -exec rm {} \;
Your 10.4 manpages will be backed up to ~/man.tgz
and then removed.
If you have a case-sensitive file system, see the comment by sEEKz on the hint page.
A couple of small updates to my facebook-statuses script:
Download facebook-statuses
.
Copy the “Friend’s Status Updates” link from your Facebook status page. It should look like http://www.facebook.com/feeds/friends_status.php?id=123&key=789asdf&format=rss20
.
Run the script with the URL you copied as the first argument: facebook-statuses 'http://www.facebook.com/feeds/friends_status.php?id=123&key=789asdf&format=rss20'
(with your own URL, obvs). A big pile of Growl notifications should appear. The script saves the RSS URL, so in the future you can run facebook-statuses
with no arguments.
Automate! Run crontab -e
and add */10 * * * * ~/bin/facebook-statuses
to run the script every 10 minutes.
It will show an image if it can find ~/Pictures/facebook.png
. I used Facebook’s favicon which is okay but too small. Suggestions for a better image are welcome.
I wrote a little script to post Backpack Calendar events from Quicksilver.
A Growl notification lets you know if the event was posted properly.
It’s like QuickPack but it only handles calendar events. I wrote it mostly to learn how Quicksilver actions work. I’m a programmer; I like reinventing the wheel.
Along the way, I fixed a tiny bug with booleans in the Ruby library and kludged around a bug in the API (XML with multiple root elements is sometimes returned).
/opt/local/lib/ruby/site_ruby
; see ruby -le 'puts $:'
).curl http://antiflux.org/~grant/code/backpack_calendar.booleans_and_multiple_elements.diff | patch
~/Library/Application Support/Quicksilver/Actions
. If you don’t have an Actions
folder, make one.Backpack API
. The account name is your Backpack user name. The password is your API token, which you can find on your Backpack account page.cal
or similar to find the script.Enter text as you would in Backpack: 4/14 spend Saturday night nerding out
.
A word starting with +rem
(e.g., +remind
and +reminder
also work) will turn on a reminder for the event.
The first calendar (“Personal”) is the default. You can post to a different calendar by putting its name in square brackets: [work]
.
If the Growl notification says “Event post failed”, it’s probably because Backpack doesn’t understand your date or time. Take a look at the examples on the Backpack Calendar.
Those little iTunes Store arrows seemed useless until I learned that ⌥-clicking makes the link work within your library. I use them most often to jump from the full library to playing a single album.
To make the links internal by default (with ⌥-click going to the iTunes Store):
defaults write com.apple.iTunes invertStoreLinks -bool true
SSHKeychain was the last PowerPC application on my MacBook, and it was also taking a lot of CPU time. The program hasn’t changed much in the past couple of years because its developer has been too busy with work. A couple of weeks ago he resurfaced on the developers mailing list and co-ordinated a Universal build that also fixes a crasher.
Summary: hooraj!
Why use Mutt instead of a pretty graphical mail client? Because it still sucks less than anything else I’ve tried.
Mutt is incredibly configurable, which of course means it takes a long time to set up.
Install MacPorts if you don’t have it.
$ sudo port install mutt-devel +headercache +imap +ssl
$ sudo port install msmtp mailtomutt lbdb urlview w3m
Add the following to ~/.muttrc
. Use your own email address and mail server, obvs.
set query_command="lbdbq %s" # little brother talks to address book
set text_flowed # use format=flowed
unset wait_key # return immediately from external programs
set encode_from # use quoted-printable for From at the start of a line
unset metoo # remove me from CC
set edit_headers
set autoedit
set read_inc=100
# imap
set imap_idle
set imap_user=grant
set imap_pass=`security find-internet-password -g -r pami -s mail.antiflux.org 2>&1 >/dev/null | cut -d\" -f2`
set folder=imaps://mail.antiflux.org/mail/
set spoolfile=imaps://mail.antiflux.org/inbox
unset record # no sent-mail folder
fcc-hook !(~l|~p) ! # save non-list, non-to-me messages to the inbox
set header_cache="~/.mutt/cache/headers"
set message_cachedir="~/.mutt/cache/bodies"
set certificate_file=~/.mutt/certificates
set ssl_force_tls
set mail_check=300
# smtp
set use_envelope_from
set sendmail="/opt/local/bin/msmtp"
set from="Grant Hollingworth <grant@antiflux.org>"
set hostname=antiflux.org
set sendmail_wait=-1 # send in background
# 'mailboxes' has to be after 'set folder' for the '+' to work`
# e.g., mailboxes ! +debian-security-announce
Mutt will cache the headers of the mail in each folder you look at, as well as the bodies of all the mail you’ve read.
mkdir -p ~/.mutt/cache/{bodies,headers}
This stuff adds up, though, and Mutt doesn’t delete old headers and bodies. Make a cron entry to delete cache files more than a week old. Run crontab -e
and add the following line:
@hourly find ~/.mutt/cache -mtime +7 -mindepth 2 -delete
Mutt doesn’t have SMTP support built in. Instead, it expects a sendmail-style command to be available. You can use Postfix, which comes with OS X, but I prefer to send the mail using mail.antiflux.org, my mail server. msmtp acts like sendmail and sends mail by SMTP over SSL.
Create ~/.msmtprc
with the following, adjusted for your own account:
account default
host mail.antiflux.org
from grant@antiflux.org
auth on
user grant
password SEKRIT
tls on
tls_trust_file /Users/grant/.mutt/certificate-authority
tls_starttls off
domain spooky.example.org
mail.antiflux.org has an SSL certificate, but it’s signed by our own certificate authority. To tell msmtp I trust it, I downloaded the authority certificate.
curl http://antiflux.org/ca/antiflux.org-root.pem > ~/.mutt/certificate-authority
The domain
setting on the last line of .msmtprc
is a bit of a kluge. By default, msmtp tells the mail server its name is ‘localhost’. mail.antiflux.org rejects potential spam by denying external mail claiming to be local. I used the example.org domain to work around this.
The Little Brother’s Database (lbdb) can search Apple’s Address Book for email addresses. It also knows how to read Mutt’s alias file, Pine’s address book LDAP directories, and more.
Make ~/.lbdbrc
:
MODULES_PATH="$HOME/.lbdb /opt/local/lib/lbdb"
METHODS="m_muttalias m_osx_addressbook"
If you want to search for names with accented characters, you need to make your own version of the m_osx_addressbook
script.
mkdir ~/.lbdb
~/.lbdb/m_osx_addressbook
:
#! /bin/bash -posix
#
# -*-sh-*-
#
# Copyright (C) 2003 Brendan Cully <brendan@kublai.com>
# Copyright (C) 2005 Roland Rosenfeld <roland@spinnaker.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
#
libdir=/opt/local/lib/lbdb/
m_osx_addressbook_query()
{
$libdir/ABQuery `echo "$@" | iconv -f 'utf-8' -t 'macroman'` | grep -ia "$@"
}
Copying links and pasting them into your browser gets old after a while. You can’t just click on links in Mutt as in a graphical mail client. The next best thing is urlview
, which you can run with ⌃B.
~/.urlview
:
COMMAND open %s
urlview
will use open(1)
for all links. open
will use your default browser.
A lot of mailing lists have headers with URLs in them, which I don’t want to see in the list of links. I made a wrapper to chop them out.
~/bin/urlview
:
#!/bin/sh
# throw away mail headers to avoid list URLs
ruby -e 'gets until /^\n$/; print while gets' $@ | /opt/local/bin/urlview
For this to work, $HOME/bin
should be before /opt/local/bin
in $PATH
.
curl http://filibusta.crema.unimi.it/~gufo/files/view_attachment.sh > ~/bin/view_attachment
chmod +x ~/bin/view_attachment
~/.mailcap
:
text/html; view_attachment %s html; needsterminal
text/html; w3m -dump -T %t; copiousoutput
image/*; view_attachment %s
~/.muttrc
:
alternative_order text/plain *
auto_view text/html
With this setup, Mutt will show the text/plain section of a MIME message with both plain text and HTML. If the message is HTML-only, it will convert it to plain text with w3m
. To view HTML in your browser, hit v
for the attachment menu, select the attachment, and hit enter.
Terminal.app uses UTF-8 encoding of text by default, but not all your programs will know that.
add to ~/.profile
(or ~/.MacOSX/environment.plist
):
export LC_CTYPE=en_US.UTF-8
add to ~/.inputrc
:
set input-meta on
set output-meta on
set convert-meta off
Finally, in Terminal’s “Window Settings”, turn off the wide glyphs options under “Display”.
Buy TextMate if you haven’t already. It’s really good.
in ~/.muttrc
:
set editor="mate -w"
To look up addresses, use the Find Email Address in Address Book command, written by Brett Terpstra and me.
Download and double click it to install. Type part of a name in TextMate and hit ⌃⇧⌘A.
mailto
linksMailtoMutt is a simple program that runs Mutt when you click on a mailto
URL. It leaves a Terminal window and itself running after you send the message. Ugly, but it’s better than nothing.
Configure MailtoMutt as the default app for mailto
links using RCDefaultApp.
⌥⌫ deletes tracks directly from a playlist. I can’t believe I didn’t know about this before… going to the regular library just to delete music was super annoying.
You can retrieve keychain items using security(1)
. On my old PowerBook, I was using
$ security find-internet-password -s mail.antiflux.org -r imap \
-g 2>&1 >/dev/null | cut -d\" -f2
On my new MacBook that stopped working. Debugging it was a little annoying because security
only returns the first match. I thought it was something specific to the imap protocol… maybe Mail.app had to do some magic first.
Eventually I changed the server name to “mail2” so I could see what it was returning. It turns out that the protocol isn’t a regular string at all. It’s more like a four-character creator code, stored as an int. And on an Intel chip it’s reversed: pami
.
security
seems to have all kinds of endian trouble:
$ security find-internet-password -r pami -s mail.antiflux.org
keychain: "/Users/grant/Library/Keychains/login.keychain"
class: "teni"
attributes:
0x07000000 <blob>="mail.antiflux.org"
0x08000000 <blob>=<NULL>
"tcca"<blob>="grant"
"pyta"<blob>="dflt"
"tadc"<timedate>=0x32303036313130323136313732305A00 "20061102161720Z\000"
"rtrc"<uint32>="lpaa"
"isuc"<sint32>=<NULL>
"csed"<blob>=<NULL>
"tmci"<blob>=<NULL>
"ivni"<sint32>=<NULL>
"tadm"<timedate>=0x32303036313130333137353535305A00 "20061103175550Z\000"
"agen"<sint32>=<NULL>
"htap"<blob>=<NULL>
"trop"<uint32>=0x00000000
"torp"<blob>=<NULL>
"lctp"<uint32>="pami"
"prcs"<sint32>=<NULL>
"nmds"<blob>=<NULL>
"rvrs"<blob>="mail.antiflux.org"
"epyt"<uint32>=<NULL>
New command:
$ security find-internet-password -s mail.antiflux.org -r pami \
-g 2>&1 >/dev/null | cut -d\" -f2
Sometimes my Tibook thinks it still has an external display attached and that it should blank the main screen. Putting it to sleep and waking it up doesn’t work. Attaching another external display does, but I don’t always have one handy.
Clicking on “Detect Displays” in the Displays control panel works, but that’s hard to do in the dark. For future reference: ⌘-space [Quicksilver], dis↩ [open Displays], ⇥, right, [pause], left, ⇥, ⇥, ⇥, space.
gqlplus is a wrapper for Oracle’s sqlplus which provides table name tab-completion and a shell history.
Update 2007-01-18: gqlplus 1.12, released on 2006-12-02, includes the following changes and compiles easily.
To make it work on OS X (using the Oracle Instant Client) I had to patch gqlplus.c
to pass through the environment variables DYLD_LIBRARY_PATH
and ORACLE_PATH
.
$ patch <<END
--- gqlplus.c.orig 2006-09-19 14:40:12.000000000 -0600
+++ gqlplus.c 2006-10-02 16:47:00.000000000 -0600
@@ -383,6 +383,8 @@
#define NLS_COMP "NLS_COMP"
#define NLS_SORT "NLS_SORT"
#define LD_LIBRARY_PATH "LD_LIBRARY_PATH"
+#define DYLD_LIBRARY_PATH "DYLD_LIBRARY_PATH"
+#define ORACLE_PATH "ORACLE_PATH"
#define PATH "PATH"
#define TERM "TERM"
#define SPACETAB " \t"
@@ -1183,6 +1185,8 @@
enx[idx++] = get_env(NLS_SORT);
enx[idx++] = get_env(LD_LIBRARY_PATH);
enx[idx++] = get_env(TWO_TASK);
+ enx[idx++] = get_env(DYLD_LIBRARY_PATH);
+ enx[idx++] = get_env(ORACLE_PATH);
return enx;
}
END
gqlplus includes its own copy of readline, which by default tries to build a shared library of itself. That failed miserably, so I turned it off. The easiest way is to pass --disable-shared
to the gqlplus configure
script, which will pass it on to readline’s configure
.
$ ./configure --disabled-shared
$ make
gqlplus
should now work just like sqlplus
for connecting to a database.
Before OS X 10.4, I used uControl to remap caps lock to control. I also remapped the mostly useless enter key (on my Tibook, it’s to the left of the space bar) to command. 10.4 added built-in caps lock remapping, and uControl is no longer maintained. Enter went back to being useless, except in TextMate.
DoubleCommand has been around for years, but I just recently found out about it (i.e., bothered to search for it). Now I’ve got my right command key (closed apple?) back. It’s very handy for going back in a web browser, since it’s close to the arrow keys.
Two things I wish they’d fix:
Trusted wireless networks. “No trusted networks can be found. Would you like to join [network that’s already trusted]?”
Preview’s window fit button (or whatever the “+” button is called). It expands horizontally fine, but always shrinks up as though I had the standard fat dock at the bottom. Remembering the zoom setting for each document would be great, too.
If the “Open With” context menu lists applications multiple times (I had three each of VLC, MPlayer OS X, and RealPlayer), you can rebuild the LaunchServices database with lsregister:
/System/Library/Frameworks/ApplicationServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
After Software Update installed QuickTime 7.1, movies embedded in web pages stopped working. Instead, I saw a black box with the label “(no picture)”.
Removing VLC Plugin.plugin
from /Library/Internet Plug-Ins
fixed the problem.
The new version of SafariStand adds OmniWeb-style graphical, rearrangeable, tabs in a sidebar. It also has a (somewhat clunky) interface for per-site settings, such as font size and pop-up blocking. OmniWeb does that automatically. I’m not sure why Safari thinks that if I up the font size on a site, I want all pages in that tab rather than on that site to be big.
spooky$ ioreg -lw0 | grep Capacity | head -1 | \
perl -F',' -lane 's/.*{|}.*//,print for @F'
"Capacity"=932
"Amperage"=0
"Cycle Count"=590
"Current"=932
"Voltage"=16463
"Flags"=838860805
"AbsoluteMaxCapacity"=3600
No wonder my battery doesn’t last very long. Time to start saving for a new one.
Virtue is another virtual desktop system for OS X. It’s based on Desktop Manager, and works mostly the same. The biggest new feature is automatic switching to the desktop of the focused application… very nice.
Apple’s Address Book comes with a context menu item to open an address in Mapquest. I found a script today for using Google Maps instead. Copy Google Map of.scpt
to ~/Library/Address Book Plug-Ins
.
New hard drive! Hooraj! And the first re-install of OS X in a long, long time.
I backed up most of my home directory but decided to re-install my applications. Why? I don’t know.
Essential applications:
* Quicksilver: my computer felt broken without this.
* uControl: Caps Lock to Control, Enter (to the right of my space bar) to Command, scrollwheel emulation with Function + touchpad.
The uControl installer checks for specific versions of IOHIDFamily. OS X 10.3.6 has version 1.3.5, newer than uControl 1.4.4). Adding it to uControl1.4.4.pkg/Contents/Resources/InstallationCheck
fixes the installer.
* Desktop Manager: virtual desktops for OS X.
* BitTorrent
* SSHKeychain
* MPlayerOSX
* Shrook: for RSS and Atom feeds.
* Growl: Little notification bubbles that show stuff like the current song in iTunes.
* MenuCalendarClock: the new version of CalendarClock. There’s a pay version now, but the free version still does everything I want. And now Sundays aren’t red.
Saft is a plugin for Safari that adds a lot of features. The most important to me were
Saft is unfortunately nagware. A dialog box appears when Safari starts and then periodically after that. The period seemed to be about five minutes. It was so annoying I deleted it within an hour, despite loving the features. Maybe this will motivate me to learn how to write my own InputManager.
More satisfying is I-Search Plugin, which adds Emacs-style (C-s, C-r) incremental searching to any NSTextView (i.e., most os10 apps).
Calendarclock lets you have the date as well as the time on your menu bar. You can choose from a list of presets or make your own with strftime(3) formats.
Clicking on the clock makes a little calendar drop down.
It includes iCal events, which is great since I rarely remember to check iCal.
When I switched to OS X, it took me a long time to get used to not having virtual desktops. Eventually having a big pile of windows seemed normal. I used Cmd-Tab, the Dock, and Exposé, and it worked well enough.
As soon as I installed Desktop Manager I was sold on it. There are some glitches—mostly related to off-screen windows having the focus—but nothing that seriously gets in the way. It’s GPL’d, too, which is a treat in the Mac culture of shareware everything.
My menu bar is getting crowded.
I just hit Cmd-Q by accident in Safari again. With a lot of tabs open.
defaults write com.apple.Safari NSUserKeyEquivalents -dict-add "Quit Safari" "nil"
Even better would be if Safari remembered the pages you had open when it quit or (especially) crashed. Galeon did that for me years ago.
It’s great that Safari (and every other sane web browser) blocks pop-ups. It’s not so great that Command-K toggles the blocking. I’ve turned it off by accident a number of times, probably when trying to use Command-K in the Finder, where it means “Connect to Server”.
About a month ago I found a hint on how to remove the shortcut:
defaults write com.apple.Safari NSUserKeyEquivalents -dict-add "Block Pop-Up Windows" "nil"
Handy.
I’ve been addicted to LaunchBar for a while now. Quicksilver is the same idea: you hit command-space and then type part of the name of whatever you want to open/find/whatever. So, command-space-t-enter gets me a terminal.
Quicksilver looks nicer than LaunchBar, and with the bevel mode (see image above) it pops up right in the centre of the screen. That makes sense to me, since it’s busy capturing my keystrokes.
Web searches are easy. Bookmarks with quicksilver (instead of the usual %s) in the url (like http://antiflux.org/dictionary?define=quicksilver) will pop up a search dialog, which then opens a new tab in Safari with the result.
Support for browsing iPhoto, iTunes, and Address Book is built in.
It’s still beta for sure, though; it’s crashed twice already.
If you’ve used Unix much you’ll have noticed that programs really don’t agree on the whole backspace and delete thing. Back when I had Debian on my laptop, it generally worked how I expected. OS X’s Terminal isn’t quite so smooth. I decided to finally sort it all out.
If this saves anyone some effort, great. If not, why did I spend all this time writing an unclear explanation of a stupid problem?
I’m using Terminal.app, with $TERM set to xterm-color (in Preferences). “Use option keys as meta key” is checked in Window Settings. That isn’t directly related, but it makes using Emacs a lot nicer. By default, backspace (“delete”) sends ^?
and delete (“forward delete”, “fn-delete”) sends ^[[3~
(escape, open square bracket, three, tilde). You can see what your terminal is producing with this C program:
void main(void) {int c; while(c = getchar()) printf("%d 0x%02X\n", c, c);}
Run stty erase undef
first.
stty has erase = ^?
, the default. That’s ASCII DEL (127 or \177), and it should (ha!) work as backspace everywhere. The terminfo entry for xterm-color (and all the other terminals that Terminal.app emulates) reports the kbs (backspace) capability as ^H
. To match it should be \177
. I could go the other way and use stty erase ^H
, but then C-h wouldn’t run help-command
in Emacs unless I fucked around with .emacs
. Probably curses-based programs (which actually use terminfo, as far as I can tell) will not work properly, but I don’t use any locally. Bash, Emacs, and Vim all do their own thing.
On okcomputer (Debian), I again have erase = ^?
in stty. infocmp reports kbs=^H
and kdch1=\177
. No good. Setting TERM=xterm-debian
fixes that. Now kbs=\177
and kdch1=^[[3~
, which is what Terminal.app is emitting. The only problem is that $TERM
gets passed on if you connect to other systems, and no other system knows what the fuck xterm-debian
is. I might end up making my own xterm
terminfo entry. Sigh.
Software Update had an iPhoto upgrade for me, so I installed it. After that, the iPhoto icon changed to a generic application icon, and launching iPhoto from the dock gave three bounces and then nothing (don’t you love Mac bug reports?).
Disk Utility’s Repair File Permissions fixed the problem, and now iPhoto is happily “upgrading thumbnails”. Why were my permissions wrong in the first place?
I haven't actually used Clutter for its main purpose (making little windows of all your album covers), but it works nicely as a smaller interface to iTunes. Not as small as the mini iTunes window, but it includes album art it grabs from Amazon.
The best part is the album-oriented browser. It puts compilations under “Compilations” in the artist section, rather than spewing them all over the place like iTunes and the iPod do.
If you're feeling all graphical, preman is a script to open manpages in Preview. Based on a hint from macosxhints.