All Projects → Homebrew → Homebrew Command Not Found

Homebrew / Homebrew Command Not Found

Licence: mit
🔍 Ubuntu’s command-not-found equivalent for Homebrew on macOS

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Homebrew Command Not Found

Homebrew Livecheck
💀 Homebrew/homebrew-livecheck (deprecated)
Stars: ✭ 104 (-55.93%)
Mutual labels:  cmd, homebrew, tap
Homebrew Bundle
📦 Bundler for non-Ruby dependencies from Homebrew, Homebrew Cask and the Mac App Store.
Stars: ✭ 3,940 (+1569.49%)
Mutual labels:  cmd, homebrew, tap
Homebrew Services
🚀 Manage background services with macOS' launchctl daemon manager
Stars: ✭ 1,656 (+601.69%)
Mutual labels:  cmd, homebrew, tap
action-homebrew-bump-formula
⚙️ A GitHub Action to easily bump Homebrew formula on new release
Stars: ✭ 68 (-71.19%)
Mutual labels:  homebrew, tap
homebrew-apple-fonts
Easily install Apples fonts using homebrew.
Stars: ✭ 12 (-94.92%)
Mutual labels:  homebrew, tap
homebrew-mopidy
Homebrew formulas for Mopidy and Mopidy extensions
Stars: ✭ 21 (-91.1%)
Mutual labels:  homebrew, tap
homebrew-srm
Homebrew tap for srm since Apple and Homebrew decided nobody had mechanical disks anymore.
Stars: ✭ 14 (-94.07%)
Mutual labels:  homebrew, tap
homebrew-ecmascript
Homebrew formulae for ECMAScript engines
Stars: ✭ 13 (-94.49%)
Mutual labels:  homebrew, tap
homebrew-portable-ruby
🚗 Versions of Ruby that can be installed and run from anywhere on the filesystem.
Stars: ✭ 96 (-59.32%)
Mutual labels:  homebrew, tap
homebrew-adobe
@Homebrew tap for @adobe apps and plugins.
Stars: ✭ 24 (-89.83%)
Mutual labels:  homebrew, tap
Homebrew Core
🍻 Default formulae for the missing package manager for macOS (or Linux)
Stars: ✭ 10,450 (+4327.97%)
Mutual labels:  homebrew, tap
puppet-homebrew
homebrew (+brewcask! +taps!) package installer and provider
Stars: ✭ 17 (-92.8%)
Mutual labels:  homebrew, tap
Homebrew Terraforms
Homebrew repository for a Terraform version switcher and all Terraform versions
Stars: ✭ 174 (-26.27%)
Mutual labels:  homebrew, tap
Openssl Osx Ca
Simple periodic task to sync OSX Keychain certs to Homebrew installed OpenSSL & LibreSSL
Stars: ✭ 185 (-21.61%)
Mutual labels:  homebrew
Kubefwd
Bulk port forwarding Kubernetes services for local development.
Stars: ✭ 2,713 (+1049.58%)
Mutual labels:  homebrew
Commander
Test your command line interfaces on windows, linux and osx and nodes viá ssh and docker
Stars: ✭ 183 (-22.46%)
Mutual labels:  cmd
Carting
🚘 A simple tool for updating Carthage script phase
Stars: ✭ 182 (-22.88%)
Mutual labels:  homebrew
Tape Run
Headless tape test runner
Stars: ✭ 221 (-6.36%)
Mutual labels:  tap
Nro2nsp
Build Redirction and romfs nsps out of .nros
Stars: ✭ 205 (-13.14%)
Mutual labels:  homebrew
Txeh
Go library and CLI utilty for /etc/hosts management.
Stars: ✭ 181 (-23.31%)
Mutual labels:  homebrew

Homebrew Command Not Found

This project reproduces Ubuntu’s command-not-found for Homebrew users on macOS.

GitHub Actions

On Ubuntu, when you try to use a command that doesn’t exist locally but is available through a package, Bash will suggest you a command to install it. Using this script, you can replicate this feature on macOS:

# on Ubuntu
$ when
The program 'when' is currently not installed.  You can install it by typing:
sudo apt-get install when

# on macOS with Homebrew
$ when
The program 'when' is currently not installed. You can install it by typing:
  brew install when

Over 5000 formulae are supported, representing more than 17000 different commands (100% of the main Homebrew repo).

Install

First, tap this repository:

brew tap homebrew/command-not-found
  • Bash and Zsh: Add the following line to your ~/.bash_profile (bash) or ~/.zshrc (zsh):

    HB_CNF_HANDLER="$(brew --repository)/Library/Taps/homebrew/homebrew-command-not-found/handler.sh"
    if [ -f "$HB_CNF_HANDLER" ]; then
    source "$HB_CNF_HANDLER";
    fi
    
  • Fish: Add the following line to your ~/.config/fish/config.fish:

    set HB_CNF_HANDLER (brew --repository)"/Library/Taps/homebrew/homebrew-command-not-found/handler.fish"
    if test -f $HB_CNF_HANDLER
       source $HB_CNF_HANDLER
    end
    

Requirements

This tool requires one of the following:

  • Zsh (the default on macOS Catalina and above)
  • Bash (version 4 and higher)
  • Fish

How it works

When you tap the repo you’ll get two more brew commands: brew which-formula and brew which-update. The first one uses a database file which gives you the formula you have to install in order to get a specific command. The file is generated by the second command by crawling all installed formulae and collecting their binaries. Having this as a tap means you get an up-to-date binaries database each time you run brew update.

The handler.sh script defines a command_not_found_handle function which is used by Bash when you try a command that doesn’t exist. The function calls brew which-formula on your command, and if it finds a match it’ll print it to you. If not, you’ll get an error as expected.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].