Skip to content

Instantly share code, notes, and snippets.

View acodega's full-sized avatar

Adam Codega acodega

View GitHub Profile
@acodega
acodega / Finding defaults cfprefsd changes
Created December 19, 2024 18:55
log stream command
log stream --debug --predicate 'process == "cfprefsd" && eventMessage CONTAINS "wrote the key"'
@acodega
acodega / Uncheck the check
Last active December 24, 2024 16:36
Mac login Reopen windows option
runAsUser defaults write com.apple.loginwindow TALLogoutSavesState -bool false
runAsUser defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false
@acodega
acodega / 6E compatible
Created November 20, 2024 19:54
Model names and regex for 6E compatible Macs
iMac (24-inch, 2024) Mac16,2 Mac16,3
Mac mini (2024) Mac16,10 Mac16,11
Mac Pro (2023) Mac14,8
Mac Studio (2023) Mac14,13 Mac14,14
MacBook Air (13-inch, M3, 2024) Mac15,12
MacBook Air (15-inch, M3, 2024) Mac15,13
MacBook Pro (14-inch, M4 Pro, 2024) Mac16,8
MacBook Pro (14-inch, M4 Max, 2024) Mac16,6
MacBook Pro (14-inch, M4, 2024) Mac16,1
MacBook Pro (16-inch, 2024) Mac16,7 Mac16,5
set theDialogText to "The current date and time is " & (current date) & "."
display dialog theDialogText
--> Result: {button returned:"OK"}
startosinstall command & syntax
Command: startosinstall
Requires root access: Yes
Parameters:
- -usage: Displays all parameters available for the command.
- -agreetolicense: Agrees to the license agreement during deployment (Required for automated deployments).
@acodega
acodega / SIP how to
Created March 13, 2019 13:08
See what's SIPed from Terminal
cat /System/Library/Sandbox/rootless.conf
ls -ale # and look for com.apple.rootless
#!/bin/bash
ibridge="$(/usr/sbin/system_profiler SPiBridgeDataType | /usr/bin/grep 'Model Name')"
if [[ "$ibridge" == "" ]] ;
then
defaults write /Library/Preferences/org.myorg.machineDetails.plist awesomechip -string "None"
else
defaults write /Library/Preferences/org.myorg.machineDetails.plist awesomechip -string "$ibridge"
fi
@acodega
acodega / Redirections
Created March 1, 2019 14:26
in macOS Terminal
# Output to a file, overwriting it if it exists
ls > ~/Desktop/file.txt
# Output to a file, appending to it if it exists
ls >> ~/Desktop/file.txt
# Pipe output to an application, the "-fe" tag will instruct to read the piped input and open it as a new unsaved file
ls | open -fe
# Pipe output to the Mac's clipboard
log show --predicate 'eventMessage contains "Previous shutdown cause"' --last 24h
@acodega
acodega / Clearing DNS cache
Created January 15, 2019 14:29
Clearing DNS cache, 10.5 through 10.14
# 10.10.4-Current
sudo killall -HUP mDNSResponder
# 10.10.0-10.10.3
sudo discoveryutil mdnsflushcache
# 10.7-10.9
sudo killall -HUP mDNSResponder
# 10.5-10.6