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!

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;");
}

shareit: Simple FTP-based file sharing from the command line

File sharing websites tend to have ads everywhere, and long running HTTP uploads of large files can be a pain in the backside, so I stopped using them a while back. Whenever I needed to share a file with someone, I’d figure out the file’s MD5 sum (to avoid naming collisions), fire up Transmit (the nicest Mac FTP app by far), upload the file, rename it after uploading, then manually type the link and copy/paste the MD5’d filename in and send it to whoever I wanted to share the file with.

It was nice because I hosted the files, and didn’t have to worry about my recipient seeing a bunch of ads or the file sharing service going down (or being taken down). But it had a huge downside in that it wasn’t straightforward. I was doing a whole bunch of the work by hand every time I wanted to share a file with someone, which as a coder seems like I’m doing something wrong. Eventually I got round to automating it, and now it’s much easier to share a file with someone quickly, just fire one line into the terminal and you’re done.

Getting Started
Before you get started, you’ll want to create a simple YAML file called .shareit in your home directory with your FTP config details, like this:

hostname: ftp.yourwebsite.tld
username: yourusernamegoeshere
password: yourpasswordgoeshere
path: public_html/shareit/
http_prefix: http://yourwebsite.tld/shareit/

path should exist on the FTP server, and http_prefix should be the URL that the folder is accessible at. Both path andhttp_prefix should also include the trailing slash.

Note that the URLs shareit generates are not secure, but they are random enough that people won’t be able to guess them easily unless they know the file’s exact contents. It is recommended that you disable your webserver’s automatic directory indexing for the folder you define in http_prefix — if you don’t, people will be able to browse your entire collection of shared files.

Once you’ve set up your config file, make shareit available in your PATH by adding a symlink in /usr/bin or /usr/local/bin or something.

Usage
Using shareit is simple, all you need to do is tell it what file to upload:

$ shareit 10mb.txt
Uploading to http://yourwebsite.tld/shareit/596c35b949baf46b721744a13f76a258.txt: 10000K of 10000K (100%)
Upload complete!

You can download shareit from https://github.com/arussell/shareit.

Thoughts on switching from Chrome to Safari 5.2 [updated]

I’ve used Google Chrome almost exclusively as my main browser since 2009, but after seeing Apple’s WWDC keynote last week I decided to give Safari another try, because being able to send a tab from one device to another (without using Pastebot to just copy/paste the URL across devices),  is one of my most-wanted features.

Things I like about Safari:

  • iCloud tabs (even though I don’t have Mountain Lion yet, it’s already come in useful between my iPad and iPhone running iOS 6).
  • A unified bookmarks bar between my iOS devices and Safari on OS X
  • Reader (though I used Readability before, so I’m not really gaining anything really new here)
  • A unified address/search bar in Safari 5.2 (FINALLY.)

Things I don’t like:

  • No built-in translator
  • No distinct incognito/private browsing windows (with Chrome, incognito windows are super-useful for having two separate “cookie sets” allowing you to login as two users at once while developing web apps)
  • No pinnable tabs… there are a few things I always leave open, but I don’t want them taking up huge amounts of real-estate on my tab bar
  • More than a handful of tabs leads to Safari just displaying a >> icon at the end of the tab bar, whereas Chrome makes them progressively smaller so you can at least still get to them all
  • In Safari, Cmd-1 through Cmd-9 select Bookmark Bar bookmarks in Safari rather than specific tabs (this means I keep accidentally leaving the page I’m on and calling a bookmark instead of switching to the tab I wanted)
  • Lame process separation in Safari: although the web process is separated from the main browser UI process, if one tab crashes in Safari, ALL tabs need to be refreshed. This is no better than having the entire browser “unexpectedly quit” on me, really.

So far I’m finding Safari’s limitations super annoying and I want to switch back, but I’m going to stick it out a while longer. Perhaps I’ll get used to the quirks.

Update 2012-06-23: I’m back to Chrome. Safari’s funky replacement for the WebKit Developer Tools was the final straw.

Removing stuck Finder sidebar items in OS X Lion and Snow Leopard

Having trouble removing some pesky icons that have gotten stuck in the Finder’s sidebar? If you’re on Lion or Snow Leopard, the solution is easy:

  1. Click on the folder and drag it away from the sidebar
  2. Before you let go of the mouse button, hold down the Command (⌘) key
  3. Now that you’re holding down the Command (⌘) key, release the mouse button
  4. The icon should now finally disappear from your sidebar in a puff of smoke
  5. Hooray!

(Credit: Hybridair at MacRumors Forums)

Update 2011-08-20: Did you find this post helpful? It would be awesome if you’d take a moment or two to check out File Sanctuary, my hosting company. We’d love to help you with web hosting, email hosting, radio station hosting, domain registration, SSL certificates, and even giving you a safe place on the Internet to back your computers up to. We really care about the service we provide, and our prices are really good. Have a look around our website to find out some more, then get in touch and tell us what you need, and we’ll do everything we can to accomodate you. Thank you for reading my shameless plug! :)

Safari skews web stats

Here’s an interesting thing to consider next time you’re looking through your web stats: the popularity of Safari 4 and later (the desktop version, not the iOS one) probably looks way higher than it actually is.

Safari’s “Top Sites” feature checks sites to see if any content has changed since you were last there (and also to draw the preview images), and it does this reasonably often. The way it checks is to load your website behind the scenes, which means your server gets hit, and your stats show Safari’s more popular with each refresh.

Perhaps Apple should make the background thread use a different user agent string so that we can differentiate real requests from the Top Sites updates?

Problems installing the memcached gem?


Seeing something like this while compiling libmemcached or trying to install the memcached gem?

checking for style of include used by make... GNU
checking for gcc... gcc
checking for C compiler default output file name...
configure: error: in `/opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/memcached-1.0.2/ext/libmemcached-0.32':
configure: error: C compiler cannot create executables
See `config.log' for more details.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Turns out this error is quite misleading: what I was actually missing was the SASL development headers. This was all easily fixed with:

sudo aptitude install libsasl2-dev
sudo rm -rf /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/memcached-1.0.2/ext/libmemcached-0.32
sudo gem install memcached

(Your path to the gem that failed to install properly could well be different, so double check in your error output from the failed install.)

My Koobface / Facebook Roadblock experience

I figured I’d write up my experience with the Facebook Roadblock, as it might come in useful for other people who get locked out.

Last night I noticed Adium started spinning away on my dock, unable to connect to one of its configured networks, which turned out to be Facebook. A few minutes later I closed whatever browser tab I had open, and noticed that Facebook tab I had open behind it was showing the “Please login to continue” dialog over my previous session. Clicking the login button took me to something I’d not seen before, the Facebook Roadblock:

The Facebook Roadblock
The Facebook Roadblock

A few minutes of checking the SSL certs, retyping bookmarks, checking for DNS spoofing, and even trying from my iPhone over the 3G data network (which still didn’t work, it instantly logged me out once it loaded and didn’t let me back in), I received an email claiming to be from Facebook. And the headers seemed valid too:

Return-Path: <notification+z4o6=66@facebookmail.com>
X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on
  server01.filesanctuary.net
X-Spam-Level:
X-Spam-Status: No, score=-99.0 required=5.0 tests=AWL,BAYES_50,
  DNS_FROM_OPENWHOIS,RCVD_IN_DNSWL_LOW,SPF_PASS,USER_IN_WHITELIST autolearn=no
  version=3.2.4
X-Original-To: aaron@unadopted.co.uk
Delivered-To: aaron.unadopted@server01.filesanctuary.net
Received: from mx-out.facebook.com (outmail013.snc4.facebook.com [66.220.144.145])
  by server01.filesanctuary.net (Postfix) with ESMTP id CF77B315237
  for <aaron@unadopted.co.uk>; Thu, 28 Oct 2010 19:04:33 +0100 (BST)
DKIM-Signature: v=1; a=rsa-sha1; d=facebookmail.com; s=201006181024; c=relaxed/relaxed;
  q=dns/txt; i=@facebookmail.com; t=1288289073;
  h=From:Subject:Date:To:MIME-Version:Content-Type;
  bh=qEIXppA9YVJnzP16lPu8knjBLI4=;
  b=R8irJgwrt6XVn16hAvSUFeIlM++vWMcDyAYhNXrhKnQ6ItFMnyMlWp5Mpop9/8qW
  RBXeIrBlbl9R+MhQ7tTzmYKGcHpDpA4sMc27xKmYwDphIdANX0rgfCfxLzsRwYvJ
  wu+CZxtaBphfkFdMo0RZabSpGN4v5Q0WCW12jqDxKBM=;
Received: from [10.30.185.191] ([10.30.185.191:35133])
  by mta018.snc4.facebook.com (envelope-from <notification+z4o6=66@facebookmail.com>)
  (ecelerity 2.2.2.45 r(34222M)) with ECSTREAM
  id F6/5B-27367-13BB9CC4; Thu, 28 Oct 2010 11:04:33 -0700
X-Facebook: from zuckmail ([MTI3LjAuMC4x])
  by localhost.localdomain with local (ZuckMail);
Date: Thu, 28 Oct 2010 11:04:33 -0700
To: "Aaron B. Russell" <aaron@unadopted.co.uk>
From: Facebook <notification+z4o6=66@facebookmail.com>
Reply-to: Facebook <notification+z4o6=66@facebookmail.com>
Subject: Security Warning From Facebook
Message-ID: <9202ff1cbcd06add33c763f96edc88cd@localhost.localdomain>
X-Priority: 3
X-Mailer: ZuckMail [version 1.00]
X-Facebook-Notify: roadblock; mailid=333b85fG1e289220G6f8ad57G7b
Errors-To: notification+z4o6=66@facebookmail.com
X-FACEBOOK-PRIORITY: 0
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset="UTF-8"

Dear Aaron B. Russell,

We have detected that your Facebook account is infected with a form of
malware, or virus, called Koobface. You downloaded the virus after
receiving a message from a friend, which invited you to view a video.

To restore your account, please log in to Facebook and follow the
instructions you see there. You can also learn more in our Help Centre at:
http://www.facebook.com/help/?topic=koobface

Thanks,
Facebook Security Team

Hmm. So I really was locked out. But was I really infected? As I use a Mac, I wondered if I’d been hit by the (supposedly harmless) OSX/Koobface.A virus (Intego Security Memo). But if that was the case, why didn’t VirusBarrier X6 tell me about it? And why didn’t I get the Java applet warning? My mind wandered back a couple of days and I remembered I’d logged in on my Windows 7-based HTPC recently too, so there was a slim chance that I got infected that way.

So off I went to set some scans running. Kaspersky Internet Security finished on the HTPC first due to it’s relatively small HD, but that was clean, which only left my MacBook Pro as a potential candidate for infection. After discovering just how long it takes to scan a 500gb hard disk (more than 8 hours)… VirusBarrier told me that it didn’t find anything on my laptop either.

VirusBarrier says "no virus detected"
VirusBarrier says "no virus detected"

Both Kaspersky Internet Security and VirusBarrier X6 claim to be able to deal with various versions Koobface worm/trojan hybrid, but neither of them picked anything up despite having the latest virus definition updates, so my systems seem to be clean. Having checked my systems meant that I was now “allowed” through the Roadblock (Facebook requires you to certify that you’ve checked your system — that said, it’s only a checkbox to tick and you could easily lie, but if you receive genuine reports that your computer appears to be compromised, it’s better not to chance it), and I went through this sequence of steps…

Facebook give you a few options to prove your identity
Facebook give you a few options to prove your identity
I opted for SMS message verification
I opted for SMS message verification
Facebook then try to educate you about what happened...
Facebook then try to educate you about what happened...
... which is a really good idea (despite showing me Windows screenshots when I'm on a Mac)
... which is a really good idea (though they should detect I'm on a Mac)
... and then they forced me to reset my password (also good!)
... and then they forced me to reset my password (also good!)

And then after a confirmation screen, my account was restored.

So… what the hell happened? Well, from what I can tell my machines are not infected, so either my account was compromised, or it was a false alarm (possibly due to Adium’s frequent reconnects to Facebook Chat, because it drops the connection often). Either way, I think Facebook handled this very well from a security point of view. They also offered me a (Windows-only) 6 month free subscription to McAfee VirusScan Plus on the final confirmation screen, but I skipped that as I’m on a Mac and already use Intego VirusBarrier X6, but it’s good to be offering protection to people who might not be protected.

I’m interested to hear if anyone else has gone through this (especially Mac users), so if you have a similar story to share, please drop me a comment.

Google gives up on Wave

This is a pretty huge disappointment: Google’s admitted defeat on Wave, citing poor uptake, and plans to cut it loose later this year.

“despite these wins, and numerous loyal fans, Wave has not seen the user adoption we would have liked. We don’t plan to continue developing Wave as a standalone product, but we will maintain the site at least through the end of the year and extend the technology for use in other Google projects.”
— Urs Hölzle on the Official Google Blog [link to post]

I’ve found Google Wave to be very useful as a meeting and collaboration space for working with people hundreds or thousands of miles away from me, but I guess not enough people saw just how useful it actually is. It does have a pretty steep learning curve initially, so I can see why a lot of people probably didn’t bother, or didn’t get what it was for. I guess it’s back to IRC, IMs and Campfire for now.