Introduction

This document serves the Apple MacBook in both hardware support and installation of Gentoo GNU/Linux. Any questions not answered here can be discussed on the MacBook thread in the official Gentoo Forums or visit us in #mactel-linux on irc.oftc.net. Also check out the Links section of this page for some additional resources. MacPro users should use the MacPro wiki for more detailed information.

Note: The MacBook wiki has information provided by good number of seasoned Linux users, please add or subtract information only if it is known. Unsure topics or details should be discussed on the Talk page.

Subpages

Basic Installation

The MacBook marked the introduction of a processor shift by Apple from Motorola/IBM's PowerPC family to Intel x86 family. While the move to Intel has simplified some parts of installing Gentoo, proprietary hardware and software can make it a bit more complex than a typical x86 GNU/Linux install.

Preparing the Disk

In the early part of 2006, Apple created a hybrid partitioning scheme that allows Intel-based Macs to boot OS X with other operating systems. It is a unique partitioning scheme that implements Intel's EFI standard. The scheme includes support for GPT partitioning as well as legacy MBR for use with Windows. It does this by emulating the BIOS. For the moment, the only tool that can edit this partitioning scheme is Apple's diskutil (BootCamp also uses this program).

You can use standard MBR partitioning and be able to install Linux and Windows, but the Mac OS X 10.4.6 and before will not allow an install to an MBR partitioning scheme.

You will also need a bootloader to choose your OS at boot. rEFIt has a graphical loader, supports multiple file systems and includes a shell to help with editing. Optionally, BootCamp can install a bootloader.

Creating a Partition Map

There were two ways to partition a MacBook to install Gentoo GNU/Linux, use (diskutil) to partition on a pre-installed EFI-GPT scheme, or use third party utilities and partition with the MBR standard. Parted and gparted have proved to be reliable to many users.

Using diskutil

diskutil is included with Mac 10.4.6 or higher. It must be noted, that GPT partition standard only allows a maximum of four partitions to be created. The first partition is an EFI partition (an unseen partition) located at the first 200MB on a MacBook hard disk. With the GPT scheme this leaves only three partitions to work with. diskutil is used from the command line or can be used with BootCamp with limited ability.

Note: diskutil only is able to create primary/logical partitions hence the 4 partition GPT limit. It is possible to have a 7 partition system running smoothly with bootcamp using GPT, see the Alternate Partitioning Method 2 for details.

In OS X open the terminal application and type this to see your current partitioning scheme:

The disk is already partitioned, notice the EFI partition here. Locate the "identifier" of your Mac OS X partition. This partition will be divided to create a partition(s) for the Linux install.

In this instance the partition is disk0s2.

In the example below, the disk is repartitioned from a 80GB partition to contain a 32GB OS X partition, 21GB Linux partition and 21GB Windows partition. The volume sizes and names can be changed but keep the order. This example includes a Windows partition. Note, a full Mac OS X Tiger (10.4.8) requires ~30GB of space.

Note: Mac OSX 10.5 (aka Leopard) provide a different version of diskutil and it seems to not allow you creating a Linux Partition Type! Just create FAT32 partitions, boot linux from CD and change to ext3/xfs/reisersf using parted. Reboot and sync partition table using rEFIt.

Using BootCamp

If you are planning to use Boot Camp (best for new Mac OS X users) get it here. When you run BootCamp, create a Windows Drivers CD if you plan a Windows XP or Vista install. BootCamp simplifies the entire process. It will walk you through not only how to resize the Mac OS X partition, but also install a bootloader.

Partitioning using a 3rd Party Tool (Deprecated)

Warning: This may not be wise to delete your GPT partition as OS X expects it to be there.

If you ever need to do firmwire updates or reinstall/upgrade OS X, it might mess things up.

Install OS X normally

Clone or make a tarball of OS X and move it to an external disk.

Boot Ubuntu LiveCD - repartition the disk as MS-DOS/MBR (NO GPT):

- OS X HFS+

- Windows NTFS

- Ubuntu EXT3

- Extended

- Home (Ubuntu) EXT3

- Swap swap

- Storage - no filesystem yet (will be FAT32 for compatibility)

Install Windows first to partition 2

Install Ubuntu to partition 3

Boot to Ubuntu and copy your OS X system to partition 1

Now reinstall GRUB to the disk's MBR - Do update-grub to update your menu.lst

Another method:

If you won't be using Mac OS X at all, you may get away without messing around with GPT and all the rest, which is probably the easiest way, especially if you have a PC background. You should install rEFIt or Bootcamp though; this will give your machine the ability to boot directly from a hard drive that has a "legacy" BIOS partition table on it.

Install the Bootloader and press "C" (or Alt) so that you boot from your Linux cdrom.

Now, replace GPT by a good, old-fashioned, BIOS partition table. In order to get rid of the GPT layout, you may either:

Zero out the first and the last few sectors of the hard drive (ie, using dd if=/dev/zero ...)

Use the "mklabel" command of parted to create a new "MSDOS" table

You may now wish to reboot (still from your Linux cdrom) to confirm that GPT is gone, and after that you can proceed normally, as you would do on a regular PC.

Gparted

Using gparted is by far the easiest and most reliable way, now that parted and gparted support GPT/MBR.

Just boot up with a linux live cd (tested the live ubuntu 7.10 cd with 4th gen. macbook with leopard), and use gparted to resize your HFS+ partition and add whatever partitions you like. Note: gparted crashes after succesfully creating the partitions, but it is nothing to worry about. Then install Gentoo normally. When you reboot, be sure to hold down alt/option and you will get the option of booting into OS X or "Windows"-> really Gentoo.
(Note: I used an ext2 boot partition). If you do not want to hold down alt/option on every boot or if you are using reiserfs, etc.., install rEFIt.

If you can't edit your HFS+ partition because gparted says that the data cannot be read, try disabling the journal under Mac OS X with this command:

Installing a Bootloader

It is best to install and configure rEFIt in OS X. Trying to install rEFIt after installing a Linux bootloader can cause problems.

rEFIt / Linux-Only

Since rEFIt does not require the presence of OSX to function, one can remove osx, repartition the disk to have a 512MB(or something like that) HFS+ partition to install rEFIt, and the rest of the disk can be used for Linux.

To do that:

Hold down 't' while booting MacBook to go into target-disk mode.

Connect MacBook into another OSX machine

Repartition MacBook's disk to have a very small HFS+ partition

Install rEFIt onto that partition

Run enable-always.sh to always enable rEFIt.

Carry on with the rest of this wiki to partition the rest of the disk in Gentoo

Note: Since there is no longer an OSX installation on the Laptop, one would have to boot into OSX from an external disk(or swap the hard drive) to run firmware upgrades.

Choosing a CD

First Generation MacBooks will need to use the i686 CD. Second Generation MacBooks feature the Core2 Duo which can emulate the 64bit instruction set.

The Core2Duo is a processor that uses the IA-32 microarchitecture with EM64T extension. That makes it similar to an AMD Athlon 64 processor. Although it is not a true 64 bit processor (not IA-64 microarchitecture) it can process the 64bit instruction set and features the 64bit address register extensions and general purpose registers. That means you can choose to run a traditional 32bit x86 or an x86-64 system. An x86-64 system is capable of running 32bit and 64bit applications. The 64bit applications can use 4GB address space per process (2GB in x86).

People having used the 64bit systems claim overall speed increases. It's caveat however is that some drivers and applications are 32bit only and sometimes 32-bit emulation doesn't work. If you wish to have a 64bit system use the AMD64 CD, use the i686 CD for a 32bit system.

Note: The stage3 tarball must also match the system.

Note: 2007.0 Minimal install runs 2.6.19 and does not support the rev 3 santa rosa macbook pro's wireless or wired network. sabayon 3.4f supports both wired and wireless on the rev3 macbook pro. small-gentoo for amd64-r8 does support wired network as well and is gentoo based and has gparted

Filesystems

Once you've booted into the Gentoo Live CD, follow the Gentoo Handbook on file system creation with the following in mind:

Partioning and resyncing

Use parted instead of fdisk to create your Gentoo partitions. Reboot and use the rEFIt partitioning tool to resync your partition tables. Then proceed with the installation as per the Handbook (this applies at least to some MacBooks 2nd generation).

Swap

Swap is the physical memory overflow file saved to the hard disk. If more memory is required than that of your physical (RAM) memory, then memory is saved to disk.

Comparatively Linux consumes much less memory than OSX, so unless you will be using memory intensive programs a swap may not be necessary.

It's possible to have a swap file rather than having swap reside in a separate partition. To do that:

This creates a 2G swap in a file called '/swap' (count=2097152 is 2G). You may name it whatever you wish and give it whatever size you wish.

If you want a different sized swap then substitute "2097152" one of these values:

512MB = 524288
1Gb = 1048576
1.5GB = 1572864

Notes:

I have 512MB of RAM on my 6 year old Dell Inspiron 8000 that almost NEVER uses swap with Gentoo.

I now have a 2GB of RAM MacBook so I'm not going bother with a swap partition. There is a good chance that it will never be used.

Forgoing swap is not a good idea. Long compiles have hardlocked my system (both processors in stuck in IOWAIT) if there is no swap. If you are really streched for space, make a 256 or 512 MB swapfile, but don't just leave it out. --jimmers

Reiserfs

Reiser file system (sometimes call Reiser3) is a file system introduced to the kernel in 2001. It's contains better disk storage for smaller files and improved journaling over ext3, though ext3 is considered more tried and true. rEFI includes support for it (Visit rEFIt myths for more information). The kernel configuration file includes Reiserfs support.

Reiser4 filesystem is still considered unsafe by most users and not recommended as of this writing. -- 05-05-2007

XFS

XFS is (along with JFS) among the oldest journaling file systems available for UNIX systems, and has a mature, stable and well-debugged codebase. It is fast and solid.
It has many advanced features such as xfs_fsr which improves the organization of mounted filesystems and 64 bit support.
It is highly recommended and fully supported in current gentoo-sources kernel.

The fstab File

Preparing the System

At this point, things mostly progress the same as the Gentoo Handbook, starting with creating the filesystems.
Almost all questions that you will encounter during the installation ("which kernel", "kernel config", "how to do this or that") are answered on this wiki-page. Be aware that some of the instructions
on this page may not be in the same order in that you will encounter them during the installation. So I suggest that you read ahead a bit to avoid unwelcome surprises. Also Notes have been added to sections where users were kind enough to put in input of their personal experiences.

make.conf

The appropriate make.conf depends on whether you have a CD or C2D processor.

Some have opined that,

"The single most important thing you can do to having a successful Gentoo built is providing as complete a make.conf as possible."

The make.conf is the preferences file for compiling. What you put in it and how you set it up is a fundamental part to how well the system will run.

Downloading the Kernel

Fill in the appropriate version below: Removing the equals sign and version will install the latest version.

emerge =vanilla-sources-(version)

or

emerge =gentoo-sources-(version)

The MacTel Kernel Patches

As the development of the kernel for Intel-Mac related items improve, there will be less and less a need for the mactel-patches. As of 2.6.22 several mactel patches are already a part of the kernel (SMC, Appletouch, and Temperature Sensor).

The Mactel kernel patches are designed to work with the vanilla kernel and may or may not be compatible with the Gentoo kernel version (gentoo-sources). Kernel patches are not required for most kernels versions but provide added functionality and fix known errors. Examples are temperature sensors, trackpad control, minor audio tweaks, USB IR receiver, keyboard backlight control.

Get the svn tool.

emerge subversion

Download the appropriate mactel-patchset and apply it to the kernel source:

MacBook Configuration Files

Modules Autoload

With many newer drivers make their presence known to udev and it may not be necessary to put modules /etc/modules.autoload.d/kernel-2.6 anymore. However it doesn't hurt to place them in either:

nano /etc/modules.autoload.d/kernel-2.6

and add these and whatever others you need. (you can always remove them later.)

appletouch
usbhid

Only on NEW Macbooks manufactured after Nov 2007

The newer Models include a Marvell Network Controller that seems to be not supported by the Kernel. (See lspci section for more info) Goto [2], download the driver and follow the README to get it working.

Note: Support for the network card has been added in the 2.6.23-R3 Kernel. Just build 'SysKonnect Yukon2' into the kernel and all is well.

Congratulations!

You should now have a working kernel installed.

If you experience any problems please report them in the forum so we can fix the instructions!

Some additional kernel patches may be required for some advanced features (e.g. suspend to ram/disk). You can find information about that in the corresponding sections of this wiki-page.

Configuring the Linux Bootloader

GRUB is the most used choice for MacBook users but LILO can be used as well. It's recommended that you use Grub 0.97-3 or later as this has support for hybrid GPT/MDR partition maps. For instructions on installing the bootloader, see the Gentoo Handbook.

Note: If you create multiple entries in the boot loader, a bug present in the firmware on MacBook Pro rev2 systems prevents the keyboard from working reliably. Unless Apple repairs the bug the only known workaround is to plug in an external USB keyboard and use it to select the alternate boot images.

Lilo

Checking the New System Out

Test that this kernel runs and boots properly on your MacBook before you make any more changes.

rEFIt (or BootCamp) should now be able to recognize you Linux system and load the Linux bootloader at startup. Hopefully at this time you have a functional and running system.

Notes:

If you have not installed rEFIt (or BootCamp) before the Linux install, these instructions may help you.

If you get a "No bootable device" error, select the partitioning tool from the rEFIt menu and update the MBR. This syncs the partition tables between the GPT and MBR loaders.

Upon reboot, if your display is giving you odd colors, you may need to reset your PRAM/NVRAM. To do this, hold down cmd+opt+p+r before your computer starts up and wait until you hear the second Mac startup sound. (I had to do this upon rebooting from the Gentoo 2008.0 Minimal Installation CD on a 1st Generation Macbook Pro.)

Building the Desktop

Now that the base system working we can build a desktop.

Installing the Desktop

MacBooks

MacBooks (first and second generation) use the Intel GMA 950 graphics processor with 64MB of DDR2 SDRAM shared with main memory. See this HowTo.

MacBook Pro

The first and second generation MacBook Pros use the ATI Mobility Radeon X1600 graphics processor, follow the ATI drivers Wiki. FGLRX (compositing support) works with full hardware acceleration as of gentoo-sources-2.6.21 and ati-drivers-8.37.6.

Third generation MacBook Pros use ...

The Macbook Pro, third generation (3,1 up) uses the Nvidia 8600M GT. See NVIDIA drivers for full instructions.

Configuring Special Keys: brightness, volume...

X server key mapping has worked fine since xorg-server-1.4. Keys should be properly mapped to handle eject, numlock ... In Gnome add gnome-power-manager to add brightness key support. An application call Pommed was used to fill the gap until xorg-server key mapping was integrated. Also pommed can add additionaly functionality.

HAL update bug

kpowersave: WARNING: Property: laptop_panel.brightness_in_hardware for: /org/freedesktop/Hal/devices/macbook_backlight doesn't exist.
kpowersave: ERROR: Could not call/set SetPowerSave on HAL, could be a bug in HAL spec

In between HAL versions hal-0.5.9.1-r3 and hal-0.5.10, a detrimental update was made. According to the HAL Portage Changelog, there are no versions of HAL released in between these two. Versions of HAL greater than hal-0.5.10 are known to not work with a second generation MacBook, but versions at or below hal-0.5.9.1-r3 will work for altering screen brightness. Many versions of HAL were tested for consideration with this problem to determine at what point the bug was introduced. There are at least two bugs on Gentoo Bugzilla related to this problem (#200060 & #211988), as well as Ubuntu bug #206921. According to these sources, the hotkeys of at least MacBooks (Pro), IBM Thinkpads, and HP Pavilion notebooks are affected. Many architectures are also affected (x86, x86_64, amd64...), and clearly multiple Linux distributions.

To resolve the hotkey issue, you may simply downgrade HAL via

emerge =sys-apps/hal-0.5.9.1-r3

After which, it is likely a good idea to reboot. You may instead restart the individual daemons if you like, but HAL controls many other programs, such as NetworkManager, so a system reboot is not a bad idea.

At this point, functions altering screen brightness, such as pommed and kpowersave ought to behave! However, some keys have been remapped in X compared to more recent versions of HAL. It is unknown at this time if a re-emerge of X related packages fixes this HAL downgrade problem.

In HAL versions 0.5.10 and above, we have the following xev keycode associations: 116 - Down Arrow, 134 - Right Apple, 104 - Numberpad Enter. In HAL versions 0.5.9.1-r3 and below, we have the following xev keycode associations: 104 - Down Arrow, 116 - Right Apple, 108 - Numberpad Enter. For now, an easy fix is to alter your ~/.xmodmap appropriately, and then run

xmodmap ~/.xmodmap

pommed

pommed is a small daemon written specifically for MacBook Pros and MacBooks, requires little or no configuration. It includes GUI indicator indicating in brightness, volume, numlock and eject. It also can manage automatic brightness and can be used to personalize the "fn" key behavior and turn the Apple Remote receiver on/off.

Hot keys will not work unless you have enabled the proper driver in your kernel configuration; this works for MacBooks even though you are enabling support for iBook/PowerBook hot keys as well as EVDEV support. In menuconfig:

Device Drivers --> USB Support --> [*] Enable support for iBook/PowerBook special keys

Kernel 2.6.22

Device Drivers --> HID Devices --> [*] Enable support for iBook/PowerBook special keys
It is also necessary to set CONFIG_INPUT_EVDEV=y

If this driver was not already enabled, be sure to recompile your kernel and reboot.

Pommed is in Portage

emerge pommed

Pommed can be configured through /etc/pommed.conf, which is thoroughly commented, then start the daemon:

/etc/init.d/pommed start

The configured keys should work in the console or in X. If you install pommed with USE="gtk", the GUI daemon called gpomme will show popup windows when you press a key handled by pommed.

Colour Profile

The many Linux desktops do not have included support for color management of displays. Some drivers provide this support or you can use the program xcalib. Xcalib uses colour profiles form Mac OS X (ICC profile).

Calibrate a profile in Mac OS X in System Preferences > Displays > Color - use Expert-mode for finer control. The saved profile will be in /Users/<username>/Library/ColorSync/Profiles.

As of version 0.6-r1 gamma wasn't working right. After calibrating with PC gamma (2.2) in Linux would give me a very dark look, while Mac gamma 1.8 would be a tad light. Using a gamma 1.9 to 2.0 worked nice.

Hardware Setup

With a desktop now active, you can finalize your installation by making sure you hardware is setup correctly.

Sound

Sound uses the hda-intel module. This should already be added to the kernel .config if you used the kernel configuration above.
With older Macbooks (before Autumn 2007), by default, sound will "just work", in that ALSA will detect your hardware.
With newer Macbook Pro Santa Rosa (bought during or after Autum 2007), sound will just work, but only with kernels > 2.6.24_rc1 . Previous kernels will give you no sound output.

Sound can be used with a separate Alsa driver or with it build into the kernel. Check your kernel configuration:

Touchpad

The touchpad uses a specialized module (appletouch) to connect with the standard touchpad driver (synaptics). So it can be configured just as any other synaptic touchpad can. See Synaptics Touchpad for more information. A patch has just been added to enable two finger click transforms (e.g. two finger right click). The details for installing can be found at the wiki link just above.

The touchpad control panel offers basic configuration.

emerge gsynaptics

Check to see if gsynaptics-init --sm-disable, to preserve changes between login sessions, is in System > Preferences > Sessions.

Notes:

For Kernels Prior 2.6.20 and versions of gsynaptics < gsynaptics-0.9.10

I had trouble getting my touchpad to work with the emerged version of synaptics, 0.14.5-r1, so I installed the newest version, 0.14.6, from the developers website. Then I replaced the synaptics_drv.so with the newer one (in /usr/lib/xorg/modules/input/), and now everything works great, including scrolling, two-finger touching, etc...

Due to updating xorg you may have to reemerge x11-drivers/xf86-input-mouse to make xorg work with the touchpad.

I only got the touchpad working by setting up the udev-rule you can see at "How to make Synaptics Touchpad survive suspend/resume"

WiFi

Built-in Wireless for MacBooks uses an Atheros chipset or a Broadcom chipset. The chipset in the original Core Duo-based Macbooks is well supported by the MadWifi project. The newer Core 2 Duo-based Macbooks use a different Atheros chipset (supporting draft 802.11n), scroll down if you have a Core 2 Duo MacBook or MacBook Pro.

Installing the driver

For both generations of MacBook, you will need the madwifi drivers (they provide a software driver set for the Atheros chipset). Note that the the Madwifi application dynamically loads extra kernel modules for rate selection. Therefore, be sure that you have the following options enabled in your kernel. Note: This option is the last under Loadable Module Support. I would have sworn I had it in there but I did not. The below snippet made me think just to enable the first two.

Macbooks - 1st Generation

MacBooks made prior to November 2006 use the Atheros chipset with the 802.11g standard.
MacBooks made prior to November 2007 use the Atheros chipset with the 802.11n standard.

For Kernels prior to 2.6.27 see the MadWifi article. 2.6.27 has the Ath9k driver build in which works out of the box.

Macbooks - 2nd-3rd Generation

MacBooks built during and after November 2006 use the Atheros chipset that supports the 802.11n standard.

The open source Atheros made Ath9k driver was introduced in the 2.6.27 kernel series, so this shouldn't be any real issue anymore if you are using an up to date kernel, just make sure you use the following:

If your wireless connection dies after some time (it "seems" connected but it is not, until you reboot), and you see a lot of FIFO buffer overrun in your logs, you've been hit by the buffer overrun bug. Maybe iwpriv ath0 bgscan 0 helps you. See http://madwifi.org/ticket/1017 for reference.

Macbooks - 4th-5th Generation

Until July 2008, the only way to get this card working was using ndiswrapper. This method is often reported as working quite bad (frequent loss of connection, WPA not working...). But in July 2008 Broadcom released new official and almost free drivers (they call it "hybrid") that seem to work very well.

(in my case, that was the only way to get WPA working, it even works with a 64bits kernel without multilib)

First we review the ndiswrapper way, (that should be soon deprecated) and then we show the use of the official broadcom driver (IMHO it should become now the standard way).

Using Ndiswrapper

First of all ensure you emerge the lastest version of ndiswrapper.

echo "net-wireless/ndiswrapper" >> /etc/portage/package.keywords

At the time I'm writing this guide the current version of ndiswrapper is 1.53.

If you want ndiswrapper module to autoload at system startup you can easily do that by letting ndiswrapper to configure its module:

ndiswrapper -m

and than add "ndiswrapper" to the modules' list into /etc/modules.autoload.d/kernel-2.6

echo "ndiswrapper" >> /etc/modules.autoload.d/kernel-2.6

Don't forget to create a symlink for your new interface and make it starting during the boot.

ln -s /etc/init.d/net.lo /etc/init.d/net.wlan0

rc-update add net.wlan0 default

Than you can proceed to setup your network configuration.
There is a plenty of guides about that ;)

Using the official Broadcom driver (DRAFT, FIXME IF NEEDED)

Note: This is supposed to work but your mileage may vary

Note: Notice that as we rely on the kernel sources you should do the following after having compiled, installed your kernel and being running it. An ebuild using gentoo's specifics would be a nice touch.

Depending on your architecture, download the 32bits or 64bits archive at http://www.broadcom.com/support/802.11/linux_sta.php.
Also download the README file. From now on the instructions in the README file should be sufficient.
Briefly said, you just have to compile the driver and then install it.

Compilation

Say you created a directory named "broadcom" in your home directory and downloaded the archive in it, then:

Than you can proceed to setup your network configuration (seen gentoo documentation) or use network-manager.

Feedback

It works perfectly for me (gentoo-sources 2.6.25 r7, 64bits, no-multilib), and even with WPA!

It works nice for me as well (mactel 3.1 according to hal but 4.1 according to this guide, gentoo-sources 2.6.24 r8 + mactel patches, 64bits, multilib), and even with WPA! One little drawback though is that I can't seem to ssh anywere. --EvaSDK

Reported to work on other distributions, please add your config if it works for you too.

Starting Wireless (Manually)

If the Gentoo boot scripts doesn't connect you can connect manually. This will work with modern, non-specialized routers, if additional configuration (wireless extensions) is needed, see the MadWifi Wiki.

iwconfig ath0 essid any
ifconfig ath0 up
dhcpcd ath0

The driver will search for the strongest AP (Access Point) and try to connect to it. If it fails try scanning the AP's and manually entering it:

wlanconfig ath0 list scan
iwconfig ath0 essid "yourAP"

Notes:

USE flag onoe while emergin madwifi is no longer necessary as of madwifi-ng-0.9.3-r3.

System Management Controller

The SMC introduced into the 2.6.22 kernel provides added ability to manage power of the MacBook.

We need to have the proper hardware modules loaded, so enable the following in menuconfig:

Device Drivers -->
Hardware Monitoring Support -->
[M] Apple SMC

Then make sure the computer loads the module when it boots Gentoo. If you edit /etc/modules.autoload.d/kernel-2.6, just add the line:

applesmc

To load it now modprobe it :

modprobe applesmc

This makes some magic files available under /sys/devices/platform/applesmc

Put your fan in manual mode by typing :

echo "1" > /sys/devices/platform/applesmc/fan0_manual

After, you can set the speed of the fan by running :

echo "1200" > /sys/devices/platform/applesmc/fan0_target_speed

Values are ranged from /sys/devices/platform/applesmc/fan0_minimal_speed to /sys/devices/platform/applesmc/fan0_maximal_speed and you can get the safest value in /sys/devices/platform/applesmc/fan0_safe_speed

To restore the fan in automatic mode, just type :

echo "0" > /sys/devices/platform/applesmc/fan0_manual

The keyboard backlight is accessible through the file /sys/class/leds/smc:kbd_backlight/brightness. Brightness values range from 0 (off) to 255 (brightest).

Needs 2.2.10 or later with the lm_sensors USE flag enabled. In gkrellm, check the options in configurations --> builtins --> sensors. Enjoy!

Touchpad Fixes

Toggle Touchpad On/Off When Pluggin in Mouse

If the behavior of th touchpad randomly clicking and moving the cursor while typing is becoming annoying, it can automagically be turned off when you have an usb mouse plugged in through UDEV. Compile the kernel with those options:

It is possible just to use synclient to re-enable the touchpad, but only one rule at a time can be added and it is handy to use syndaemon to enforce a touchpad break while typing. Udev also didn't recognize if statements making just a basic script:

Remote Control

Assigning key values to remote control buttons through xmodmap

The Apple remote control (RC) can work without Lirc; it works out of the box as an extension to the keyboard, and can easily be assigned key values through xmodmap, which is a command that comes with Xorg. Running the command xev, you can find out each RC key keycode; after that, you can bind those keys to keyboard keys.

NOTE: As of the 3rd generation MacBook Pro (Santa Rosa) Apple changed the device ID for the IR receiver. The default mactel patches won't work any more. For kernel 2.6.22 exists a patch (coming from arch-linux) to make it work again: [3]

Using the volume and remote control events in applications with inputlircd

You may want to use the irexec daemon additionally to manage the volume level independant of the media application. To do so you'll want to edit the /etc/lircrc file as below, run "irexec --daemon", and then start mplayer.

Apple Keyboard

The Apple Keyboard is unique from other PC manufactures. The largest difference is function key behavior, as well as mapping of special characters (i.e. non-english).

Enable "normal" FN-key behaviour

Many people don't like the Apple default of "fn-always-on". pommed (see above) has a configuration option to change the fn key behavior, but if you do not use it, changing the behavior is still easy. Just pick your favorite:

I'm using kernel 2.6.21 and functions keys work as expected, e.g., a F1 press will open Help.

Newer 2.6.20 kernels:
A recent patch to 2.6.20-rc kernels moved the pb_fnmode module parameter from usbhid module to the hid module, so you should replace "usbhid" with "hid" above if you are using this (or a later) version.

This .xmodmap file is for the german keyboard layout, the last two lines will probably not apply to other versions. To make the keyboard -> Mouse click mappings work you will need to install a small tool (i could not find in in portage), get it here. When installed run at the beggining of each X-session:

xmodmap <the_file_above>
xkbset exp m
xkbset m

Note: mouse click mappings works without this, because it's X independent (see appropirate section on this page). If you just want to switch keyboard layouts, use setxkbmap. - Turdus, 15-12-2006

Please note that this key-mapping will not make the keyboard work as printed on the keys, but will match a standard german keyboard.
Hints for your own tries: xev (event debugger - lets you see what keycodes are sent), xmodmap and its man-page.

Notes:

As of 06-07 function key still isn't recognized by xev, probably related to the keyboard driver?

Gnome keyboard layout

Bring up the Keyboard Preferences window with System ? Preferences ? Keyboard from the Main menu. Click on the Keyboard Layout Options tab, and find Third level choosers. Mark the right Win key as third level chooser. Now your right Apple key works as Alt Gr.
Restart X (Ctrl+Alt+Backspace) for the changes to take effect.

Map F11 and F12 to mouse button 2 and 3

To use keys for the missing second and third mouse button you need to enable CONFIG_MAC_EMUMOUSEBTN in the kernel .config, located in Device Drivers > Macintosh Device Drivers > if you use the menu, you need the patch to show it on x86 and do the following:

I used the alsa-driver ebuild (version 1.0.13). If you have sound built into your kernel you can also get it working this way too, you just need to edit the files /usr/src/linux/patch_sigmatel.c and /usr/src/linux/sound/pci/hda/patch_sigmatel.c instead of the ones I mention below (and skip the ebuild commands).

Basically we just need to edit the patch_sigmatel.c file to re-map the pins to better suit the macbook. Here's how I did it with the alsa-driver ebuild and portage:

If you are using sound in your kernel, then re-build your kernel now. If you have sound built statically into your kernel you'll need to rebuild your kernel, copy it to /boot and reboot to it. If you're using sound as modules, then you should be able to just run:

cd /usr/src/linux/
make modules modules_install

Once you have emerged the package or rebuilt your kernel update the module deps

update-modules

I think it's a good idea to reboot at this stage, or reload your alsa modules. You could just re-run alsaconf if you like which should do this for you.

When you reboot you should now be able to use your microphone. Remember to toggle the recording device to linein and back to mic if you need to. You can toggle the mic for recording from the command line with:

the Surround volume controls the headphones sound; thus, in order to have sound in your headphones after plugging them into the laptop, you have to unmute the Surround volume and set it higher (you can set it at maximum) (you can use alsamixer for example : type alsamixer in a console, go to the 'Surround' volume with the 'right' and 'left' arrow keys, push the 'm' key until you see 'OO' instead of 'MM' and after that push the 'up' arrow key to set the volume higher)

If sound from the internal speakers still doesn't work, you can try one other change from MactelLinux.com.

depending on which version of the file you have. This change got internal speakers and microphone and headphone detection working on a Core Duo 20" iMac with alsa-drivers-1.0.14_rc1.
The subvendor and subdevice are the upper and lower halves of the Sybsystem ID: cat /proc/asound/card0/codec#0 | grep Subsystem

Built-in iSight

The iSight camera is supported by the Linux USB Video Class driver. Kernel >=2.6.26 includes uvcvideo and the isight firmware loader (firmware must be placed be /lib/firmware). For kernels <2.6.26 you need to install it seperately:

You need at least media-video/linux-uvc-0.1.0_pre173 to for the iSight firmware.

Probably you need to install the firmware first. Get the File System/Library/Extensions/IOUSBFamily.kext/Contents/PlugIns/AppleUSBVideoSupport.kext/Contents/MacOS/AppleUSBVideoSupport from your OS-X partition and copy it to /lib/firmware and run

Note -- On my late 2006 macbook, the idProduct value in the above was 8501 and not 8300. Also I had to save the file as /etc/udev/rules.d/70-isight.rules before udev would load the rule --Craftyguy 05:27, 16 April 2008 (UTC)

Then reboot or run udevtrigger for re-read udev rules. It creates new device /dev/video0.

Note -- On my MacBook just adding the rule and restarting did not create the /dev/video0.

Also I did not find the udevtrigger tool on my installation. I solved the issue by manually running:

The expressions {busnum} and {devnum} have to be replaced by the appropriate numbers.
I ran lsusb and took the numbers from the device with xxxx:8300.
Example: /usr/lib/udev/ift-load --firmware /lib/firmware/isight.fw -b 001 -d 003

Bluetooth

It seems the above mentioned kernel config doesn't include Bluetooth. You have to add the USB HCI driver, as the Apple baseband controller is just an HCI one, but with a special HID-on-powerup mode.
Don't forget to recompile and install your kernel/modules!

To enable Bluetooth edit /etc/conf.d/bluetooth for hid2hci: Just change HID2HCI_ENABLE=false to true and add the Bluetooth service by executing

rc-update add bluetooth default

On my Macbook, this didn't work first. I had to manually specify hci-usb in /etc/modules.autoload.d/kernel-2.6. Otherwise, hid2hci wouldn't find the device (and wouldn't be able to switch it from HID to HCI mode). You can also compile the driver into the kernel, of course.

Suspend to Ram

Suspend to Ram is probably the most difficult feature to get fully
working on your MacBook.

Most of us had to spend quite a few hours on tweaking to get it "right".

If it happens to work right away for you then you may consider
yourself a very lucky person. :-)

Anyways, don't get discouraged when it fails for the nth time,
it will work eventually!

Many people (including myself) go through many suspend/resume cycles every day without a hitch.

Alternatively you can use suspend2 to save to disk which is very simple and is completely outlined below under suspend to disk. Though this is not quite as fast, it will allow you to preserve your programs, data etc while you boot into OSX or other os.

How to set it up

Using Suspend

Note that this has been tested on a 2nd Generation Macbook using 32Bit.

Suspend is a tool that works almost right out of the box

Just emerge Suspend via the portage.
Note that Suspend and lix86 are masked by ~x86.

Now type

s2ram

The only issue I had was that the madwifi driver wasn't reloaded properly after a suspend2ram.

For that edit /etc/hibernate/ram.conf and add

UnloadModules ath_pci
LoadModules ath_pci

I haven't tested this for other moduses of suspending because I only use s2ram. But i guess you will have to add this to their *.conf, too. Probably the common.conf is a master file for that. Just try it.

Other Methods

In order to get proper suspend/resume your system must fulfill the
following prerequisites:

The picoverlay is a nice solution for those who use layman. Just add the address to the "overlays:" section of your /etc/layman/layman.conf and do a

machine ~#

layman --fetch

If you are using x86_64, i.e. amd64:

s2ram needs libx86

libx86-0.99 is not able to detect, that it is running on x86_64 and therefore chooses the wrong backend (lrmi instead of x86emu).

I am using the picoverlay for s2ram, libx86, mactel-sources, pommed and a bunch of others. The libx86 ebuild contained in it, needs to be extended to hardcode the backend. (This is a temporary solution. If I find the time I either patch libx86 or the ebuild to do that automatically.)

All this was done using mactel-sources-2.6.21-r5 from picoverlay and xorg-x11-7.2 from portage.

libx86 should compile fine by now. With s2ram you might run into another problem: The s2ram ebuild checks for the kernel config option CONFIG_SOFTWARE_SUSPEND. As far as I understood, this is not necessary, when using CONFIG_SUSPEND2 and that using suspend2 is preferable. So either you fix the ebuild to check for SUSPEND2 (I did) or you compile a kernel with SOFTWARE_SUSPEND.

Just successfully suspended and resumed. Extensive tests need to follow.

C2D

2.6.21-mactel-r1-mactelpatches-macbook-core2duoebuild and bluez patches. Using hibernate-scripts and this configuration, and the command hibernate-ram.. Biggest problem was freezing when suspending... problem solved by going to the new implementation of the parallel ide driver in the kernel, see my .config.. If anyone knows howto get klaptop to use hibernate-ram please write me

It only works for me using echo mem > /sys/power/state. s2ram tries to switch to console which causes problems here.

mactel-sources-2.6.22-r2 on x86_64 using udev for my console with the latest X11 and 810 drivers. I use Suspend-0.7 and had to edit the libx86 to be successfull (even if i think the ebuild should have been ok...). See above for instructions!

2.6.20.4 (vanilla sources) Macbook Pro C1D. Config file from this site (important), slightly changed since I am not C2Duo. Mactel patches, xorg 7.1.1, ati 8.34.8, s2ram 0.5 (just downloaded from sf). Audio, wireless etc works after resume. Fglrx appeared to break s2ram. However, setting POST_VIDEO to false in /etc/default/acpi-support, and using s2ram -f (without -p or -m) makes it work [This is in DEBIAN. Can someone on gentoo confirm if that config file exists in gentoo and edit if necessary?]

suspend2-sources-2.6.21-r5 + mactel patches. Xorg 7.2. fglrx-Ati-Drivers-8.35.5. No s2ram. I use RadeonTool and VBETool with hibernate-script. I needed to turn off the console framebuffer, cause I got only a black screen after resume. Additionally I had to append "acpi_sleep=s3_bios,s3_mode" to the kernel params.

vanilla-sources-2.6.22.9 and later vanilla-sources-2.6.24_rc6 (NO mactel patches). Macbook Pro Santa Rosa (bought October 2007) ; emerged sys-power/suspend; successuful suspend/resume cycles in daily use. I use "s2ram -f -p -m" but only from within X (if I suspend from a console I get a blank screen at wakeup). If using a cabled connection with NetworkManager, it's better to pull the cable before suspending and inserting it after resume, otherwise connection won't work anymore. wireless will resume without problems (maybe after a couple of connection attempts).

gentoo-sources-2.6.23-r5 (NO mactel patches); emerged sys-power/suspend; I have been successfully sleeping with "s2ram" under X. If I try from console, even using the -p option, the backlight is turned off at wakeup, and the macbook-backlight command does not work.

MacBook Air

How to perform a suspend

To suspend you simply type:

s2ram

...and the machine should go to sleep.

If you get a reboot instead of resuming when you open the lid, you might also try

s2ram -f -p -m

-f causes force, overriding the fact that the macbook is not on s2ram's whitelist. -p and -m cause s2ram to use vbetool to re-post on suspend and resume, which was necessary for the x1600 in MBP. See success stories (2.6.20) above for why these second two should no longer be necessary.

MacBook (non-pro) Core 2 Duo (maybe others with Intel GPU)

You might find s2ram works fine (with -f -s) from the console but if X is running it will restore into black screen, cursor will move for a while and then freeze. You might notice using echo mem > /sys/power/state avoids the freeze (eg you do a sound test by typing cat /dev/urandom > /dev/dsp) but the screen won't come back on. All you have to do to fix it is update xf86-video-i810 to at least version 2.0.0. Add to /etc/portage/package.keywords:

Press the power button and hopefully your laptop should wake back into X. There's one last gotcha though, you'll find if you switch to a text terminal or quit X, the screen will just be blank (with backlight on). You can fix this by executing in X:

chvt 1; vbetool post; chvt 7

Or you can have s2ram do this for you automatically with the command below:

s2ram -f -p

I found the vbe_save (-s) option to s2ram causes the machine to reset when switching back to X with the new driver. It seems the 915resolution hack is also unnecessary for this version of the driver. If you're still having trouble make sure you're running kernel 2.6.20 or later, I'm using 2.6.20-r6 gentoo-sources + all mactel patches. This setup is also working fine with AIGLX/Beryl running.

Potential Problems

Most (even small) mistakes will render your WAKEUP/RESUME UNRELIABLE!.
The Macbook may restart on wake up, halt on wake up, or wake up with the backlight off.
If you have X11 running during suspend, then the machine may also crash immediately after wakeup, if it wakes up at all. Symptoms of this particular crash: frozen cursor, predominantly black screen, and squares of pixelation/static.

Oddily enough, on newer Macbook Pros the suspend could give more problems if launched from within a console than from within Xorg.

See the next section for hints about tracking down problems...

Checklist (if it doesn't work)

Here is a list of things you can try if you are having problems:

Passing the following options to your kernel from your bootloader seem to make suspend-to-ram reliable:

to resolve the problem with the wrong color depth, you can put this line into /etc/hibernate/common.conf:

OnResume 30 sudo /usr/bin/xset -display :1 dpms force off

after the screen goes blank, you have to move the mouse or tap on the touchpad and the screen should come up with the
right resolution ***this is always functionally on a macbook pro, try it on a macbook***
edited by tw1nh3ad

Integrating with Gnome Power Manager

If you want to have Gnome Power Manager be able to employ s2ram, make the following alterations to
/usr/share/hal/scripts/hal-system-power-suspend:

Tip:Update: The file to alter now lies in /usr/lib/hal/scripts/linux/hal-system-power-suspend-linux

You may also get gnome power manager giving you permission problems, if so, execute the following:

machine ~#

touch /var/run/console/YOUR_USERNAME

You will need to put that command in the file /etc/conf.d/local.start in order for it to work after every boot.

Suspend to disk

Works almost out of the box with the suspend2 patches (I applied them to 2.6.18-rc6 together with the mactel patches). Many people with the macbook will be going back and forth between gentoo and OSX and maybe even windows. This 'hibernate' feature provides a very simple transition between workspace platforms. This is also possible in both windows, as hibernate (should be already setup?), and in OSX as 'safe sleep'. --Otho 23:52, 12 November 2006 (UTC) 'Safe sleep' doesn't work form me after I have booted into linux, making it currently almost useless to implement.

--Otho 21:56, 26 October 2006 (UTC)I used the portage cheat (above) applying the mactel patches to sys-kernel/suspend-sources-2.6.18, with no problems. This provides a much easier way to get the suspend2 and mactel patches (not to mention all the ones from the gentoo-sources).

Follow the HOWTO Software Suspend v2 and install hibernate-script from portage. 915resolution has to be restarted after resume. As there is only a tweak for 855resolution yet, put this into /etc/hibernate/scriplets.d/915resolution:

External monitor

For MacBooks with intel 945 based video cards, external monitor output can be enabled or disabled via the app-misc/i810switch software. The latest version currently in portage (0.6.5-r1) doesn't support anyway the i945 card directly, and needs to be patched. Both a patch and a proposed ebuild can be found in gentoo bugzilla at here. It was tested on a CoreDuo MacBook, with the mini-dvi to vga adapter, and worked perfectly.

In the first generation MacBook with intel 945 video cards, driving a 1680x1050 or similar widescreen resolution on an external monitor requires the 915resolution (sys-apps/915resolution) hack of the video BIOS modes. This utility must be run before X is started to add the 1680x1050 resolution in the video BIOS. The main MacBook display is also widescreen and the basic init.d scripts included in 915resolution change only one entry in the video BIOS. I edited (hacked) the /etc/init.d/915resolution script to force 2 updates in the video BIOS to ensure that both the MacBook screen and external display (in my case an 22" ACER 1680x1050 widescreen LCD) would work with their native resolution. You must call those updates to the video bios before starting the X server. Read more on the use of 915resolution here.

To get the Fn + F7 key to switch on and off the external monitor, I used xbindkeys, by adding the following rows to my .xbindkeysrc file:

This simply switches on and off the external monitor, without switching off the internal lcd. This is quite a different behaviour from the standard found on most laptops (which cycles between LCD-only,CRT-only,LCD+CRT). Anyway any more complex behaviuor should not be difficult to accomplish via a proper (and simple) bash script.

(please note that i810switch needs read/write permissions to /dev/mem, so you'll have to suid the binary, or find another workaround).

Unresolved Issues

In rare cases where your macbook has a MATSHITADVD you will have a problem with dvd answering with status too late,so you will get errors in dmesg every 2 seconds. I solved this by modifying /usr/src/linux/drivers/ide/ide-iops.c at line 558 from udelay(1) to udelay(2). This make the kernel wait a little longer for the cdrom status.

HDAPS

HDAPS feature (acceleration detection) is enable with applesmc patch. But, current interface is not compatible with other current hdaps tools (especialy hdapsd wich allow to park head of disk).

Power saving

MacOS X allow MacBook to work on battery during 6 hours. How have these results on Linux?

Use kernel >= 2.6.21, because 2.6.21 include use special intruction set of intel processor for power saving (cf documentation of PowerTop).

Try PowerTop

Try patch from PowerTop team

Compile your kernel with CONFIG_USB_SUSPEND

Enable wireless power management with "iwconfig wlan0 power on"

Hardware Sensors

The Intel 82801 (ICH) is the correct driver for the I2C bus, but I do not know what the drivers for any sensors are, if they exist.

AIGLX/Beryl Dual/Multi-Head Setup

When connected to an external display, during X11 startup, AIGLX will report that screen 1(the external one, the internal LCD is screen 0) does not support DRI. So if beryl is started as described above, it will try to take over both screens, and will fail to do so (crash). The solution is to first launch a non-DRI dependent window manger on screen 1, then launch beryl on screen 0. I used ion3 but you may use other wm.

I first edit my $HOME/.xinitrc to be like so:

# if the "-oneroot" is not specified
# ion3 will also try to take over both screen
ion3 -display :0.1 -oneroot

Then open a terminal in ion3 and run:

beryl --display :0.0 --strict-binding --screen 0 &

Then open a terminal in beryl and run:

emerald &

There is still one problem: (in my case) X11 will freeze (must be rebooted) on exit for unknown reason(possibly related to Composite Extension as when it's not loaded, ion3 exits fine. But of course, not loading Composite Extension will prevent beryl from launching).

To have everything happen all at once during startup, make .xinitrc look like so:

vesafb-tng has been removed from gentoo-sources versions 2.6.23 and higher. intelfb doesn't seem to work for high resolution framebuffers, so MacBook users (at least pre-2007) will want to use the older kernel version.

-- note: vesafb-tng doesn't work for me on MBP 15" in its native 1440x900 resolution. I can only display a maximum of 1024x768, which does look prettz ugly. Does anybody know what kernel/vesafb-tng version was used in this howto?

-- note 2: The resolutions reported in /proc/fb0/modes go up to 1152x864. I'm not sure if widescreen frame buffers are supported. Also, 1024x768 seems to scale better to 1440x900 to1152x864 so I'd recommend using that instead.

x86_64 and Console Framebuffer

To use a proper Framebuffer on 64Bit systems you will either have to rely on vesafb or uvesafb, vesafb-tng is actually rather abadoned and doesnt even work on 64 Bit systems.

For uvesafb you will have to patch your kernel, which doesnt run very smoothly on the gentoo kernel. But there was a thread concerning that problem with an updated patcher (for which I sadly dont have the link anymore).

Next, run emerge to build the xen sources. Emerge will use the overlay first before looking in the community portage tree.

emerge -av xen xen-tools
emerge -av xen-sources

As of this writing (20070425) the latest kernel tested is 2.6.16.46 which should run fine on the MacBook Pro. There are no existing patches to get the touchpad working along with various other things but it's possible to backport the mactel-linux patches to this kernel if you really need them.

Follow the instructions on the Xen page for kernel configuration and Xen details. Useful notes include:

Add your filesystem of choice directly to the kernel (not as a module)

Make sure to enable all the backend driver configurations for the dom0

Disable all of the frontend driver configurations; these are used by the domU kernel only

There are no details for Xen kernel configuration specific to the MacBook Pro that need to be highlighted. The aforementioned wiki page, though generic, is sufficient to get a working kernel.

Obscura

Items that don't fit in elsewhere, or are rarely used.

What to do when touchpad or IR don't work?

It could be that udev loads usbhid before appleir and appletouch and the apple drivers cannot bind to the devices any more. To circumvent this problem you should add the following to your /etc/conf.d/local.start:

The solution with /etc/conf.d/local.start has the drawback for me, that the X-Server is started before the modules are reloaded, forcing me to reload the server again after local.start has finished. My first attempted solution was to prevent udev from loading usbhid and appletouch alltogether and put these two in /etc/modules.autoload.d/kernel-2.6 in the correct order. But on some boots both modules were already present by the time usbcore registered them, thus leaving the order of registration random again.

The most reliable approach seems to be an file /etc/modprobe.d/touchpad with

How to make Synaptics Touchpad survive suspend/resume

There's more trouble ahead: even if appletouch claims the device before usbhid does and Xorg detects a synaptic device at say /dev/input/event1, after a suspend/resume this can (and often will) change to for example /dev/input/event3. So Xorg still looking at event1 will lose the synaptics device. The solution: create a file /etc/udev/rules.d/70-appletouch.rules with

and reboot.
This will create a symlink /dev/input/appletouchpad always pointing to the right device. You have to change the InputDevice section in xorg.conf:

Option "Device" "/dev/input/appletouchpad"
Option "Protocol" "event"

Be sure not to have "Protocol" "auto-dev", or Xorg will automatically pick the event* device instead of appletouchpad.

--87.160.244.206 15:51, 17 November 2007 (UTC)
This doesn't work for me, as with udev-117, kernel-2.6.22-suspend2-r2, x11-drivers/synaptics-0.14.6. X reclaims that nothing found on the link /dev/input/appletouch. Best was till now to drop external mouse support in xorg.conf, but occasionally touchpad still don't work. even suspend2ram doesn't wake up always, so i switched to suspend2disk.
see also this bugs maybe regarding to this issue: [4][5]

Alternate Partitioning Method

This method is real handy at removing the 4 partition limit. However it is experimental and has some concerns about upgrading to Leopard...

Alternate Partitioning method 2

Important Informations

It must be noted that bootcamp can only boot on the four first partitions. So if you use this method make sure you install all the OSes that must boot using a bios on the first partitions.

Note: Windows will not be able to see more than these 4 partitions, and the gentoo gentoo live too if you don't launch parted and modify the partition scheme (this will cause issues with grub installation).

I don't know if it works if you do your partitions scheme at the Mac OS X installation.

You must have Bootcamp installed but rEFIt is only needed to dualboot/tripleboot OSX.

Reinstalling completely Mac OS X (and keeping it)

If you don't want to get rid of Mac OS X you should make one small partition with the Mac OS Installer's Diskutility (menu Tools during the installation) to install Mac OS X on it (I haven't tested to make all the partitions directly so I can't guarantee it works, but you can make 3 partitions without any concern).

Update Mac OS X.

Install Bootcamp (only verified with the version 1.4 beta).

Install rEFIt.

Boot the gentoo livecd.

Not Reinstalling Mac OS X

If you don't want to reinstall Mac OS X, you can use the diskutil program on Mac OS X to resize the partition (or the bootcamp assistant graphical frontend). And continue normally.

Linux only install

You only need to update Mac OS X and install Bootcamp.

You will need rEFIt, so download the bootable iso and burn it to a CD.

Then, after booting the gentoo livecd launch parted and suppress the partition 2 (Do not touch the first partition it is where bootcamp resides !).

Note: If you get rid of the Mac OS X partition you will have a folder with a interrogation mark on it, to suppress it you only need to boot you mac with Mac OS X on an external drive

Gentoo Installation

Note: Remember that bootcamp can only boot the mac from the 4 first partitions (as the first of all is the Apple extension for the EFI you need to install the /boot partition to one of these)

When on the livecd terminal you only need to partition your hard drive using parted and then follow installation instructions with one difference.

When configuring the kernel make sure you have some options activated.