Created
August 31, 2017 13:06
-
-
Save byjpr/6b142249124c15338e8163bf018e7dca to your computer and use it in GitHub Desktop.
Useful MacOS Commands
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check the current status of System Integrity Protection (SIP) | |
csrutil status | |
# Reset Permissions on MacOS Sierra the same way you used to with previous versions of OS X. | |
# You may need to disable SIP before this works. I suggest re-enabling SIP afterwards. | |
diskutil resetUserPermissions / `id -u` | |
# Returns file/directory permissions formatted as number values resembling those you would use with chmod | |
stat -f '%A %N' * | |
# Clean up a folder containing many projects | |
# Remove all folders/files named "node_module" even if there is a space in the name. | |
find . -name "node_modules" -exec rm -rf '{}' + | |
# Removes flags for hidden and/or locked files that cannot be deleted. | |
chflags nohidden,nosappdn,noarch,noschg | |
# Find processes that are currently using and may have a lock on some file | |
lsof | |
# FInd processes are listening on a specific TCP port (prefix with sudo to see processes not owned by current user) | |
lsof -n -i4TCP:$PORT | grep LISTEN | |
lsof -n -iTCP:$PORT | grep LISTEN | |
lsof -n -i:$PORT | grep LISTEN | |
# Update MacOS Software & All Homebrew Formulas. | |
sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; | |
# Then return brew doctor results that may give hints on broken links or misconfigurations. | |
brew doctor | |
# Update atom packages | |
apm update --no-confirm && apm upgrade --no-confirm | |
# Update pip python packages | |
pip install --upgrade $(pip list --outdated | cut -f 1 -d " ") 2>/dev/null | |
# Update ruby gem packages | |
gem update $(gem list --local | cut -f 1 -d " ") | |
# Reload Bluetooth service without rebooting | |
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
# Reload Core Services | |
sudo killall Finder | |
sudo killall SystemUIServer | |
# clear the local DNS cache on macOS Sierra 10.12.0 | |
sudo killall -HUP mDNSResponder | |
## kill using port | |
kill -9 `lsof -i:<port_number> -t` | |
# Find things listening on ports on Mac | |
lsof -n -i4TCP:$PORT | grep LISTEN | |
# Reset Launchpad Layout | |
defaults write com.apple.dock ResetLaunchPad -bool true; killall Dock | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment