| Keys | Description |
|---|---|
⌥ |
Startup Manager |
⇧ |
Safe mode |
D |
Apple Diagnostics |
⌥ + D |
Apple Diagnostics over Internet |
⌘ + V |
Verbose mode |
⌘ + S ó ⌘ + R |
Single-user mode |
⌘ + R |
Install the latest macOS that was installed on your Mac |
⌥ + ⌘ + R |
Upgrade to the latest macOS compatible with your Mac |
⇧ + ⌥ + ⌘ + R |
Install the original macOS, or closest still available |
⌥ + ⌘ + P + R |
Reset NVRAM or PRAM |
T |
Target Disk |
⌃ + ⌥ + ⇧ |
Reset SMC |
🚫🔌 + ⏻(10s) + 🔌 + ⏻(10s) + ⏻ |
Bypass SMC (Don't let go ⏻ for 20s) |
Open the Terminal.app from within macOS Recovery (⌘ + R) and type:
resetpassworddiskutil secureErase 0 /dev/disk4cd ~/Downloads ; curl -O https://raw.githubusercontent.com/munki/macadmin-scripts/main/installinstallmacos.py ; sudo python installinstallmacos.pydefaults read /Volumes/Install\ macOS\ */Install\ macOS\ *.app/Contents/Info.plist DTPlatformVersionhdiutil burn image.isoAn ISO with a DOS/MBR boot sector is required.
file ubuntu-20.04-desktop-amd64.iso
diskutil unmountDisk /dev/disk2
sudo gdd if=ubuntu-20.04-desktop-amd64.iso of=/dev/rdisk2 bs=4096 status=progress
sudo cmp /dev/disk2 ubuntu-20.04-desktop-amd64.isoThe /efi/boot/bootx64.efi bootloader is required.
diskutil list
diskutil partitionDisk /dev/disk2 1 MBR FAT32 W10_1909SPA R
hdiutil mount ~/Downloads/Win10_1909_Spanish\(Mexico\)_x64.iso -mountpoint /Volumes/ISO
rsync -avh --info=progress2 /Volumes/ISO/ /Volumes/W10_1909SPA/
diskutil unmountDisk /dev/disk2Define constants
DEVICE_ID="/dev/disk2"
PART_NAME="W10_2111X64"
ISO_NAME=Win10_21H2_Spanish\(Mexico\)_x64.iso Format the USB
diskutil list
# diskutil partitionDisk MountPoint [numberOfPartitions] [APM|MBR|GPT] [part1Format[FAT32|ExFAT|JHFS+|APFS|...] part1Name part1Size[%|R] part2Format part2Name part2Size part3Format part3Name part3Size ...]
diskutil partitionDisk $DEVICE_ID 2 MBR FAT32 $PART_NAME $((558 * 100 / 775 + 1))% EXFAT Archivos RSet the partition as active (boot flag)
(echo flag 1 ; echo write ; echo y ; echo exit) | sudo fdisk -e $DEVICE_ID ; echoWrite the syslinux's MBR (Master Boot Record)
curl https://mirrors.edge.kernel.org/pub/linux/utils/boot/syslinux/syslinux-4.07.tar.gz -o syslinux-4.07.tar.gz
tar -zxvf syslinux-4.07.tar.gz
diskutil unmountDisk $DEVICE_ID
sudo dd if=syslinux-4.07/mbr/mbr.bin of=$DEVICE_ID bs=440 count=1Write the syslinux's VBR (Volume Boot Record) on an Intel Mac
curl https://raw.githubusercontent.com/unetbootin/unetbootin/master/src/unetbootin/unetbootin.app/Contents/Resources/syslinux-mac -o syslinux-mac
chmod +x syslinux-mac
sudo ./syslinux-mac -i $(echo $DEVICE_ID)s1Write the syslinux's VBR (Volume Boot Record) on an Apple Silicon Mac
cp syslinux-4.07/core/ldlinux.sys /Volumes/$PART_NAME/
# Calculate ldlinux.sys LBA sector
diskutil unmountDisk $DEVICE_ID
brew install mtools
echo "drive w: file=\"${DEVICE_ID/disk/rdisk}s1\"" > /tmp/mtools.conf
sudo MTOOLSRC=/tmp/mtools.conf minfo w:
# LBA sector = Reserved sectors + (Number of FATs × Sectors per FAT)
# LBA sector = 32 + (2 * 4000) = 8032 = 0x00001F60 = \x60\x1F\x00\x00 (Little Endian)
# Write customized VBR
sudo dd if=${DEVICE_ID/disk/rdisk}s1 of=syslinux-4.07/usb-bpb.bin bs=512 count=1
dd if=syslinux-4.07/core/ldlinux.bss of=syslinux-4.07/usb-bpb.bin bs=1 seek=90 conv=notrunc
printf "\x60\x1F\x00\x00" | dd of=syslinux-4.07/usb-bpb.bin bs=1 seek=504 conv=notrunc
sudo dd if=syslinux-4.07/usb-bpb.bin of=${DEVICE_ID/disk/rdisk}s1 bs=512 count=1 conv=notrunc
# Optionally, set ldlinux.sys FAT attributes (System, Hidden, Read only)
sudo MTOOLSRC=/tmp/mtools.conf mattrib +s +h +r w:/ldlinux.sys
sudo MTOOLSRC=/tmp/mtools.conf mdir w:/
sudo MTOOLSRC=/tmp/mtools.conf mattrib w:/ldlinux.sys
diskutil mountDisk $DEVICE_IDWrite the syslinux's modules (COM32 modules)
mkdir /Volumes/$PART_NAME/syslinux
cp syslinux-4.07/com32/chain/chain.c32 /Volumes/$PART_NAME/syslinuxWrite the syslinux's config (syslinux.cfg)
echo -e "DEFAULT boot\n\nLABEL boot\n\tMENU LABEL boot\n\tCOM32 chain.c32\n\tAPPEND fs ntldr=/bootmgr" > /Volumes/$PART_NAME/syslinux/syslinux.cfgMount the ISO
hdiutil mount ~/Downloads/$ISO_NAME -mountpoint /Volumes/ISOValidate if the install.wim file is greater than 4GiB minus 1 byte
if (( `wc -c</Volumes/ISO/sources/install.wim` > 2**32-1 )) ; then echo Exceeds ; fiCopy the small ISO files to the USB
rsync -avh --info=progress2 --exclude=sources/install.wim /Volumes/ISO/ /Volumes/$PART_NAME/
# or
rsync -avh --progress --exclude=sources/install.wim /Volumes/ISO/ /Volumes/$PART_NAME/
# or
cp -Rpv /Volumes/ISO/ /Volumes/$PART_NAME/Copy the install.wim file to the USB in smaller parts
brew install wimlib
wimlib-imagex split /Volumes/ISO/sources/install.wim /Volumes/$PART_NAME/sources/install.swm 3800Unmount the USB
diskutil unmountDisk $DEVICE_ID
# or
hdiutil unmount /Volumes/$PART_NAME/echo -e "[Channel]\nRetail" > /Volumes/$PART_NAME/sources/ei.cfgWindows: wmic path softwarelicensingservice get OA3xOriginalProductKey
GNU Linux: sudo hd /sys/firmware/acpi/tables/MSDM
Use the Server License Manager tool
slmgr /xpr- Open Task Manager
Shift+F10- Run
taskmgr
- End the
Network Connection Flow(i.e.Flujo de conexión de red) task several times.
macOS ~/.zshrc
# Sent battery data to a remote server
battery-report() {
# Print headers
echo ---Date------Time---Runtime-Condition-Cycles-State-Capacity
# Record starting time (Epoch time)
local start_time=$SECONDS
while true
do
# Calculate minutes running
local runtime=$(( (SECONDS - start_time) / 60 ))
# Query battery data
local bat_data=$(system_profiler SPPowerDataType | awk -F: -v hora="$(date +%Y-%m-%d-%H.%M.%S)" -v min="$runtime" '/Full Charge Capacity/ {gsub(/ /,""); cap=$2} /State of Charge/ {gsub(/ /,""); soc=$2} /Cycle Count/ {gsub(/ /,""); cyc=$2} /Condition/ {gsub(/ /,""); cond=$2} END {print hora "-" min "-" cond "-" cyc "-" soc "-" cap}')
# Print battery data (eg. 2026-09-23-12.46.27-4-Normal-99-100-7638)
echo "$bat_data"
# Send data to HTTP server
curl -s -o /dev/null -G "http://pbx.grupopv.mx" --data-urlencode "battery-report=$bat_data"
sleep 10
done
}
battery-server(){
while true
do
echo -e "HTTP/1.1 200 OK\r\n\r\nOK" | nc -l 4000
done
}Apache server
sudo grep battery-report /var/log/apache2/access.log