Mac OS X tips

A couple of things got me stumped when migrating to Mac, so I thought I’d just do a small post on them. :)

Backspace won’t work through SSH
Insert export TERM=linux into ~/.profile. I dunno why Apple has decided to be retarded about this, but it REALLY bugged me.
System default encoding isn’t UTF-8
Norwegian input language is, for some reason, not enough. But there was an extended norwegian input locale that actually changed the default encoding to real UTF-8. Again a seemingly stupid default choice from Apple. It’s really about time you put the "Mac Roman" encoding to rest.
iChat can’t connect to MSN
I signed up for a Jabber server with MSN transport, and it works like a charm. :) comes highly recommended for norwegian users. The only downside is that you need to set the display names for the contacts manually. I just set the right address book vcard for my contacts.
I want pretty colors in the terminal
The OS X terminal is color-challenged by default. Add the following to ~/.profile:



Finder leaves .DS_Store files all over the place on remote servers.
Just do a defaults write DSDontWriteNetworkStores true from the terminal and reboot.
Mediacenters and home servers should never go to sleep
My mediacenter would go to sleep if I wasn’t careful enough with the play button on the Apple Remote. And when I woke it up again, it wouldn’t always reconnect to the WLAN. sudo pmset -a disablesleep 1 solved it. Sleep is now 100% disabled.
OS X has completely broken support for pageup/pagedown/home/end
The default behaviour for these keys are completely useless out of the box. Fix them by saving this to ~/Library/KeyBindings/DefaultKeyBinding.dict :

    "\UF729"  = "moveToBeginningOfLine:";
    "$\UF729" = "moveToBeginningOfLineAndModifySelection:";
    "\UF72B"  = "moveToEndOfLine:";
    "$\UF72B" = "moveToEndOfLineAndModifySelection:";
    "\UF72C"  = "pageUp:";
    "\UF72D"  = "pageDown:";


Proxy settings doesn’t work for command line tools
Ryan Tomayko had a partial solution for this, which I’ve adapted slightly. Add this to ~/.profile :

netloc=$(/usr/sbin/scselect 2>&1 | egrep '^ \* ' | sed 's:.*(\(.*\)):\1:')
http_proxy=$(egrep "$netloc[ \t]*=" /etc/http_proxy | sed 's/.*=[ \t]*\(.*\)/\1/')
if [ -n "$http_proxy" ]; then
  export http_proxy="$http_proxy"
  export HTTP_PROXY="$http_proxy"
  unset http_proxy
  unset HTTP_PROXY

Then add this in /etc/sudoers (needs sudo), right at then end of the lines starting with “Defaults”:

Defaults	env_keep += "ALL_PROXY http_proxy HTTP_PROXY"

From now on, all new terminals will use the proxy setting of the network location that was active when the terminal was started.

Leave a Reply