rodrigobdz / macos-cheatsheet

Collection of useful macOS commands

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macOS Cheatsheet

Highly recommended: tldr-pages/tldr (website)

collection of community-maintained help pages for command-line tools, that aims to be a simpler, more approachable complement to traditional man pages.


Shell

  • Fix zsh's compinit error when initializing a new shell

    zsh compinit: insecure directories, run compaudit for list. Ignore insecure directories and continue [y] or abort compinit [n]?

    # Run the following command to fix the error above
    compaudit | xargs chmod g-w

    Source

PDF

  • Merge PDFs

    gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=merged.pdf *.pdf

    Source

    # Requires 'python' binary
    #
    # Alternative 
    # Merge multiple pdfs in current directory with prefix foo, e.g.
    # foo1.pdf foo2.pdf and foo3.pdf and create new PDF called merged.pdf
    \ls -larth foo*.pdf | xargs "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o merged.pdf {}

    Source

    # Requires 'python' binary
    #
    # Alternative
    # Merge all pdfs in current directory into merged.pdf
    "/System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py" -o merged.pdf *.pdf

Plist

  • View and edit .plist files

    # Print file in human-readable format
    plutil -p foo.plist
    # Print file as XML
    /usr/libexec/PlistBuddy -x -c "Print" foo.plist
  • View list of bypassed invalid SSL certificate warnings in Safari

    plutil -p ~/Library/Containers/com.apple.Safari/Data/Library/Safari/BypassedInvalidCertificateWarning.plist

Preview

About

Collection of useful macOS commands