Home

Awesome

Tumult

License Build Status Code Climate GitHub stars Issue Count

<!-- START doctoc generated TOC please keep comment here to allow auto update --> <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Table of Contents

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

About

Tumult is an oh-my-zsh-compatible plugin that adds macOS-specific functions and scripts to your ZSH environment.

Some of these are mine, and have an Apache 2.0 license, some of them were written by other people and just colllected by me - the authors and licenses are embedded in those scripts.

Tumult will check to see if you're running on macOS and not add aliases or inject its bin into your $PATH if you aren't. This was done to enable you to use the same plugin list in all your environments without polluting your $PATH with incompatible functions and scripts on your non-Apple machines.

You may also find the git-extra-commands collection useful, or my zsh-quickstart-kit

License

The Tumult collection is Apache 2.0 licensed. Some scripts in the bin directory have different licenses - if so, they have those other license statements embedded inline in their source.

Included scripts

ScriptDescription
720pResets an application's window to 720p (1280x720) for better screencasting. Doesn't work with apps that don't support window resizing in their AppleScript dictionary. Copied from Derrick Bailey's blog
autocorrect-disableDisable macOS trying to autocorrect your typing.
autocorrect-enableRe-enable macOS trying to autocorrect your typing.
battery-percentageShow the percentage of battery charge
battery-promptPrints battery status as a string suitable for embedding in a prompt.
battery-timeShow the estimated battery life.
bundle-idPrint the bundle id of a given application
change-wallpaperIf you have your desktop wallpaper set to rotate through a folder of images at intervals, this will force an immediate switch
charger-wattageShows the wattage of your charger. Useful for detecting bad USB-C charge cables
chrome-tabsOutputs the URLs for all your open Chrome tabs so you can snapshot them
chromeForce opening a URL with Chrome
clean-clipboardConverts contents of clipboard to plain text.
clean-file-context-menuZaps extra entries from the file context menu.
clean-xml-clipClean up the XML on the clipboard
clear-macos-font-cacheClears the macOS font cache, originally from awesome-osx-command-line
column-viewSet the current directory to column view in the Finder
darktoggleFlip between dark and light mode
diceware-passwordGenerate a random but memorable passphrase using the Diceware Passphrase Algorithm. See http://world.std.com/~reinhold/diceware.html
disable-bouncing-dock-iconsDisable icons bouncing in your Dock
disable-crash-reportsKeep macOS from asking if you want to submit a crash report
disable-ftp-serverDisable the ftp server on a Mac
disable-network-ds-store-filesDisable writing .DS_Store files to network shares
disable-ssh-serverDisable the sshd server on a Mac
disable-startup-chimeDisable the boot chime
disturbRe-enable notifications in Notification Center
dns-resolversmacOS doesn't respect /etc/resolve.conf, add a helper to print what it's actually using
do-not-disturbStifle notifications in Notification Center
dump-entitlementsDumps the entitlements a given macOS binary has assigned to it
eject-allEject all removable disks
enable-bouncing-dock-iconsEnable icons bouncing in your Dock
enable-crash-reportsRe-enable crash report dialogs
enable-ftp-serverEnable the ftp server on a Mac
enable-network-ds-store-filesEnable writing .DS_Store files to network shares (the default behavior)
enable-ssh-serverEnable the ssh server on a Mac
enable-startup-chimeRe-enable the boot chime
finder-pathShow the path to the frontmost Finder window
finder-selectionShow the paths to all items selected in the Finder, quoted so it copes with spaces in your directory or filenames
firefoxForce opening a URL with Firefox
fix-airplayKick coreaudiod when AirPlay stops responding
focusmode-disableTurn off single-app mode
focusmode-enableTurn on single-app mode
get-iterm2-bufferGets the current iterm2 window's scrollback contents
get-wifi-passwordHelper script to print the password for the Wi-Fi network you're connected to.
googleDoes a google search from the command-line
hide-desktop-iconsHide desktop icons in Finder to have a clean screen for presentations
hide-dotfilesHide dotfiles in Finder windows to return to Apple's default behavior
hide-fileUse chflags to mark a file as hidden
icon-viewSet the current directory to icon view in the Finder
imgcatDisplay an image directly in your terminal. Only works with iTerm 2
interface-styleShow whether interface is set to dark or light mode
itermOpen a new iTerm 2 session with the argument given
itunesctlPlay/Pause iTunes from terminal.
keychainctlCRUD for secrets in your macOS keychain - from AriaFallah's gist
kick-afpRestart file sharing from the CLI. I got tired of having to remote desktop in to kick the fileserver via the GUI every time Apple's file sharing got wedged, now it can be fixed over ssh
kick-screensharingSometimes screen sharing just hangs on my Mini running 10.11. This is not new to 10.11, it was exhibiting the same annoying behavior on 10.10 and 10.9. The mini is headless and it's a pain in the ass to plug it into the TV just long enough to restart screen sharing, so I wrote this so I can fix it over an ssh connection.
kill-screensaverKill the screensaver when it locks up
kill-sophos-deadFrom a slack, but won't name names lest their employer find out they kill sophos. Kill Sophos' useless scanner when it gobbles up all your CPU. People wouldn't hate antivirus software so much on macOS if it restricted itself to using one CPU core.
list-viewSet the current directory to column view in the Finder
lockscreenStart the screen saver - this only locks if your System Preferences have been set to lock the screensaver
mac-alertDisplay a GUI alert with osascript
mac-hibernateSet a Mac to use hibernate mode when sleeping
mac-notificationDisplay a notification using the macOS notification manager with osascript
mac-safesleepSet a Mac to use safesleep mode when sleeping
mac-sleepSet a Mac to use the default sleep mode when sleeping
macos-consoleuserShow user logged into the GUI
macos-dialogDisplay a GUI dialog with osascript and return the user's input
macos-frontmost-appShows what application is frontmost in the GUI.
manpreviewRenders a man page to PDF and opens it in Preview.app.
markdown-openConverts a Markdown file to HTML and opens it in your browser
menubar-darkSet the menubar to be white text on black background
menubar-lightSet the menubar to the default black text on white background style
mkdmgMakes a .dmg file from a directory
mkicnsCreates an .icns file from an image file
muteMutes sound
naptimePut the machine to sleep
niteniteMake a Mac go to sleep
pb-clean-ansiClean ansi codes out of the clipboard
pb-curlcurl the address in the clipboard. Originally from Ryan Tomayko's dotfiles
pb-indentIndent the contents of the clipboard 4 spaces. With -o, write result to standard output instead of to the clipboard. Originally from Ryan Tomayko's dotfiles
pb-sedRun sed(1) on the contents of the clipboard and put the result back on the clipboard. All sed options and arguments are supported. Originally from Ryan Tomayko's dotfiles
pb-sortSorts the contents of the clipboard
pleditConvert a plist to XML, run ${EDITOR} on it, then convert it back.
power-sourceReports if laptop is running on battery or charger power. Has --emoji and --json options.
pubkeyQuick script to load an ssh public key onto your clipboard by name without you having to specify the full path to it.
quicklookTriggers quicklook on files so you can see what they are.
restart-audioThis fixes the "no sound" issue that happens occasionally by restarting coreaudiod
safariForce opening a URL with Safari
screen-resolutionDisplay the screen resolution
screencap-streamCaptures your screen every N seconds, and if ffmpeg is installed, renders it to a mp4
set-cursor-sizeSet the macOS cursor's size
set-macos-hostnameSet the macOS name of your machine. macOS may be UNIX-based, but the Apple eccentricities mean that no, sudo hostname newname isn't enough if you want the new name to be visible on the network for things like File and Screen sharing.
set-mojave-disk-warning-thresholdMojave now pops up a warning when you're running low on disk space. Unfortunately the threshold they pick triggers a warning every couple of minutes on my MacBook Air. This script lets you set a different number of free gigabytes to warn at.
set-software-update-intervalSet the interval between software update checks. The current default as of Ventura is 7 days.
show-desktop-iconsDisplay desktop icons in Finder
show-dotfilesDisplay dotfiles in Finder windows
smart-quote-disableDisable smart quote substitution
smart-quote-enableEnable smart quote substitution
speedup-apple-mailSpeeds up Mail.app by vaccuuming the indexes - Originally from http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/
spotlight-reindexRebuilds/creates the spotlight index for a disk. Defaults to rebuilding the index for /
stfuMutes sound
time-machine-log-viewerDump the Time Machine logs
time-machine-throttleRestore default Time Machine throttle setting
time-machine-unthrottleDisable throttling Time Machine backups - I am having issues with very slow Time Machine backups to an SMB share. No guarantees that this will not cause other subtle issues.
toggle-finder-show-dotfilesToggle whether the Finder shows dotfiles
unfuck-captive-portalCope when macOS fails to render the captive portal page for joining a Wi-Fi network by directly opening Apple's captive portal detection page with Safari.
unhide-fileUse chflags to restore a file's visibility
unmuteUnmutes sound
unquarantineUnquarantine a file
volumeGet/set the system volume
wifi-nameReturns the name of the Wi-Fi network you're connected to
wifiUsage: wifi on or wifi off - toggles your Wi-Fi power

Other Useful macOS tools

Installation

Tumult is packaged as a ZSH plugin to make it easier to use if you're already using a ZSH framework. If you don't already use a framework, I recommend Zgenom, because it is wicked fast and also supports using oh-my-zsh's internal plugins.

Other shells / not using a framework

If you're using other shells like bash or fish, or aren't using a framework with zsh, you can install it by cloning this repository and adding its bin directory to your $PATH.

Antigen

Add antigen bundle unixorn/tumult.plugin.zsh to your .zshrc with your other bundle commands.

Antigen will handle cloning the plugin for you automatically the next time you start zsh. You can also add the plugin to a running ZSH with antigen bundle unixorn/tumult.plugin.zsh for testing before adding it to your .zshrc.

Oh-My-Zsh

  1. cd ~/.oh-my-zsh/custom/plugins
  2. git clone git@github.com:unixorn/tumult.plugin.zsh.git tumult
  3. Add tumult to your plugin list - edit ~/.zshrc and change plugins=(...) to plugins=(... tumult)

Zgenom

Add zgenom load unixorn/tumult.plugin.zsh to your .zshrc file in the same function you're doing your other zgenom load calls in. Zgenom will handle automatically cloning the plugin for you the next time you do a zgenom save.