Skip to content

Instantly share code, notes, and snippets.

@startergo
startergo / debug.h
Last active July 15, 2021 15:55 — forked from knightsc/debug.h
macOS Debug boot-args
/* Debug boot-args */
#define DB_HALT 0x1. /* Halt at boot-time and wait for debugger attach (gdb) */
//#define DB_PRT 0x2 /* Send kernel debugging printf output to console */ -- obsolete
#define DB_NMI 0x4 /* Drop into debugger on NMI (Command–Power, Command-Option-Control-Shift-Escape,
/* or interrupt switch) */
#define DB_KPRT 0x8 /* Send kernel debugging kprintf output to serial port*/
#define DB_KDB 0x10 /* Make ddb (kdb) the default debugger (requires a custom kernel) */
//#define DB_SLOG 0x20 /* Output certain diagnostic info to the system log */ -- obsolete
#define DB_ARP 0x40 /* Allow debugger to ARP and route (allows debugging across routers and removes
/* the need for a permanent ARP entry, but is a potential security hole)—not
@startergo
startergo / dumpvols.sh
Created March 30, 2021 03:35 — forked from joevt/dumpvols.sh
A script to help with diagnosing legacy BIOS boot issues on Macs
#!/bin/bash
#
# Get Partition Info from all disks
#
# Written by joevt updated Dec 29. 2020
# Patches marked "rgh" July, 2010, to dump information beyond the
# four bios partitions
#
# sudo ./dumpvols.sh > dumpvols_result.txt 2>&1
#
@startergo
startergo / codesign.example
Created January 14, 2021 14:23 — forked from carlashley/codesign.example
Code Signing Scripts on macOS
#Find valid code signing certificates with:
#/usr/bin/security find-identity -p codesigning -v
#Eg:
#[carl@pegasus]:outset # security find-identity -p codesigning -v
# 1) A898234JHSDFH38WERKHJSDFLJ2UY4092367HJK9H4J18 "Mac Developer: foo@example.org (ABC01FFFGH)"
# 1 valid identities found
#Code Sign file with:
#/usr/bin/codesign -s "Mac Developer: foo@example.org (ABC01FFFGH)" -i <bundleID> <file>
@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 — forked from vraravam/osx-defaults.sh
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: