Since October 31st, around 9:45am, I’m the proudly owner of a new macbook! So again I’m quitting linux, not really, but for a notebook apple is the only one that delivers a truly “notebook-experience”, IMHO. I could not do without the close-the-lid-and-leave thing, the unix feeling, and my terminal,but it took me some days to tweak this things to feel back at home, and just as a reminder for myself I’m going to write down some little tips.

Suspension, safe sleep and deep sleep:

That’s the thing I love most from mac: how fast is to suspend and de-suspend. But, I’ve noticed that the led which indicates when the notebook is suspended, takes quite long to start pulsing. Actually, it is not safe to move the notebook until the led starts pulsing so… why? with my old G4 mac the led started almost instantly pulsing meaning that you could safely pick the notebook up and leave. Well the reason is that apple has switched to “SafeSleep” since intel notebooks, and basically means that it will store the memory content to the hard disk just in case you run out of battery.

I can not simply run out of battery, I’m always near a plug, and it doesn’t take more than few hours until I use the notebook again… so there must be some way to use the not-so-safe-sleep-but-much-quicker. I searched a bit, and found this:

http://www.macworld.com/article/53471/2006/10/sleepmode.html
http://kimklai.blogspot.com/2007/11/hibernate-on-osx.html
http://www.radiotope.com/content/os-x-105-leopard-hibernate-options
http://installingcats.com/tag/safe-sleep/

The quick answer is you can turn off safeSleep with:

sudo pmset -a hibernatemode 0
And then take rid of the sleep image
sudo rm /var/vm/sleepimage

But there is a better way and is a little dashboard widget that does the same thing, allows you to change and perform a deep sleep on demand (deep sleep means store the memory state to the hard disk and shut down the machine completely, so no battery is used at all).

http://deepsleep.free.fr/

Disable space switching on command-tab:

That annoys me, when I’m working on a space I don’t want to be switched to another when changing the application focus. This is straightforward:
http://www.macosxhints.com/article.php?story=2008021122525348

defaults write com.apple.Dock workspaces-auto-swoosh -bool NO
killall Dock

To reset settings:

defaults delete com.apple.Dock workspaces-auto-swoosh

About Software

Good software for your mac:

  • MacVim : beautiful graphical vim
  • macports: Why ports and not fink? basically if you want the good stuff from fink you will end up compiling, so… why do not start from the beginning ?
  • iSerialReader : … no comments …
  • TED and Transmision : great for watching TV shows… in English of course (this two are platform independent, not just for mac)
  • Adium: far better than iChat… and also works great with Bonjour.
  • vmware fusion: … not free software, but works great to run a windows when you need it, or a Linux
  • QuickSilver: No, this one is no longer needed, for me Spotlight is now better than quicksilver for just launching applications.

About the Terminal and screen

I spend most of the time working with terminal and vim, so the first I’ve done is change the colors to a much better white over black background, but most of the colors work better with a white background by default, so now the problem is how to change that. I’ve added this to the “~/.bash_profile”:

alias gvim="open -a macvim"
export SVN_EDITOR=`which vim`

alias ls="ls -G"
export LSCOLORS="gxfxcxdxbxgegdabaeacad"

if [ -f /opt/local/etc/bash_completion ]; then
	. /opt/local/etc/bash_completion
fi

if [ -f $HOME/.profile ]; then
	. $HOME/.profile
fi

alias screen='SCREEN_PWD=$(pwd) /usr/bin/screen'

case "$TERM" in
	xterm-color)
		PS1='\[\033[01;32m\]\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \u\$ '
		;;
	screen )
		PS1="\[\033[01;33m\]${STY%%.*}-${WINDOW}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] \u\$ ";
		cd "$SCREEN_PWD";
		;;
	*)
		PS1='\h:\w \u\$ '
		;;
esac

Here I’ve tweaked the color of the “ls” output to be more readable with black background, and also changed the prompt to have colors and give more info. There are some lines to make the screen command ( if you don’t know what screen is for, you’re missing a really good program here) work better, you will also need to add this to the “~/.screenrc”

startup_message off
shell -/bin/bash

When screen is launched the prompt will change, it will show in yellow something like “5867-0:/opt/local pplux$” the first number is the PID of the current screen instance, that could help you if you run more than one because writing “screen -ls” will show the list of instances identified by its PID. The number after the stroke is the window number inside screen.

And that’s all… :)