Skip to content

Instantly share code, notes, and snippets.

@startergo
startergo / macOS-in-virtualbox.md
Created June 26, 2020 13:30 — forked from rob-smallshire/macOS-in-virtualbox.md
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\ Sierra.app/.

Now run the following commands to build a suitable VM image from the installer:

git clone https://github.com/jonanh/osx-vm-templates
cd osx-vm-templates/packer

sudo ../prepare_iso/prepare_vdi.sh -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ Sierra.app/ .

[wsl2]
kernel=C:\\Users\\JAKA\\vmlinux
@startergo
startergo / myOC.tool
Created August 28, 2020 15:41 — forked from dakanji/myOC.tool
Builds/Patches OpenCore (v0.5.x onwards)
#!/usr/bin/env bash
# myOC.tool
# A tool to patch and/or build OpenCore (v0.5.x onwards)
#
# (c) 2020 Dayo Akanji <dakanji@users.sourcefoge.net>
# MIT License
# Script Params
# LBL_FIX : '0' (Default) or any other value to address drive APFS Label Bug.
@startergo
startergo / modifyedid.py
Created October 31, 2020 22:23 — forked from xxxzc/modifyedid.py
Get and modify laptop 4k display edid for big sur
# Get and modify laptop 4k display edid for big sur
# Created by xxxzc
# Reference: http://bbs.pcbeta.com/forum.php?mod=viewthread&tid=1866466&highlight=edid
from subprocess import check_output
from base64 import b64encode
edid = check_output('ioreg -lw0 | grep -i "IODisplayEDID"',
shell=True, encoding='utf-8')
edid = edid.split('<')[1].split('>')[0]
print('Display EDID:', edid)
edid = edid[:108] + 'a6a6' + edid[112:] # set refresh rate to 48Hz
@startergo
startergo / Resizeallavailablespace.command
Created November 27, 2020 13:18
Resizing a macOS VM’s APFS boot drive to use all available disk space
#!/bin/bash
# This script is designed for use with virtual machines which
# need to resize their boot volumes. The script checks the boot
# volume using the diskutil info command and detects if the boot
# volume is using HFS+ or APFS for the boot volume's filesystem.
#
# If the boot volume is using HFS+ for its filesystem, the
# diskutil resize command is used to assign the boot volume
# all available free space.
@startergo
startergo / diskutil eraseVolume format
Created November 27, 2020 14:00
diskutil eraseVolume format
diskutil eraseVolume format name MountPoint|DiskIdentifier|DeviceNode
Erase a single disk partition or whole, laying down a new file system volume
that will be empty of files. Format is the specific file system personality
name of the new volume, e.g. "Journaled HFS+" or a common alias e.g. "jhfs+".
Name is the new volume name (subject to file system naming restrictions) or
can be specified as %noformat% to skip initialization (to skip newfs). You
cannot erase the boot volume. A pseudo-format of "free" or "Free Space" will
remove the partition altogether, leaving a free space gap in the partition map.
Ownership of the affected disk is required.
Examples: diskutil eraseVolume JHFS+ UntitledHFS /Volumes/SomeDisk
diskutil list
/dev/disk0 (internal, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *251.0 GB disk0
1: EFI ⁨EFI⁩ 314.6 MB disk0s1
2: Apple_APFS ⁨Container disk2⁩ 188.0 GB disk0s2
3: Microsoft Basic Data ⁨BOOTCAMP⁩ 62.7 GB disk0s3
/dev/disk1 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
ls -ls /usr/bin/python*
0 lrwxr-xr-x 1 root wheel 75 Jan 1 2020 /usr/bin/python -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
0 lrwxr-xr-x 1 root wheel 82 Jan 1 2020 /usr/bin/python-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
0 lrwxr-xr-x 1 root wheel 75 Jan 1 2020 /usr/bin/python2 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
0 lrwxr-xr-x 1 root wheel 75 Jan 1 2020 /usr/bin/python2.7 -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
0 lrwxr-xr-x 1 root wheel 82 Jan 1 2020 /usr/bin/python2.7-config -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
24 -rwxr-xr-x 1 root wheel 137568 Jan 1 2020 /usr/bin/python3
0 lrwxr-xr-x 1 root wheel 76 Jan 1 2020 /usr/bin/pythonw -> ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
0 lrwxr-xr-x 1 root whe
@startergo
startergo / Apple technical guides
Last active December 1, 2020 00:35
Apple technical guides
Shell Scripting primer: https://developer.apple.com/library/archive/documentation/OpenSource/Conceptual/ShellScripting/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004268-TP40003516-SW1
Technical Note TN2065 do shell script in AppleScript:
https://developer.apple.com/library/archive/technotes/tn2065/_index.html#//apple_ref/doc/uid/DTS10003093
Information Property List Key Reference:
https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Introduction/Introduction.html#//apple_ref/doc/uid/TP40009248-SW1
Debugging with Xcode:
https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/debugging_with_xcode/chapters/about_debugging_w_xcode.html#//apple_ref/doc/uid/TP40015022
Markup formatting refference:
https://developer.apple.com/library/archive/documentation/Xcode/Reference/xcode_markup_formatting_ref/index.html#//apple_ref/doc/uid/TP40016497-CH2-SW1
Xcode Build system guide: