Wednesday 31 October 2012

Ubuntu on a MacBook Pro

This are the steps I followed to get Ubuntu running on a MacBook Pro 9,2.

Install

Note: this procedure requires an .img file that you will be required to create from the .iso file you download.

TIP: Drag and Drop a file from Finder to Terminal to 'paste' the full path without typing and risking type errors.
  • Download the desired file
  • Open the Terminal (in /Applications/Utilities/ or query Terminal in Spotlight)
  • Convert the .iso file to .img using the convert option of hdiutil
hdiutil convert -format UDRW -o ~/path/to/target.img ~/path/to/ubuntu.iso
Note: OS X tends to put the .dmg ending on the output file automatically.

Create a bootable Ubuntu install flash drive:
Run:
diskutil list
to get the current list of devices

Insert your flash media and run:
diskutil list
again and determine the device node assigned to your flash media (e.g. /dev/disk2)
Run:
diskutil unmountDisk /dev/diskN
(replace N with the disk number from the last command; in the previous example, N would be 2)

Execute
sudo dd if=/path/to/downloaded.img of=/dev/diskN bs=1m
(replace /path/to/downloaded.img with the path where the image file is located; for example, ./ubuntu.img or ./ubuntu.dmg).
Using /dev/rdisk instead of /dev/disk may be faster.

If you see the error dd: Invalid number '1m', you are using GNU dd. Use the same command but replace bs=1m with bs=1M.

If you see the error dd: /dev/diskN: Resource busy, make sure the disk is not in use. Start the Disk Utility.app and unmount (don't eject) the drive.

Finally run:
diskutil eject /dev/diskN
and remove your flash media when the command completes

Restart your Mac and press alt while the Mac is restarting to choose the USB-Stick

Follow the on screen instructions.

WiFi

After booting into Ubuntu, the wifi card was not working, to get it to work I connected it to my router with a network cable and followed this steps:

Download the driver:
wget http://www.lwfinger.com/b43-firmware/broadcom-wl-5.100.138.tar.bz2
And install it:
tar xf broadcom-wl-5.100.138.tar.bz2
sudo apt-get install b43-fwcutter
sudo b43-fwcutter -w "/lib/firmware" broadcom-wl-5.100.138/linux/wl_apsta.o
then add:
b43
to /etc/modules and reboot

Keyboard and mouse:

This is a little extra to get natural scrolling and OS X like key bindings.

Create a Xmodmap conf file
vi ~/.Xmodmap
and paste the following inside:
!!Enable Natural scrolling (vertical and horizontal)
pointer = 1 2 3 5 4 7 6 8 9 10 11 12
!!Swap CMD and CTRL keys
remove control = Control_L
remove mod4 = Super_L Super_R
keysym Control_L = Super_L
keysym Super_L = Control_L
keysym Super_R = Control_L
add control = Control_L Control_R
add mod4 = Super_L Super_R
Under Mac OS X, the combination cmd+space opens Spotlight, to emulate this, install the package compizconfig-settings-manager.
sudo aptitude install compizconfig-settings-manager
Open it using the ccsm command, or search for it in Dash.
Find Ubuntu Unity Plugin->Behavior->Key to show the launcher and change it to <Primary>space, using the Grab key combination button. It may be also shown as <Control><Primary>space.

You can now have a behavior similar to Mac OS X in Ubuntu 12.04. You can change the virtual desktop using cmd+alt+arrow. You can cut, copy, and paste using cmd+x, cmd+c, and cmd+v and summon the dash with cmd+space.

Possibly Related Posts

1 comment:

  1. With some modifications I managed to install in a 2006 Mac Mini! Thanks for the tips on converting the iso and using a usb drive.

    ReplyDelete