How to Install Mac Apps in Terminal Using Homebrew
After you’ve configure a new Mac from scratch or reloaded macOS, installing a dozen or more apps is an overwhelming job. Visiting all the right websites and setting the apps up according to your needs is a hassle.
You can solve this problem with a package manager. Homebrew is a package manager for macOS that simplifies the installation of free Unix tools and GUI apps. We’ll show you how to install apps with Homebrew and keep them up-to-date without any trouble.
What Is Homebrew?
Homebrew a free and open source package manager that lets you easily install command line tools and GUI apps on macOS. With a single command, you can search, install, uninstall, or update free Unix tools. Before installing Homebrew, you’ll need the following:
- Terminal, located in the /Application/Utilities folder.
- macOS 10.12 (Sierra) or higher.
- Command Line Tools, or Xcode from the Mac App Store.
How to Install Homebrew on Mac
If you have Xcode installed, there’s no need to install Command Line Tools, since the package is already baked into Xcode. But if not, you don’t have to install Xcode just for Homebrew.
After installation, Xcode consumes around 10GB of disk space, which is no small amount. If you’re just getting started with these commands, then installing Command Line Tools (roughly 150MB) will get the job done.
Step 1: Install Command Line Tools
To install Command Line Tools, press Cmd + Space to launch Spotlight and search for Terminal. Then type:
xcode-select --install
As you type this command, a popup will appear with the message The “xcode-select” command requires the command line developer tools. Would you like to install these tools now? Click the Install button to proceed with the installation.
In my case, since the package is already installed, this shows an error message.
Step 2: Install Homebrew
To install Homebrew, copy and paste the following command into the Terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
When you paste this command, you’ll see a series of lines about what the script will install and where. Press Return again to continue, or any other key to cancel.
Then enter the administrator password to begin the installation. Installation takes a bit of time, depending on the speed of your Mac and internet connection. On completion, you’ll see an Installation successful message.
Step 3: Verify the Homebrew Installation
Run this command to validate the Homebrew installation and check for any errors:
brew doctor
If you see any Warnings messages, you can safely ignore them, but you should check out common issues that might affect a Homebrew installation. In most cases, you won’t see any errors if your copy of macOS and Command Line Tools/Xcode are up to date.
You should this check for any pending updates in the App Store before you install Homebrew.
Installing Popular Unix Tools With Homebrew
Since Homebrew is a package manager, it automates the entire process of installing, updating, and removing apps from the system. It compiles packages and handles all the dependencies for you.
For example, one app might rely on two others to work properly. Rather than installing those other apps yourself, Homebrew installs them and configures them to work with your requested app without any issues.
Here are a few handy tools you can install with Homebrew:
- youtube-dl: Lets you download videos from YouTube and other more sites.
- geoip: Gives you the geolocation data for a particular IP address. Useful for system administrators, security researchers, and web developers.
- wget: Lets you download data from the web and FTP. You can download a file or even an entire website with this tool.
- cask: This one lets you install macOS apps with a GUI.
- htop: Command line alternative of Activity Monitor. It gives you thorough information on CPU, memory, processes, and more.
Manage Unix Tools With Homebrew
Running these Homebrew formulas is easy. Just type:
brew install [formula name]
To install youtube-dl, for instance, type in:
brew install youtube-dl
Type the following to see the list of commands that Homebrew supports:
brew help
You can browse a big list of available commands on the Homebrew formulae page. And use the following commands for more options:
- search: Search for a formula
- uninstall: Uninstall a formula
- list: List all the installed formulas
- upgrade: Fetch the newest version of Homebrew from Github
- upgrade [formula name]: Install updates for a particular formula
How to Install Homebrew Cask on Mac
Homebrew Cask extends Homebrew and lets you easily install macOS GUI apps directly from the command line. With this simple script, you can install and manage many apps without needing to download them individually and go through the typical drag-and-drop routine.
To install Cask, type this into Terminal:
brew tap caskroom/cask
Just after installing Cask, type this:
brew tap homebrew/cask-versions
The second Cask command is intended for installing alternate versions of Casks. For example, they include betas, development versions of browsers you might want to install, latest versions of legacy open source apps, and more.
With Cask installed, you can also enter this command:
brew cask
This syntax will tell you commands that Cask supports. Every time you use a command, don’t forget to prepend with brew cask. The most frequently used commands you need to remember are:
- install: Installs the given cask
- uninstall: Uninstalls the given cask
- list: Lists installed casks
- outdated: List all outdated casks
- upgrade: Upgrades all outdated casks
You don’t have to remember the commands. If you ever forget a command, type in brew cask to see the list. You can also take a printout of the manual page and open it in the Preview app.
This syntax will export the man page output to Preview.
man -t [Command Goes Here]|open -f -a /Applications/Preview.app
For example, the below string will open the manual page for brew cask in Preview:
man -t brew-cask|open -f -a /Applications/Preview.app
Once the man page opens in the Preview app, choose File > Export As PDF to save the file as a PDF document for future reference.
Installing Mac Apps With Cask
You probably have a list of frequently used apps you install on every new Mac. Instead of doing so individually, you can install those apps through Cask. To search for an app, use this syntax:
brew search
Let’s see if there’s a Cask for Firefox. To do so, type this into Terminal:
brew search firefox
As you might know, Firefox supports many different release channels. Mozilla uses these channels to slowly roll out updates to users, starting with daily Nightly builds to more Stable builds. If you want to install Nightly build of Firefox, you would type:
brew cask install firefox-nightly
Or to install the Google Chrome Beta, try this:
brew search chrome
Once you get relevant matches, enter:
brew cask install google-chrome-beta
Sometimes, you might not remember a particular app name. Thankfully, you just need to enter some relevant keywords and Cask will search for apps that contain them. The below screenshot shows what happens when you enter this command:
brew search sync
Uninstalling Apps With Cask
To uninstall Chrome Beta, simply type:
brew cask uninstall google-chrome-beta
For uninstalling Firefox, use:
brew cask uninstall firefox-nightly
The app gets uninstalls completely with no traces left behind. Once you install an app with Cask, it’s fine to update the app even if Cask doesn’t show updates. Don’t forget to check for configuration issues to further mitigate any problems. You can do so with this command:
brew doctor
Before checking for any Cask upgrade, don’t forget to periodically update the Homebrew core and casks. To do this, type:
brew upgrade
GUI Versions of Homebrew and Casks
Although there is no GUI app to install Homebrew and Casks, there are third-party apps that lets you update Homebrew core, check configuration issues, install and update apps from Cask repository, and much more.
Cakebrew is a free, open source app that works in tandem with Homebrew. It lets you see the list of formulas you’ve installed, plus it can run a quick search and show the description of formulas you want to install. This is functionality the command line version doesn’t have.
If you like Homebrew, but don’t want to use the command line for every purpose, this app will prove useful to you. To install Cakebrew, type in:
brew cask install cakebrew
Homebrew and Cask Workflow for Alfred lets you easily install, uninstall, and manage Homebrew and casks in tandem. The script filters brew and cask with support for doctor, install, list, search, uninstall, and more.
Then launch Alfred, type in brew or cask, and you can manage your apps right there in Alfred. You need to have the Alfred Powerpack installed to use this and other workflows.
Install These Open Source Mac Apps
Homebrew is a great package manager to install free Unix tools and macOS apps. If you’re setting up a Mac from scratch or work in a company where you manage multiple Macs, Homebrew can save you a lot of time and energy.
It’s easy to get lost with all these commands, but you don’t have to hurry. Go slow with these steps and take notes frequently.
Although you might want to install common Mac apps at first, take a look at some lesser-known open source Mac apps and install them with Homebrew Cask too.
Read the full article: How to Install Mac Apps in Terminal Using Homebrew
from MakeUseOf http://bit.ly/2DfkJws
via IFTTT