Skip to content

Migrate to a new Mac

Marco Massari Calderone edited this page Oct 4, 2020 · 3 revisions

Description

When migrating to a newer Mac, it is sometimes preferable to start with a clean installation rather than a Mac-to-Mac migration to avoid bringing with you clutter files and configurations, but with the perk of having your favourite settings and apps ready to go. For instance, when you think some virus or ad-ware might have compromised your machine.

Prepare the provisioning

You will prepare the provisioning in your old Mac and generate a provisioning package that you will copy to your new Mac to run the provisioning.

Install Splinter in your old Mac

Follow the installation instructions.

Configure your custom profiles

In ./splinter/profiles/ you will find two initial example profiles:

  • base
  • example

Most commonly you will simply need to customise the base profile.

If you intend to create more than one new Mac with different personalisations then you can consider:

  1. customising the base profile with all the common settings
  2. create a copy of the example profile for each new Mac to solely contains the settings that differ for each Mac.

The base profile includes the full set of configuration files with the full set of configuration attributes set the most common desired values.

Each module has its own configuration file with its own attributes and toggles that you can customise.

    base profiles structure

    profiles/
    │
    └── base
        │
        ├── current_user.yml
        ├── dotfiles.yml
        ├── extra_packages.yml
        ├── filevault_option.yml
        ├── homebrew.yml
        ├── mac_app_store.yml
        ├── macos_apps_list.yml
        ├── modules.yml
        ├── new_user.yml
        ├── post_provision.yml
        ├── sophos-endpoint.yml
        ├── ssh_config.yml
        └── system_preferences.yml

Set system preferences

All modules are disabled by default, you will need to:

  1. Enable the modules for which you want to run the provisioning:

     # file: <base_profile>/modules.yml
    
     configure_filevault:       yes # Activate FileVault2, fine-tuning in filevault_options.yml
     configure_sophos_endpoint: no  # Install Sophos Endpoint from your organisation
     configure_homebrew:        yes # Install and Configure Homebrew to be used by all accounts
     configure_system:          no  # Set default settings for the operating system, fine-tuning in osx_config.yml
     configure_dotfiles:        yes # Import your exported dotfiles (explained below)
     configure_extra_packages:  no  # you will restore your system preferences from and export of your current settings
     configure_setapp:          no  # Install SetApp application store and launch it, you will to sing-in and download your favourites manually from the app
     install_mas_apps:          yes # Install apps from Mac App Store
     install_macos_apps:        yes # Install apps from direct links: apps not available in Mac App Store or as a Homebrew Cask
    

    Set configure_system: no because you will restore your system preferences from and export of your current settings

  2. Enable the restoration of you exported dotfiles and configurations

     # file: <base_profile>/dotfiles.yml
    
     restore_preferences_and_dotfiles_from_export: no
    

Export your current system preferences and dotfiles and app lists

./splinter export all

This command will export to ./files/lists and ./files/preferences the following files (if you have any of these subsystems installed):

files/preferences         # your system preferences
                          # your application settings
                          # Dock and menu bar settings
                          # your Internet Accounts registered in System Preferences (iCloud, Google Accounts, etc.)
                          # all the dotfiles in your home dir                            
                          # and anything that Macprefs tool can backup (https://github.com/clintmod/macprefs)

homebrew_taps.txt         # list of brew taps, packages and cask formulas
homebrew_cask_apps.txt
homebrew_packages.txt

ruby_gems.json            # list of user-installed Ruby gems
mas_apps.txt              # list of installed apps from MacAppStore
npm_global_packages.json  # list of NPM packages
pip_packages.json         # list of user-installed Python packages from Pip

These files will be used by Splinter to reinstall the same set of packages and apps

Most probably not all your applications are installed via MacAppStore or Homebrew Cask. We can fix that!

You can browse the list of applications available as Hombrew Cask formula and add your favourite applications to homebrew_cask_apps.txt.

This will automate the installation of your favourite apps

Create your list of non-MAS and non-Cask Applications

You can configure a list of application for which you want to automate the installation even if they are not present in the Mac App Store or as a Homebrew Cask.

you can edit that list in

# file: <custom_role>/macos_apps.yml

macos_apps_install_list:
    - { u: 'https://central.github.com/deployments/desktop/desktop/latest/darwin',
        f: 'GitHubDesktop.zip',
        n: 'GitHub Desktop',
        t: 'zip',
      }
    - ....

To be honest, this is not the most straight forward system so I advise reading the documentation in the GitHub documentation from the developer of the ansible-macos-apps-install Ansible role

Setup FileVault2 encryption

To enable FileVault2 set this in your base profile:

    # file: <base_profile>/modules.yml

    configure_filevault: yes

This will generate a Personal Recovery Key that will be saved in the desktop of the new Mac (for you to store it in a safe place).

In case you want to use the same FileVault2 Master password for both your old and new Macs, you can consider using an Institutional Recover key explained here.

Add custom profile and desktop background pictures

  1. Copy the profile picture you want to assign to your new Mac account in .jpg or .png formats into:

     `(splinter project)/files/profile_pictures/`
    
  2. Copy your chosen desktop picture in .jpg or .png formats into:

     `(splinter project)/files/`
    
  3. Specify the path/name in the pictures files:

     # file: <base_profile>/current_user.yml
    
     current_user_profile_picture: "files/profile_pictures/my_profile_picture.png"
     current_user_desktop_picture: "files/desktop_pictures/custom_desktop_image.jpg"
    

Create the provisioning package

Now that you have added all your custom settings, files, the export of your apps and system preferences to the project folder you can create a provisioning package that you will copy to your new Mac.

    ./splinter create package

This command will create (splinter project)/SplinterProvision.dmg with a rough size of 600MB

Provision the new Mac

New Mac preparation steps

  1. Login in the new Mac with the account you will be using

  2. Login into your iCloud account to allow Mac App Store apps installation:

    a. Open System Preferences -> Internet Accounts -> iCloud

    b. Authenticate your iCloud account

  3. Add the Terminal application (located in /Applications/Utilities/) to the "Full Disk Access" policy

    a. Open System Preferences -> Security & Privacy -> Privacy -> Full Disk Access

    b. Authenticate to unlock the list of allowed applications

    c. Add Terminal to the list of allowed apps, save and close.

  4. Connect to a WiFi network.

  5. Transfer a copy of the SplinterProvision.dmg provisioning archive from your old Mac to the new Mac:

  • option 1: transfer the directory using Share->AirDrop (you need to make the new Mac discoverable by everyone).
  • option 2: transfer with a USB stick.
  1. Mount the provisioning archive

New Mac provisioning

  1. from the Terminal application access the mounted disk image

    cd /Volumes/SplinterProvision

  2. run splinter

    # You need to escape spaces when defining the user's full name
    ./splinter provision -h 'Computer-Name'
    

    if you have set up a 'role' profile you can specify that with "-r <role_profile>"

  3. Splinter will request you to enter the current user account (to be used as sudo password throughout the whole process).

The rest of the provisioning can be mostly unattended but a few applications might require some system privacy authorisation, for instance vagrant and if you do not allow that in time and the installation fail you can re-run the brew installation command or re-run splinter

During the deployment a few applications might request authorisation to run so do not leave the Mac completely unattended.

Post Provisioning manual Steps

Authorise "Virtualbox" kext if you installed it via homebrew or macos_apps list

This applies only if you have installed Oracle's Virtualbox

  1. Go to System Preferences -> Security & Privacy -> General

  2. Click the Allow button next to the request of authorisation for "Oracole America, Inc." software

  3. re-run VirtualBox installation, this time it should succeed without errors

    brew cask reinstall VirtualBox

Note: if you want to create additional accounts check out the process to Create an additional account for your kids or partner