- Published on
You Need to Use Homebrew if You Use Mac
- Authors
- Name
- Ryuichi Nishi
- @ryuichi2c
When you download and install a new software on your mac, do you manually download it from the website, and install it by following the installation wizard? If so, you should stop it and start using Homebrew instead.
Install Homebrew
The installation of Homebrew is fairly simple. All you have to do is just execute the command below:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
It fetches the installation automated scripts from the internet and execute the script that installs Homebrew on your mac. It may take long and you should wait a little.
Xcode Command Line Tools
If your mac does not have a tool called Xcode Command Line Tools, you may get a prompt that will install the tool, so you should follow that first, otherwise, you can install the tool with the following command:
xcode-select --install
Once the installation is done, you can check if the installation was successful by running the following command:
brew doctor
If it succeeded, the output will be like below:
brew doctor
Your system is ready to brew.
If you get some warning like below:
brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!
Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting your PATH for example like so:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
You can resolve it with the following commands:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
zsh
Play with Homebrew
With Homebrew, you can install any desktop application from a terminal; you no longer need to download a zip file and unzip it to start the installation wizard. In addtion to desktop applications, Homwbrew can isntall CLI tools, which is the main part of Homebrew.
Install CLI tools
The following command lets you install CLI tool.
brew install <tool names>
To demonstrate, let's install youtube-dl with which you can download Youtube videos.
brew install youtube-dl
This command will installl youtube-dl on your mac, and you can check if it it successful by running the following command:
which youtube-dl
And if the output is the following, the installation is successful.
which youtube-dl
/usr/local/bin/youtube-dl
Install desktop applications
Installing a desktop application needs one more input that is --cask
option. So the command will be like below:
brew --cask install <application name>
Let's say you want to install Visual Studio Code, you can easily install it like below:
brew --cask install visual-studio-code
After the execution is done, you are ready to go using the Visual Studio Code. You can find the application in your application folder.
INFO: You can always check what software is installed on your Mac with the following command.
brew list
Update application
If you install a software with Homebrew, you can even update it with one command, which is very useful. The command is like below:
brew upgrade <application name>
NOTE: there is another command that is
brew update
. This one updates Homebrew itself, so you need to be careful not to use a wrong command.
Remove application
Of course, you can also remove the installed application with a command like below:
brew uninstall <application name>
Conclusion
Using Homebrew, you can install any software on the internet very easily and very fast. Moreover, you can mange all of the installed applications with homebrew; you can update and remove them with one command, which makes Mac more clean and organized.