Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

Mac OS Series






Panther or Tiger Chroot

(All references to Panther also apply to Tiger.)

This is an attempt to build a disk image containing a "pristine" development environment for Gentoo for Mac OS X on OSX. There have been some permission problems with the method described below. Please let your experiences flow in here!

Creating and attaching the Disk Image

We'll start with making the disk image. We will use HFSX file system to obtain case sensitivity. I am calling mine **Dargentoo** , use whatever name you want.

sudo hdiutil create -size 4g -type UDIF -fs HFSX -volname Dargentoo -uid 0 -gid 0 Dargentoo.dmg
sudo hdiutil attach Dargentoo.dmg -owners on

Note that although the create argument to hdiutil allows for an -attach-option, this will not enable showing the right owners on the disk image! The last line is the right command for re-attaching the image created in this process as well.

Installing a minimal OS X

First, we need to set an environment variable to make the os x installer let us install the packages into a non-bootable Volume (a directory that is not /)

for bash and zsh:


for tcsh:


First get into your so fresh and so clean clean disk image and become root

cd /Volumes/Dargentoo
sudo -s

Ok, different OS X install cds/dvds have different volume names, so edit your paths accordingly, and replace /Volumes/$MACOSINSTALL with the actual path to the pkgs.

We start by installing the base system in -verbose mode so we can see if anything goes wrong (and it could, the installer is very unpredictable) and tell it we are installing from a -pkg and the files are to be installed on -target /Volumes/Dargentoo .

In case any weird browser wrapping occurs, this should be all on one line!

installer -verbose -pkg /Volumes/$MACOSINSTALL/System/Installation/Packages/BaseSystem.pkg -target /Volumes/Dargentoo

Hopefully yer golden pony boy.... If you get errors, make sure you set the CM_BUILD var, and try again, like i said, the installer can be finicky.

If you got the base system installed, next finish up by system essentials and the bsd subsystem.

installer -pkg /Volumes/$MACOSINSTALL/System/Installation/Packages/Essentials.pkg -target /Volumes/Dargentoo
installer -pkg /Volumes/$MACOSINSTALL/System/Installation/Packages/BSD.pkg -target /Volumes/Dargentoo

Yeehaw. If there were no errors, you have a pristine osx install image.

Installing the Developer Tools

We need the Developer Tools so that the gcc and a few other things are present.

Download the latest version available from Apple and either burn them to a cd or copy them to your harddrive.

As it turns out, you can use an "update" version as well. These usually refuse to install if no prior version is found, but seem to work if installed via the command line, like described here.

Now lets install the basics(you can install everything if you want/need to, i.e. additional sdk's , headers, etc)

installer -verbose -pkg /Volumes/Xcode\ Tools/Packages/DeveloperTools.pkg -target /Volumes/Dargentoo
installer -verbose -pkg /Volumes/Xcode\ Tools/Packages/DevSDK.pkg  -target /Volumes/Dargentoo/
installer -verbose -pkg /Volumes/Xcode\ Tools/Packages/BSDSDK.pkg -target /Volumes/Dargentoo/
installer -verbose -pkg /Volumes/Xcode\ Tools/Packages/gcc3.3.pkg -target /Volumes/Dargentoo/

(this assumes you've sudo sued like above)

Installing the Gentoo bootstrap package

Now the whole point of all this is to get Gentoo for Mac OS going so lets do it.

Download the latest version and mount the .dmg. Issue the same installer commands as we did for os x and xcode.

installer -verbose -pkg /Volumes/gentoo-macos/gentoo-macos.pkg -target /Volumes/Dargentoo/

Lets remove some extras like gui apps and docs(who needs thos?) to save space

cd /Volumes/Dargentoo/Developer
rm -rf Applications/ Documentation/ Palettes/ Extras/

Detaching the Chroot Volume

If you choose to chroot into the volume later, you might want to detach it now, e.g. to make a backup of it. Do so with

hdiutil detach <device>

Don't use umount, you might be stuck with a volume in the Finder that won't go away, and you would not be able to reattach the disk image. You can find out the correct device with mount.

If you entered the chroot, you need to leave it before, umount all special filesystems and cd somewhere else before you can do this.

What now?

See UsingChroot to actually start playing around in it =)

This page was started by Kito Dietrich. It was compiled from various sources on the web, including irc chats, Apple Documentation and the brilliant folks at Opendarwin

Retrieved from ""

Last modified: Thu, 06 Jul 2006 22:28:00 +0000 Hits: 18,423