Last active
June 17, 2017 09:17
-
-
Save hackur/2d7f9da4e5da8b6cadd9cb851906c0d8 to your computer and use it in GitHub Desktop.
Useful MacOS Sierra Commands
This file contains hidden or 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
| # DON'T BE STUPID | |
| # THIS SCRIPT IS NOT MEANT TO BE RUN ALL AT ONCE | |
| # DO NOT RUN ANY OF THESE COMMANDS UNLESS YOU KNOW WHAT YOU'RE DOING | |
| # These are some commands I freqently find myself using. I'm saving them here for my own reference. | |
| # 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment