diff --git a/modules/command-not-found/README.md b/modules/command-not-found/README.md index e969b71a..138a04ae 100644 --- a/modules/command-not-found/README.md +++ b/modules/command-not-found/README.md @@ -4,12 +4,23 @@ Command-Not-Found Displays installation information for not found commands by loading the [command-not-found][1] tool on Debian-based and Arch Linux-based distributions. +For users of Mac OS X, if homebrew and [homebrew-command-not-found][2] are properly installed, this module will provide similar information as is presented to Linux users. + +For example... (on OSX with Homebrew) + +```bash +$ when +The program 'when' is currently not installed. You can install it by typing: + brew install when +``` + Authors ------- -*The authors of this module should be contacted via the [issue tracker][2].* +*The authors of this module should be contacted via the [issue tracker][3].* - [Joseph Booker](https://github.com/sargas) [1]: https://code.launchpad.net/command-not-found -[2]: https://github.com/sorin-ionescu/prezto/issues +[2]: https://github.com/bfontaine/homebrew-command-not-found +[3]: https://github.com/sorin-ionescu/prezto/issues diff --git a/modules/command-not-found/init.zsh b/modules/command-not-found/init.zsh index 2d9236a0..f4a5a518 100644 --- a/modules/command-not-found/init.zsh +++ b/modules/command-not-found/init.zsh @@ -3,6 +3,7 @@ # # Authors: # Joseph Jon Booker +# Alex Gray (Mac Support) # # Load command-not-found on Debian-based distributions. @@ -11,6 +12,9 @@ if [[ -s '/etc/zsh_command_not_found' ]]; then # Load command-not-found on Arch Linux-based distributions. elif [[ -s '/usr/share/doc/pkgfile/command-not-found.zsh' ]]; then source '/usr/share/doc/pkgfile/command-not-found.zsh' +# Load command-not-found on Mac OS X with https://github.com/bfontaine/homebrew-command-not-found installed +elif [[ $(type -f brew) ]] && [[ -s ${HANDLER=$(brew --prefix)/Library/Taps/bfontaine/homebrew-command-not-found/handler.sh} ]]; then + source "${HANDLER}" # Return if requirements are not found. else return 1