by Morgan Aldridge morgant@makkintosshu.com
A small collection of Mac OS X command line tools that I’ve developed over the years. Similar to the NextStep and Mac OS X commands open
, pbcopy
, and pbpaste
, most of these tools are bash
scripts created as an exercise to hone my bash-fu. There are also a number of Perl and Ruby scripts submitted by others.
clipcat
prints and concatenates Mac OS text clippings. Submitted by Daphne Preston-Kendal.
dict
performs a look-up in the Mac OS X dictionary. Note: unlike the other scripts provided, this one requires that you have MacRuby installed. Submitted by Daphne Preston-Kendal.
eject
ejects a volume or network volume and all other volumes on the same local device. A shorter, simpler, smarter wrapper of diskutil
’s various eject/unmount options and allows specifying either a full path in /Volumes
or just the volume name.
ql
opens files with the Mac OS X Quick Look feature.
swuser
switches users using the Mac OS X Fast User Switching feature. You can either switch out to the login window or to another user. Note: unfortunately, this is not currently compatible with screen
.
trash
allows trashing of files instead of tempting fate with rm
. Correctly handles trashing files on other volumes, uses the same filename renaming scheme as Finder for duplicate file names, can list trash contents w/disk usage summary, and empty trash (including securely) w/confirmation. Does not require Finder to be running.
with
sets the application with which specified documents will be opened. It can even change and open in one fell swoop. Submitted by Daphne Preston-Kendal.
- Download and extract the tools.
- Run
rake
. - Run
sudo rake install
. (If you have write permission on/usr/local/bin
, you don’t need tosudo
.)
Looking for other Mac OS X-specific command line tools to complement these? Check out the following:
appswitch
andlaunch
by Nicholas Rileyasprint
,icalBuddy
,setWeblocThumb
, andtrash
by Ali Rantakaricontacts
by Shane Celisdockutil
by Kyle Crawfordduti
by Andrew Mortensenget-location
by David Lindesiloc
by Nate Weaverimsg
by Christian Sampaioithief
by Israel Chauca Fuentes- osxiconutils (
geticon
,icns2pict
,pict2icns
,seticon
) & osxutils (cpath
,getfcomment
,geticon
,google
,hfsdata
,lsmac
,mkalias
,rcmac
,setfcomment
,setfctypes
,setfflags
,seticon
,setlabel
,setsuffix
,setvolume
,trash
,wiki
,wsupdate
) by Sveinbjorn Thordarson pngpaste
by Jerry Chenrem
by Kevin Y. Kimservice
by Daphne Preston-Kendalstronghold
andshallow-backup
by Aaron Lichtmantag
by James Berrytrash
by Dave Dribintrash
by Sindre Sorhuswebkit2png
by Paul Hammond
Special thanks to: Daphne Preston-Kendal for all her submissions and collaboration; Matt Brictson for his initial relative path bug fix in trash
; huyz for the improved determination of Finder’s PID to prevent possible false-positives in trash
.