Skip to content

Set up MacOS on ESXi

April 25th, 2020 - IT(1 min)

I’ve decided to use Ansible to set up a virtual VM with MacOS. I used to have a mac or two, but my hardware is obsolete now (Intel core 2 duo, anyone?) and I can’t justify paying a couple of thousand Euros every few years for what practically amounts to renting machines.

I’ve got a while ago a cheapo server, shoved in some memory and found a blog entry outlining steps to install MacOS on ESXi. Cool!

Set up the VM

  1. First step is to patch ESXi, because you can’t just install MacOS out of the box.
  2. Then, I prepared the VM. It took me few tries, but I got the following configuration ready:
    1. min 16GB of RAM
    2. min 2 vCPUs (I allocated 4)
    3. min 250GB of disk space. SSD is essential for the machine!

Install the OS

  1. Install MacOS (Mojave at the time of writing)
  2. Create an apple id account (if you don’t have it)
  3. Update to most recent version
  4. Install XCode
  5. Accept license agreement
  6. Install tools etc.

Now, the bare VM is ready. The next step is to set up all the tools one might need for e.g. development. This will be done via Ansible.

Prepare Ansible

First step after the OS is installed is to set up password-less login from the master. From the master node, run:

cd ~/.ssh
cat ./id_rsa.pub | ssh [email protected] 'cat  >> .ssh/authorized_keys'

Root

As quite a lot of commands need root (not administrator), we need to enable it on the machine (at least until we finish the Ansible setup). Use this link to enable root on the MacOS VM.

On the master node, you can set up a secret file with the encoded password. This SO question offers several pros and cons for different solutions

To enable elevation, you will then be able to execute a playbook like this:

ansible-playbook mac.yaml --extra-vars "ansible_become_pass=<password>"

Next chapter will detail the Ansible setup.

HTH,

Share on
Reddit
Linked in
Whatsapp

A little experiment: