Archive for the ‘OS X’ Category

Install Latest Docker on Ubuntu Trusty 14.04 (LTS)

October 28th, 2014 No comments

From Docker’s site:

Ubuntu Trusty 14.04 (LTS) (64-bit)

Ubuntu Trusty comes with a 3.13.0 Linux kernel, and a package which installs Docker 0.9.1 and all its prerequisites from Ubuntu’s repository.

Note: Ubuntu (and Debian) contain a much older KDE3/GNOME2 package called docker, so the package and the executable are called


To install the latest Ubuntu package (may not be the latest Docker release):

$ sudo apt-get update
$ sudo apt-get install
$ sudo ln -sf /usr/bin/ /usr/local/bin/docker
$ sudo sed -i '$acomplete -F _docker docker'/etc/bash_completion.d/
$ source /etc/bash_completion.d/

If you’d like to try the latest version of Docker:

First, check that your APT system can deal with https URLs: the file /usr/lib/apt/methods/httpsshould exist. If it doesn’t, you need to install the package apt-transport-https.

[-e /usr/lib/apt/methods/https ]||{
  apt-get update
  apt-get install apt-transport-https

Then, add the Docker repository key to your local keychain.

$ sudo apt-key adv --keyserver hkp:// --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9

Add the Docker repository to your apt sources list, update and install the lxc-docker package.

You may receive a warning that the package isn’t trusted. Answer yes to continue installation.

$ sudo sh -c "echo deb docker main
> /etc/apt/sources.list.d/docker.list"
$ sudo apt-get update
$ sudo apt-get install lxc-docker


There is also a simple curl script available to help with this process.

$ curl -sSL | sudo sh

To verify that everything has worked as expected:

$ sudo docker run -i -t ubuntu /bin/bash

Which should download the ubuntu image, and then start bash in a container.

dd with gzip

January 16th, 2013 No comments

You can save a lot of space by compressing dd image files.
These examples use gzip but many other compression apps will work just as well.

backup with dd and gzip

dd if=/dev/wd0a | gzip -9 > /mnt/backup.gz

restore backup

gunzip /mnt/backup.gz – | dd of=/dev/wd0a

Categories: Linux, OS X Tags: , , , , , ,

XCode and Older iOS Devices

January 16th, 2013 No comments

With a bit of hacking, it’s possible to target older iOS devices than those normally supported by the latest SDK:

Categories: Development, OS X Tags: , , , , , , , ,

SourceTree from Command Line

January 16th, 2013 No comments

Download SourceTree command line tools from:

To open repo in current folder:

stree .

Categories: Development, OS X Tags: , , ,

/private/var/vm Disk Usage on OS X

January 16th, 2013 No comments

It seems this is filled with multiple (roughly) 1GB swap files, allocated as required.
Problem is they don’t go away (until reboot?).
One article suggested this:

sudo dynamic_pager -L 1073741824

Seemed to work: before running vm used 8GB, afterwards 4GB

Categories: OS X Tags: , , , ,

Growl 1.3+

January 16th, 2013 No comments

I like Growl notifications for automated builds (and not much else – does anyone really need more distractions from IM, Facebook, Twitter?).

As of version 1.3, Growl is only available through AppStore for $1.99, but the source is still available online. So if you happen to have XCode installed, the following instructions will get you running.

1) You need Mercurial to retrieve Growl source. To Install Mercurial: sudo easy_install pip && sudo pip install Mercurial

2) In a terminal window:

cd /tmp
hg clone
cd growl
open Growl.xcodeproj

3) In XCode, disable code signing.

4) Back in terminal:

xcodebuild -project Growl.xcodeproj -target -configuration Release
open build/Release

5) Copy to your Applications folder.

More detailed, illustrated instructions available at:

Categories: OS X Tags: , , , , , , ,

Mountain Lion DNS Issues (and SMB)

December 9th, 2012 2 comments

I’ve been incredibly frustrated by how poorly DNS resolves since upgrading first to Lion, then later to Mountain Lion (on a new machine, but migrating my old files). The impact of this was particularly bad connecting to SMB/CIFS/Samba shares – some would mount after several minutes, others not at all.

Early on it became clear the problems were related to my router (DDWRT) not supporting IPv6 but then neither does my ISP. Here are a few things to try:

DNS Resolver Order

Normally /etc/hosts is first in line for DNS resolution. But it seems improper line termination, presumably a carriage return/linefeed instead of just a linefeed, causes all sorts of problems. Many posts describe ways to force reloading of the hosts file, but the root cause seems to be improper line termination. Always make sure you use a Unix compatible editor.

To check the order resolvers are called:

scutil --dns

/etc/hosts Entries

These two were the main source of my problems:

1. My host has multiple names – these must all be present, and fully qualified: hosta hostb

2. All localhost entries must have ::1 entries too, or OS X will send IPv6 requests to resolve them externally. And this despite IPv6 being disabled on the interface!

::1 hosta
::1 hostb

Turn off IPv6 in Network Preferences

Go to System Preferences -> Network -> Advanced -> TCP. In the Configure IPv6 list, you may have an “Off” option. If so, select it. If not, see next tip.

Turn off IPv6 from Terminal

List available network services:

networksetup -listallnetworkservices

Turn off IPv6 on chosen device (name from above list):

networksetup -setv6off your_device_name (i.e. Wi-Fi, Ethernet)

Now the Configure IPv6 list  for that device will show “Off”  (see previous tip).

MobileMe Remnants

Apparently older OS X installations migrated to newer releases may still have hooks to no-longer existant MobileMe servers. Many users report that removing these greatly speeds up SMB connection. The following removes those references if present and are harmless if not.

defaults delete -g iToolsMemberDomain
defaults delete -g iToolsMember


Categories: Network, OS X Tags: , , , , , , , , , , , ,

Headless Parallels

November 12th, 2012 No comments

Generally I like to run servers headless, as in with no display or console. In Parallels this is a little tricky, but doable from Terminal. However, Parallels Desktop must not be running. If you do launch Parallels while a Terminal-spawned VM is running, a console will automatically be created.

To see a list of available VM:

prlctl list -a

To launch a VM:

prlctl start vm_name

Timemachine Problems – fix summary

November 4th, 2012 No comments

Continuing from my Timemachine post, here is my summary of instructions from Garth Gillespie’s site (

In Terminal:

sudo su - 

The verication that has already run has marked your sparsebundle as bad, so first we need to make it look normal:

chflags -R nouchg /Volumes/{name of your network share}/{name of}.sparsebundle

This may take a little while. Then:

hdiutil attach -nomount -noverify -noautofsck /Volumes/{name of your network share/{name of}.sparsebundle 

You will then see something like

/dev/diskx Apple_partition_scheme /dev/diskxs1 Apple_partition_map /dev/diskxs2 Apple_HFSX 

Where x is the disk id for the external disk. You are interested in the one labeled Apple_HFSX or Apple_HFS. It might be 2, 3, 4 or higher.

At this point, the filesystem check is running. To see what’s going on, tail the fsck_hfs.log

tail -f /var/log/fsck_hfs.log 

Normally, if fsck is running, it will successfully repair the sparsebundle, but it can take a long time (hours). Grab a coffee.

When done, you should see:

The Volume was repaired successfully

So far, this has always worked for me. But if you get:

The Volume could not be repaired
 You can try:
fsck_hfs -drfy /dev/diskxs2 

Make sure to replace x with whatever number your disk is from the output above. Like before, use tail to follow the fsck log output, and get comfy.

Once fsck has completed successfully, unmount the volume:

hdiutil detach /dev/diskxs2 

Lastly, you need to clean up your backup’s state by editing (top level of your sparsebundle) as follows:

1) Remove these two nodes:

<key>RecoveryBackupDeclinedDate</key> <date>{whatever-the-date}</date> 

2) Replace:



<key>VerificationState</key> <integer>0</integer> 

And you should be good to go!

Categories: OS X Tags: , , , , ,