A quick guide to HomeBrew in Mac OS. How to install softwares using home brew commands. Practical examples to home brew commands
In this tutorial, you will learn what is HomeBrew in Mac os and what is the list of commands of Homebrew and how it simplifies the installation process of software.
2. What is homebrew in Mac?
Homebrew is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system and Linux. The name is intended to suggest the idea of building software on the Mac depending on the user's taste that's why it was named HomeBrew.
You can find more software here
3. How to install the homebrew in Mac
Just open the terminal on your Mac machine and enter the following command.
[/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"]
After hitting the above command then it will prompt for the mac machine password to proceed with the installation.
-MacBook-Pro-2:Kotlin-JVM-Tutorials $ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"==> This script will install:/usr/local/bin/brew/usr/local/share/doc/homebrew/usr/local/share/man/man1/brew.1/usr/local/share/zsh/site-functions/_brew/usr/local/etc/bash_completion.d/brew/usr/local/Homebrew==> The following new directories will be created:/usr/local/Cellar/usr/local/CaskroomPress RETURN to continue or any other key to abortPassword:==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Caskroom==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Caskroom==> /usr/bin/sudo /usr/sbin/chown vnk /usr/local/Cellar /usr/local/Caskroom==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Caskroom==> /usr/bin/sudo /bin/mkdir -p /Users/vnk/Library/Caches/Homebrew==> /usr/bin/sudo /bin/chmod g+rwx /Users/vnk/Library/Caches/Homebrew==> /usr/bin/sudo /usr/sbin/chown vnk /Users/vnk/Library/Caches/Homebrew==> Downloading and installing Homebrew...remote: Enumerating objects: 38, done.remote: Counting objects: 100% (38/38), done.remote: Compressing objects: 100% (5/5), done.remote: Total 56 (delta 33), reused 33 (delta 33), pack-reused 18Unpacking objects: 100% (56/56), done.From https://github.com/Homebrew/brew* [new branch] dependabot/bundler/Library/Homebrew/net-http-persistent-4.0.0 -> origin/dependabot/bundler/Library/Homebrew/net-http-persistent-4.0.0* [new branch] dependabot/bundler/docs/rb-fsevent-0.10.4 -> origin/dependabot/bundler/docs/rb-fsevent-0.10.4e8a29a2d7..3e2039397 master -> origin/masterHEAD is now at 3e2039397 Merge pull request #7472 from MikeMcQuaid/path-tweaksUpdated 2 taps (homebrew/core and homebrew/cask).==> New Formulaeclaws-mail earthly fargatecli kumactl==> Updated Formulaeangular-cli dnstwist graphviz node softhsm wtfaudacious efl gsettings-desktop-schemas openconnect sonarqube wxmacaws-cdk ejabberd kibana phpunit sonarqube-lts zazure-cli elasticsearch libgr quickjs step zabbixbabel exploitdb libmypaint rebar3 tmuxbalena-cli flyway monero redis tmuxinatorballerina github-release nef scamper tmuxinator-completionctemplate glslang nift scrcpy vault==> Updated Casksanydo dbngin intellij-idea-ce pdfpen sunvox webstormaudio-hijack dbvisualizer ipfs pdfpenpro superproductivity wechatworkaws-vault drawio jami pgadmin4 tableau wondershare-filmorabalenaetcher edrawmax keka phpstorm tableau-public xcabisq flipper ledger-live plex-media-server tableau-reader youkublocs fontgoggles listen1 preform telegram zeebe-modelerbrave-browser franz loom private-internet-access tempo zeplinbunqcommunity-bunq freedom lyricsx rubymine termius zoomuscalendar-366 fs-uae miktex-console saoimageds9 tiger-trade zulipcamunda-modeler gitup mindjet-mindmanager screen ultimatechromium igdm openbazaar stack-stack vitamin-rdatagrip intellij-idea opera stay wavebox==> Installation successful!==> Homebrew has enabled anonymous aggregate formulae and cask analytics.Read the analytics documentation (and how to opt-out) here:https://docs.brew.sh/AnalyticsNo analytics data has been sent yet (or will be during this `install` run).==> Homebrew is run entirely by unpaid volunteers. Please consider donating:https://github.com/Homebrew/brew#donations==> Next steps:- Run `brew help` to get started- Further documentation:https://docs.brew.sh
4. How to know what packages are available with (home)brew?
brew search lists all available formula (aka packages), requires you to install brew first of course.
Additionally, if you want to get further information about that package before installing it brew info <package name> will list relevant information like version number, dependencies etc.
brew search | wc -l
Below example to see about ActiveMQ software info from brew:This shows installation status and what are the requried dependencies for this.
And also gives the commands to start the active mq with command "brew services start activemq"
[MacBook-Pro-2:Kotlin-JVM-Tutorials MacBook $ brew info activemqactivemq: stable 5.15.12Apache ActiveMQ: powerful open source messaging serverhttps://activemq.apache.org/Not installedFrom: https://github.com/Homebrew/homebrew-core/blob/master/Formula/activemq.rb==> DependenciesRequired: openjdk ✘==> CaveatsTo have launchd start activemq now and restart at login: brew services start activemqOr, if you don't want/need a background service you can just run: activemq start==> Analyticsinstall: 892 (30 days), 3,250 (90 days), 11,118 (365 days)install-on-request: 850 (30 days), 3,066 (90 days), 10,562 (365 days)build-error: 0 (30 days)MacBook-Pro-2:Kotlin-JVM-Tutorials MacBook $ ]
5. Most Useful Commands
brew help will show you the list of commands that are available.
brew list will show you the list of installed packages. You can also append formulae, for example brew list Postgres will tell you of files installed by Postgres (providing it is indeed installed).
brew search <search term> will list the possible packages that you can install. brew search post will return multiple packages that are available to install that have post in their name.
brew info <package name> will display some basic information about the package in question.
6. HomeBrew Commands Cheetsheet
All the below commands are formed based on the git installations.
brew install git Install a package
brew uninstall git Remove/Uninstall a package
brew upgrade git Upgrade a package
brew unlink git Unlink
brew link git Link
brew switch git 2.5.0 Change versions
brew list --versions git See what versions you have
More package commands
brew info git List versions, caveats, etc
brew cleanup git Remove old versions
brew edit git Edit this formula
brew cat git Print this formula
brew home git Open homepage
brew search git Search for formulas
brew update Update brew and cask
brew list List installed
brew outdated What’s due for upgrades?
brew doctor Diagnose brew issues
Brew Cask commands
brew cask install firefox Install the Firefox browser
brew cask list List installed applications
7. How to uninstall HomeBrew from Mac OS?
homebrew provides another handy command to remove the installation of HomeBrew and all other installation done in the brew but all cask installation will remain in the mac machine. These should be removed manually.
[ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"]
This command will ask for confirmation and enter y for uninstall, n for do not do.
And also it prompts for the password.
In conclusion, you have seen how to install and all commands are needed.
If you have any questions, please post in the comments section.