Installing OS X 10.11 El Capitan inside Parallels Desktop

This is actually surprisingly straightforward, once you know the hoops to jump through.

Essentially there are 4 main things we need to do:

  1. Download El Capitan from the App Store
  2. Prepare an install image
  3. Create a virtual machine
  4. Install El Capitan

So let’s take a look at those, one by one…

Step 1: Download El Capitan from the App Store

Currently you need to be a registered developer. Provided you are, you can download the beta from Apple’s website (this redeems a coupon inside the App Store, so you need to be on a Mac to start the download).

Step 2: Prepare an install image

This section is all command-line stuff, so go fire up Terminal.app. (Warning: you’ll need at least 15GB of disk space free to deal with this next section safely… more if you don’t clean up the two temporary images we build along the way)

First up we want to install the iesd Rubygem which provides a nice way to deal with Apple’s InstallESD.dmg files:

sudo gem install iesd

Now we want to use that iesd tool to build a bootable image from the installer we downloaded from the App Store:

iesd -i /Applications/Install\ OS\ X\ 10.11\ Developer\ Beta.app -o ElCapitan-base.dmg -t BaseSystem

Okay, so that’s built us a read-only (DMG format) bootable image for the installer. At the moment, though, that’s missing the copy of OS X that it actually needs to go and install into your VM. To fix that we need to get a read-write (sparse image format) copy of the image:

hdiutil convert ElCapitan-base.dmg -format UDSP -o ElCapitan.sparseimage

Let’s throw away the read-only version now:

rm ElCapitan-base.dmg

And now we want to mount the disk image so we can add some files into it:

hdiutil mount ElCapitan.sparseimage

We also want to mount the InstallESD.dmg file from inside the installer we downloaded from the App Store, as it has some files we’ll need to copy over:

hdiutil mount /Applications/Install\ OS\ X\ 10.11\ Developer\ Beta.app/Contents/SharedSupport/InstallESD.dmg

Now we want to copy the files from the Install ESD into the writable image we made:

cp /Volumes/OS\ X\ Install\ ESD/BaseSystem.* /Volumes/OS\ X\ Base\ System/

Now we want to eject both of those:

hdiutil detach /Volumes/OS\ X\ Base\ System/
hdiutil detach /Volumes/OS\ X\ Install\ ESD/

And now we need to get it back into that read-only DMG format:

hdiutil convert ElCapitan.sparseimage -format UDZO -o ElCapitan.dmg

And let’s throw away the read-write version to free up disk space:

rm ElCapitan.sparseimage

Step 3: Create a virtual machine

  1. Open Parallels, and press the + button to create a new VM
  2. Install Windows or another OS from a DVD or image file
  3. Continue without a source
  4. When asked what type of OS you’re installing be sure to pick OS X
  5. Tick “Customise settings before installation” and click continue
  6. Go to the Hardware tab, then go to USB & Bluetooth, and turn off USB 3.0 support or the installer will kernel panic during boot
  7. Go to CD/DVD 1 and insert the ElCapitan.dmg file you created
  8. Go to CPU & Memory and make sure you have at least 2048MB of RAM
  9. Go to Video and ensure you have at least 128MB of video RAM

Step 4: Install El Capitan

Okay, now comes the moment of truth: boot the Virtual Machine and you should be presented with a white Apple logo on a black background for a few minutes, followed by the El Capitan installer.

Credit where credit’s due…

This post was originally inspred by this post by TheBressman on Reddit, however that was missing some steps, so I filled in the gaps with info from this blog post by Jacob Tomlinson. Thanks!

Sharing entropy between computers with entropyservice

Suffering with low entropy on Xen/KVM/VMware VMs? Get help from another computer with better entropy sources.

Check out entropyservice. It allows low entropy machines (eg virtual machines) to collect data from another host with high entropy (eg a real computer) via SSH, then stir it in to the kernel’s entropy pool using rngd.

Find out more at https://github.com/arussell/entropyservice.

OS X Mavericks: restoring my development enviromment

I upgraded to OS X Mavericks last night. It’s great, my Mac is faster, and I’ve not touched a single byte of swap yet, even with a ton of stuff open. But like any OS upgrade, there are some things that are causing my dev environment to work strangely. Here’s how I’m fixing them.

Apache just shows 403 Forbidden for all my sites in ~/Sites

This one’s an easy fix. Open /etc/apache/httpd.conf in your favourite editor. Find <Directory "/Library/WebServer/Documents/"> on line 197 and replace it with <Directory "/Users/your-unix-username/Sites/">.

Alternative solution: If you have multiple users on the same Mac all needing ~/Sites to work, you may need to replace the Directory directive entirely with a <DirectoryMatch "/Users/*/Sites/">, but don’t forget to change out the closing </Directory> for a </DirectoryMatch> too.

Once you’ve made your edits, save the file, and run sudo apachectl restart to make apache pick up the config change.

Git shell integration stopped working

I added these lines to my .bash_profile to get RVM info and Git info in my shell prompt:

# Show RVM gemset and Git branch in Bash prompt
source /usr/share/git-core/git-prompt.sh
export PS1="\h:\W \u\[\033[01;34m\]\$(~/.rvm/bin/rvm-prompt g)\[\033[00;33m\]\$(__git_ps1 \"(%s)\")\[\033[00m\]\$ "

Now, however, my shell prompt is a bit broken and has an error above each prompt, like this:

-bash: __git_ps1: command not found
piro:~ my-unix-username$

Turns out I don’t have a

/usr/share/git-core/git-prompt.sh

file anymore, which is causing the __git_ps1 environment variable to not get set.

But, there does appear to be a copy at /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh so I edited my .bash_profile to and updated the source line with the new path. Not sure it’s such a great idea running it from the /Applications/Xcode.app path but it’s probably better than copying/symlinking it to /usr/share until I get familiar with The New Way Of Doing Things™.

X11 was no longer installed

Easily fixed, just need to download a fresh copy from http://xquartz.macosforge.org.

More issues will be posted here as I find/solve them.

iOS 7 status bar fix for Sencha Touch apps

Sencha Touch hasn’t been updated for iOS 7’s new fullscreen views yet. This causes the status bar to overlap your app’s content, which looks rather messy.

Luckily it’s really easy to get things working again if all your views use title bars / navigation bars.

Just drop this code into app.js (after your last Ext.Viewport.add line) to make the title bars a bit taller and push the title bar’s contents down a few pixels so that the title and any buttons up there don’t collide with the status bar’s contents:

// Adjust toolbar height when running in iOS to fit with new iOS 7 style
if (Ext.os.is.iOS && Ext.os.version.major >= 7) {
  Ext.select(".x-toolbar").applyStyles("height: 62px; padding-top: 15px;");
}