Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
148 lines (106 sloc) 3.71 KB
title subline publishedDate tags
LXD on macOS
Remember if you die in here, you die in the real world too.

I use LXD on macOS, it might be helpful to someone if I share my setup, which I keep documented and up to date in a Gist but I may as well add it here too.

Originally based on:

VM Setup

Download an Ubuntu Server ISO (

Create a new VMWare virtual machine, select boot from the ISO with 2 NICs configured as "Share with My Mac" & "Private to my Mac" respectively. During the creation of the Ubuntu VM there will be a page to select installed software, select "OpenSSH server".

VM Networking

Log in to the newly created VM and install bridge-utils:

apt install bridge-utils

Edit /etc/network/interfaces with a bridge each for the 2 network cards, both DHCP (ip link show will give you the correct names for these interfaces).

## The primary network interface
#auto ens33
#iface ens33 inet dhcp

auto br0
iface br0 inet dhcp
        bridge_ports ens33
        bridge_fd 0
        bridge_maxwait 0
        dns-search home

auto br1
iface br1 inet dhcp
        bridge_ports ens38
        bridge_fd 0
        bridge_maxwait 0
        dns-search local

Restart sudo reboot, and you should now be able to ping the outside world.

$ ping

PING ( 56(84) bytes of data.
64 bytes from icmp_req=1 ttl=63 time=340 ms

Install open-vm-tools:

$ apt install open-vm-tools

Avahi on VM

Next, set up Avahi to broadcast host names so we don’t need to remember DHCP-assigned IP addresses. On the Ubuntu host, install avahi-daemon:

$ apt install avahi-daemon

In the configuration file /etc/avahi/avahi-daemon.conf, change these lines to clarify that our host names need only work on the second, host-only network adapter:


Then restart Avahi:

$ sudo service avahi-daemon restart

Now, you should be able to ping and ssh to $hostname from within the virtual machine and your Mac command line.

LXD server (Ubuntu VM)

sudo add-apt-repository ppa:ubuntu-lxc/lxd-stable
sudo apt update
sudo apt upgrade


$ sudo apt install zfsutils-linux
$ sudo lxd init

Generate a new LXD profile from the script here:

Test out lxc launch:

$ lxc launch ubuntu:16.10 --ephemeral -p $USER
$ lxc list
|     NAME     |  STATE  |              IPV4              | IPV6 |   TYPE    | SNAPSHOTS |
| enabling-ape | RUNNING | (eth0)         |      | EPHEMERAL | 0         |
|              |         | (eth1)          |      |           |           |

NB. It may take a few minutes for cloud-init to configure and restart eth1.

Allow remote operations on the LXD server (from macOS)

lxc config set core.https_address "[::]"
lxc config set core.trust_password some-password

LXD client (macOS)

With a working Go setup:

$ go get
$ cd $GOPATH/src/
$ go install -v ./lxc
$ lxc remote add <name> UBUNTU_VM_HOST.local

Finally, on macOS

$ ssh enabling-ape.local -A
You can’t perform that action at this time.