Introduction
Mac Bash Completion is package providing command-line completion for a number of Mac-specific tools in the Bash shell. The commands are described in detail below.
Download
Requirements
- bash-completion by Ian Macdonald. This is available at the previous link, or can be easily installed through MacPorts or Fink.
- Bonjour Lister for SSH host completion (binary included)
Installation
Copy the command completion files to a common location:
% mkdir -p ~/Library/init/bash/completion % cp completion/* ~/Library/init/bash/completion/
Copy Bonjour Lister to somewhere in your path:
% sudo cp Bonjour\ Lister\ 1.0/blister /usr/bin/
Then source them from your .bashrc or .bash_profile. This example first loads the bash-completion package installed through MacPorts.
# Set up completions if [ -f /opt/local/etc/bash_completion ]; then source /opt/local/etc/bash_completion for cmd in ~/Library/init/bash/completion/* ; do source $cmd done fi
Commands
defaults
Completion for defaults will fill in all command options, domains, and keys. Additionally, defaults write will insert the current value and type. Here's a text example until I put up a video:
% defaults w <tab> % defaults write com.apple.te <tab> com.apple.Terminal com.apple.TextEdit % defaults write com.apple.Terminal nsfi <tab> NSFixedPitchFont NSFixedPitchFontSize % defaults write com.apple.Terminal NSFixedPitchFontSize <tab><tab> % defaults write com.apple.Terminal NSFixedPitchFontSize -integer 9
SSH
SSH completion is a small enhancement on the existing bash-completion. The bash-completion package is used to complete some arguments and known hosts. The Mac Bash Completion package adds completion of local Bonjour hosts, and suppresses unavailable *.local hosts. Bonjour Lister is used to find local hosts.
xcodebuild
The xcodebuild command builds Xcode proejcts from the command line. All options and commands are completed, including the project's targets and configurations.
% ls Bonjour Lister.xcodeproj/ _darcs/ main.c LICENSE.txt build/ % xcodebuild <tab> -activeconfiguration -help -version installsrc -activetarget -list build -alltargets -project clean -configuration -target install % xcodebuild -proj <tab><tab> % xcodebuild -project Bonjour\ Lister.xcodeproj -conf <tab><tab> Debug Release % xcodebuild -project Bonjour\ Lister.xcodeproj -configuration Release -t <tab><tab> % xcodebuild -project Bonjour\ Lister.xcodeproj -configuration Release -target Bonjour\ Lister
Version History
- 1.0 (2006-10-08)
- Initial release (
defaults,ssh,xcodebuild)
Credits
- Jonathon Mah: Creator, lead developer
License
Mac Bash Completion is licensed under the BSD license, as follows:
Copyright © 2006, Playhaus All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of the Playhaus nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
This software is provided by the copyright holders and contributors “as is” and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the copyright owner or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

to search page content.