Skip to content

Instantly share code, notes, and snippets.

@NovaRemitly
Last active December 17, 2020 22:17
Show Gist options
  • Save NovaRemitly/4372155 to your computer and use it in GitHub Desktop.
Save NovaRemitly/4372155 to your computer and use it in GitHub Desktop.
Useful shell commands for MacOS

Get which version of MacOS you are running.

sw_vers -productVersion | cut -f 1,2 -d . -

Clear duplicates from Finder's "Open With" menu

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user

See extended file attributes and ACL permissions

ls -l@e

Changing ACL rules

chmod +a "<user> <allow/deny> <permission>" # Add a rule
chmod -a "<user> <allow/deny> <permission>" # Delete a rule

Working with extended attributes

xattr -l <file>                # Show extended attributes and their values
xattr -w <attr> <value> <file> # Write the value into the given attribute
xattr -d <attr> <file>         # Delete the given attribute

List directory size

du -chs <directory>

Get uptime in milliseconds(?)

sysctl kern.boottime

Make windows maximize instantly

defaults write -g NSWindowResizeTime -float 0.003
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment