Crafting a Thorough Guide for New Developers (macOS on VirtualBox)

Nicholas An
4 min readJul 5, 2021

Here comes a long-tough part of writing the guide for our next developers. Installing and running macOS on a virtual machine is not an easy task especially if you are running it on a laptop with less RAM (I haven’t done this task on a desktop with 32GB or more RAM so I cannot say it would be easy on such desktop environment, to be honest). Thankfully my laptop has 16 GB of RAM so it barely runs. Let’s get started.

Installation of macOS on a VM

I used VirtualBox in order to commence this task. The issue with installation was that I could not find a valid drive to install on at the outset.

There is nothing to select

This can be solved by going to Disk Utility and erasing a virtual hard disk with Mac OS Extended (Journaled) as the format.

You need to erase the virtual hard disk with “Mac OS Extended (Journaled)”

It’s going to take forever to install the macOS. I used Big Sur and it took about a couple of hours. Once it is installed, you will realize it also takes forever for the basic GUI to turn up and your mouse pointer will take 5 or more seconds to respond. It’s time for you to change the VM settings so that the virtual Mac machine takes at least 8 GB of RAM and GUI gets more resources.

I gave about 9 GB of RAM to this virtual Mac machine
Gave some extra Video Memory and checked “Enable 3D Acceleration”

This will help a lot but you should still expect some lagging. Nevertheless, this was enough for me to continue working on it since after all, I am not doing anything too fancy here.

Installation of Homebrew

Some people would take Homebrew as given since it is the very first thing that you install and forget about it. Well, here are some reminders of the fresh feeling of setting up your dev environment.

$ export HOMEBREW_CORE_GIT_REMOTE="https://github.com/Homebrew/homebrew-core.git"$ export HOMEBREW_BREW_GIT_REMOTE="https://github.com/Homebrew/brew.git"$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Then just check if it is installed properly by brew --version .

Installing basic tools

First, we gotta install Vim or Emacs. Any text editing tool will do. Unlike Linux, you do not use the sudo command in brew.

$ brew install vim

or

$ brew install emacs

And you should install Git.

$ brew install git

Then you should install Pyenv and Python

# Update Homebrew and install Pyenv
$ brew update
$ brew install pyenv
# This is optional. Don't worry if it fails.
$ cd ~/.pyenv && src/configure && make -C src
# Install Python and enable it globally. (you can use other versions of Python)
$ pyenv install 3.7.9
$ pyenv global 3.7.9

Now it’s time to create a virtual environment and activate it.

$ python -m venv myenv
$ source myenv/bin/activate

Gaining Authentication for your GitHub repo

By default, your new machine won’t have access to the GitHub repository, even if you are logged in to GitHub on your browser. For your new Terminal setup, you will have to register with a new SSH key.

  • enter ssh-keygen -t ed25519 -C "youremail@example.com"
  • eval "$(ssh-agent -s)"

Then you need to modify your ~/.ssh/config file if you are using Sierra 10.12.2 or later.

  • touch ~/.ssh/config
  • open your ~/.ssh/config file and insert the following:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519

After saving and closing, enter:

  • ssh-add -K ~/.ssh/id_ed25519
  • copy the key to the clipboard by entering pbcopy < ~/.ssh/id_ed25519.pub
  • go to the “SSH and GPG keys” section of ‘Profile’ -> ‘Settings’ on Github and add the new key by pasting the copied key.
the list of SSH keys

Then you are all set! You are ready to clone the GitHub repository and install all the necessary packages which I explained in my previous article.

--

--