Skip to content

Instantly share code, notes, and snippets.

@startergo
startergo / ioreg.pl
Created January 8, 2021 17:25 — forked from joevt/ioreg.pl
perl script parses ioreg output, can output JSON, dumps M1 Mac display timings.
#!/bin/perl
# by joevt Dec 30, 2020
use 5.010;
use strict;
#use warnings;
use Data::Dumper qw(Dumper);
use JSON::PP;
@startergo
startergo / M1MacTimings.sh
Created January 8, 2021 17:16 — forked from joevt/M1MacTimings.sh
List the display timings on an M1 Mac
#!/bin/bash
# by joevt Jan 7/2021
dodump=1
if [[ "$1" == "-s" ]]; then
dodump=0
shift
fi
@startergo
startergo / APFS Container cloning.md
Last active February 2, 2021 17:54 — forked from darwin/readme.md
APFS Container cloning/replicating under macOS 11.0 (Big Sur) - with a bootable system

It is the year 2020 and replicating APFS containers still sucks. One would expect it would be a simple copy and paste in the Disk Utility app but this is still far from reality.

Last year I wrote how I managed to clone my macOS system under Catalina. The main trick was to create a DMG file with multiple volumes, mount it on target machine and drop to command-line to do asr restore from synthetised disk while avoiding possible pitfalls.

The good news is that Apple devs definitely worked on improving this under Big Sur and added some documentation (see man asr). But I didn't understand it fully on first read. Maybe someone could explain how is this supposed to work?

@startergo
startergo / _verify-repair-permissions-disk.md
Created January 1, 2021 23:55 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /

@startergo
startergo / create-win10-usb-on-mac.sh
Last active December 29, 2020 17:08 — forked from ryanmaclean/create-win10-usb-on-mac.sh
Create a Bootable UEFI Windows USB stick from an ISO on Apple macOS
# Just a quick update for GPT and to use `rsync` instead of `cp`!
# That means this applies to UEFI boot, though for legacy BIOS boot, feel free to swap
# GPT to MBR below.
# Requires https://homebrew.sh to split the install.wim file
brew install wimlib
# First, we need to find our device. BEFORE inserting your USB drive, run the
# following:
diskutil list
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Kernel Flags</key>
<string>mbasd=1</string>
</dict>
</plist>
@startergo
startergo / osx_defaults.sh
Created December 21, 2020 14:33
OSX Defaults to setup a brand new machine
#!/usr/bin/env bash
# TODO: Need to figure out the settings for the following:
# 1) Dock: Items with order (not capturing binary data - since that is dependent on installed apps)
# 2) Security & Privacy Preferences: Full Disk Access, Camera, Microphone
# 3) Login items for my user (i.e. apps started when I login)
# 4) Retina displays
##
# This is a script with useful tips taken from:
@startergo
startergo / DiskUtil.sh
Last active December 26, 2021 17:53 — forked from joevt/DiskUtil.sh
macOS disk labels, mounting partitions
#!/bin/bash
# by joevt Dec 24, 2021
directblesscmd="/Volumes/Work/Programming/XcodeProjects/bless/bless-204.40.27 joevt/DerivedData/bless/Build/Products/Debug/bless"
usedirectbless=0
if [[ -d /System/Library/PrivateFrameworks/APFS.framework/Versions/A ]]; then
if [[ ! -f "$directblesscmd" ]]; then
echo "# Download and build bless from https://github.com/joevt/bless , then update the path of directbless defined in DiskUtil.sh"
else
usedirectbless=1
@startergo
startergo / EDIDUtil.sh
Created November 30, 2020 01:31 — forked from joevt/EDIDUtil.sh
A set of shell functions used to view and edit EDIDs.
# EDIDUtil.sh v5.12
# by joevt Jun 27/2020
#=========================================================================================
# Modify EDID
getarrstart () {
# bash arrays start at 0
# zsh arrays start at 1 (applies only to [] syntax) but this can be changed with "setopt ksh_arrays"
# zsh arrays start at 0 when using ${arr:x:x} syntax