Skip to content

Instantly share code, notes, and snippets.

@icedterminal
Last active September 30, 2022 21:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save icedterminal/e864cdde5e596f709219dd43be5cc943 to your computer and use it in GitHub Desktop.
Save icedterminal/e864cdde5e596f709219dd43be5cc943 to your computer and use it in GitHub Desktop.
Helpful macOS commands
#!/bin/bash
# Mount EFI
sudo diskutil mount EFI
# Rebuild Kextcache
sudo kextcache -i /
# Disable Gatekeeper. Allow apps from anywhere, unsigned
sudo spctl --master-disable
# Add Android Debug Bridge to PATH
echo 'export ANDROID_HOME=/Users/$USER/Path/to/sdk' >> ~/.bash_profile
echo 'export PATH=${PATH}:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools' >> ~/.bash_profile
source ~/.bash_profile
# Folder and File links
ln -s /Path/source /Path/destination
# Reset network interfaces
sudo su
rm /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist
rm /Library/Preferences/SystemConfiguration/com.apple.network.eapolclient.configuration.plist
rm /Library/Preferences/SystemConfiguration/com.apple.smb.server.plist
rm /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist
rm /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist
rm /Library/Preferences/SystemConfiguration/preferences.plist
# Reset Finder
killall Finder
rm -rf ~/Library/Caches/com.apple.finder/*
rm ~/Library/Preferences/com.apple.finder.plist
# Download openDirs
brew install wget
wget -r --no-parent -P /Path/to/download http://www.site.com/dir
# PIP
sudo easy_install pip
# Xcode stand alone command line tools
xcode-select --install
# Ad hoc signing. Xcode must be installed!
codesign --force --deep --sign - /path/to/app.app
codesign -dvvvv /path/to/app.app
# Reset launchpad
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock
# Disable hibernate
sudo su
pmset -a hibernatemode 0
rm /var/vm/sleepimage
# List all 3rd party kexts
kextstat | grep -v com.apple
# Repair kext permissions
sudo su
chmod -Rf 755 /S*/L*/E*
chmod -Rf 755 /L*/E*
chown -Rf 0:0 /S*/L*/E*
chown -Rf 0:0 /L*/E*
# Repair hosts permissions
sudo su
chmod -Rf 644 /private/etc/hosts
chown -Rf 0:0 /private/etc/hosts
# Edit hosts
sudo nano /private/etc/hosts
# Power management details
# Can be used to find what is preventing sleep/hibernate
pmset -g assertions
pmset -g log
# Mount system r/w
# Disable SIP first! <FF070000>
sudo mount -uw /
killall Finder
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment