Skip to content

Instantly share code, notes, and snippets.

@ridvanaltun
Last active June 25, 2021 09:46
Show Gist options
  • Save ridvanaltun/80bd2646a9a36fd6e1fad4014de94ea5 to your computer and use it in GitHub Desktop.
Save ridvanaltun/80bd2646a9a36fd6e1fad4014de94ea5 to your computer and use it in GitHub Desktop.
macOS X El Capitan with Vagrant

Overview

Version: OS X El Capitan 10.11.6

Build Version: 15G31

Provider: VirtualBox

System Requirements

  • 4 GB of memory
  • 2 CPUs
  • 128 GB dynamically-allocated disk (12.21 GB using by operation system)

What's included?

  • Xcode Command Line Tools (version 2343)

Credentials

user:vagrant
password:vagrant

Requirements

Note: Default download location of boxes: ~/.vagrant.d/boxes. You can change it via the VAGRANT_HOME environment variable.

Setup

# Create a folder and go into it
$ mkdir macos-el-capitan && cd macos-el-capitan

# Download necessary Vagrant box
$ vagrant init jhcook/osx-elcapitan-10.11
  • Save below code as Vagrantfile
Vagrant.configure("2") do |config|
    config.vm.box = "jhcook/osx-elcapitan-10.11"
    
    # Synced folder are not supported under Mac OS X
    config.vm.synced_folder ".", "/vagrant", :disabled => true

    # Temporary fix for annoying "Replace key" issue
    config.ssh.insert_key = false

    config.vm.provider "virtualbox" do |vb|
        # Customize the amount of memory on the VM:
        vb.memory = "4096"
        
        #vb.customize ["modifyvm", :id, "--vram", "2048"]
        
        # Display the VirtualBox GUI when booting the machine. You might want to turn 3D accelerating to speed-up VM GUI.
        #vb.gui = true
        
        # Fix "hfs mounted macintosh hd on device root_device" issue
        vb.customize ["modifyvm", :id, "--cpuidset", "1","000206a7","02100800","1fbae3bf","bfebfbff"]

        # Some more hacks for device recognition
        vb.customize ["setextradata", :id, "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct", "MacBookPro11,3"]
        vb.customize ["setextradata", :id, "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion", "1.0"]
        vb.customize ["setextradata", :id, "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct", "Iloveapple"]
        vb.customize ["setextradata", :id, "VBoxInternal/Devices/smc/0/Config/DeviceKey", "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc"]
        #vb.customize ["setextradata", :id, "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC", "1"]
        
        # Set resolution on macOS, enable vb.gui first
        # Values: 0 = 640x480, 1 = 800x600, 2 = 1024x768, 3 = 1280x1024, 4 = 1440x900, 5 = 1920x1200
        #vb.customize ["setextradata", :id, "VBoxInternal2/EfiGopMode", "5"]
        #vb.customize ["setextradata", :id, "CustomVideoMode1", "1920x1080x32"]
        #vb.customize ["setextradata", :id, "GUI/CustomVideoMode1", "1920x1080x32"]
    end
end

Usage

# Start machine
$ vagrant up

# Connect to machine
$ vagrant ssh

# Show Mac OS X operating system version
> sw_vers

# Stop machine
$ vagrant halt

Info

License

Apple SLAs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment