Tuesday, May 25, 2010

Linuxization of Mac OS

So I've been working in Mac OS as an experiment for a bit over a week. I'm VERY used to working in fedora as I've been doing that for about 5 years. The following tweaks are the result of hating some of the Mac OS defaults.

1. Using a black background in my xterms.
First of all, the lack of mouse passthrough for vim in Terminal.app means it's a non-starter for me. Here's what my ~/.Xresources file looks like:
XTerm*background: black
XTerm*foreground: white
XTerm*scrollBar: false
XTerm*utf8: 1

xterm*saveLines: 10000
xterm*jumpScroll: true
XTerm*scrollBar: false

xterm*visualBell: true
xterm*loginShell: true
Some of those options are on by default but I included them for posterity.

2. Environment fixes for black terminals and XTerm titles
The defaults really stink for a dark background terminal and the default static title of 'xterm' is not terribly useful. Here are the interesting parts of my .profile and .bashrc.

.profile:
. ~/.bashrc

.bashrc:
#Mac OS colors
alias ls="ls -G"
export LSCOLORS='DxGxfxfxcxDxDxhbhDecec'

# Xterm Titles in mac os
# are we an interactive shell?
if [ "$PS1" ]; then
 case $TERM in
  xterm*)
   if [ -e /etc/sysconfig/bash-prompt-xterm ]; then
   PROMPT_COMMAND=/etc/sysconfig/bash-prompt-xterm
   else
   PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\007"'
   fi
   ;;
  screen)
   if [ -e /etc/sysconfig/bash-prompt-screen ]; then
   PROMPT_COMMAND=/etc/sysconfig/bash-prompt-screen
   else
   PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/#$HOME/~}\033\\"'
   fi
   ;;
  *)
   [ -e /etc/sysconfig/bash-prompt-default ] && PROMPT_COMMAND=/etc/sysconfig/bash-prompt-default
   ;;
 esac
fi

I also highly recommend MacVim (http://code.google.com/p/macvim/). I've got the latest snapshot installed and it works incredibly well. Use 'mvim' to open files from xterm.

I've got a few other personalizations that are just personal preference that I'll have to toss on here later.

Wednesday, May 19, 2010

Sound, Encryption (LUKS), Wireless on a macbookpro6,1 in Fedora 12

I've got sound, LUKS, and wireless working on my macbookpro6,1 in Fedora 12 now!

Sound:
Create a file in /etc/modprobe.d named sound.conf with the following contents.
options snd-hda-intel model=mbp55

That'll get sound working over your external speakers. Fire up `alsamixer -c0`.
Unmute and turn up the volume on all the surround mixers to get your internal speakers to work. You can automate this on boot until the kinks are worked out.

Encryption:
You can set up boot time encryption during install but the system won't boot without a change to the kernel parameters. My understanding is there's a problem with the kernel code that talks to the hardware encryption chips. Add the following to the end of your kernel params at boot time after install and also in /etc/grub.conf.
rdblacklist=aesni-intel

Wireless:
Enable rpmfusion (you'll need it for mp3s, aac anyway): http://rpmfusion.org/Configuration

Install with the following:
yum install kmod-wl

Reboot and you'll see NetworkManager pick up the changes.