[Homebrew Series 4] GUI Apps and Brewfile

한국어 버전

Install GUI Apps and Save Your Setup

In Part 3, you practiced installing CLI tools with brew install. In this final Homebrew post, you will extend that workflow to GUI apps and then save your setup in a Brewfile so you can rebuild it later.

What This Post Covers

  • Install GUI apps with Homebrew Casks
  • Check which casks Homebrew manages
  • Export your current setup to a Brewfile
  • Write a small Brewfile by hand and install from it
  • Update or remove cask apps safely

Before You Start

  • macOS with Homebrew already installed
  • Terminal access
  • Basic comfort with the commands from Parts 2 and 3

Do not use sudo with Homebrew. If Homebrew asks for unexpected elevated permissions, fix the installation instead of switching to sudo brew ....

Key Terms First

Term Meaning Example
Formula A CLI package managed by Homebrew git, node, tree
Cask A GUI app managed by Homebrew google-chrome, visual-studio-code
Brewfile A plain-text file listing what you want Homebrew to install ~/Brewfile
Bundle The brew bundle workflow that reads a Brewfile brew bundle, brew bundle dump
Tap An extra repository for formulas or casks homebrew/cask-versions

A Brewfile is not a terminal command. It is a text file that Homebrew reads when you run brew bundle.

Exercise 1: Install Chrome with a Cask

Start with one familiar GUI app so the new concept stays simple.

App Names vs. Cask Names

The name you see in Finder is not always the name you type into Homebrew.

App Name Cask Name
Google Chrome google-chrome
Visual Studio Code visual-studio-code
1Password 1password

If you are unsure of the cask name, search first:

brew search --cask chrome

Install Chrome

Installing Chrome with Homebrew zsh · ~/workspace
Ready. Press Replay to run the scripted session.

The exact output varies, but these lines matter most.

Piece Meaning
--cask You are installing a GUI app instead of a CLI formula
Downloading ...dmg Homebrew is fetching the app installer
Moving App Homebrew is placing the app in /Applications

Verify the Install

brew list --cask | grep google-chrome

If you also want to check in the macOS UI, open Spotlight with Command + Space, type Chrome, and launch it.

Exercise 2: Install VS Code and Test the code Command

VS Code is a useful second example because its cask also exposes a terminal command.

Install VS Code

Installing VS Code zsh · ~/workspace
Ready. Press Replay to run the scripted session.

What To Notice

  • Linking Binary 'code' means Homebrew created a terminal command for VS Code
  • On Apple Silicon, that path is usually /opt/homebrew/bin/code
  • On Intel Macs, it is usually /usr/local/bin/code

Test It

which code

# Open VS Code for the current folder
code .

# Open a specific file
code myfile.txt

# Open a new window
code -n .

If which code prints a path and VS Code opens, the terminal integration is working.

Exercise 3: Inspect What Homebrew Manages

Before automating anything, look at the information Homebrew already tracks.

List Installed Casks

brew list --cask

List Everything Managed by Homebrew

brew list

Inspect One Cask

brew info --cask google-chrome

Use brew info --cask ... when you want the homepage, install path, version details, and caveats for one app.

Exercise 4: Know When To Use a Brewfile

Installing one app at a time is fine when you are experimenting. A Brewfile becomes useful when you want a repeatable setup for a new Mac, a reinstall, or a shared team environment.

Think of the workflow like this:

  • Use brew install --cask ... when you are trying one app now
  • Use a Brewfile when you want to save or recreate a full setup later

There are two common ways to get a Brewfile:

  • Export your current setup with brew bundle dump
  • Write a small file by hand for the exact tools you want

Exercise 5: Export Your Current Setup to a Brewfile

This is the easiest way to understand the feature because Homebrew writes the file for you.

Create the Brewfile Automatically

cd ~
brew bundle dump --describe

If ~/Brewfile already exists and you want to overwrite it, add --force.

What This Actually Exports

brew bundle dump writes what Homebrew currently manages on your machine. That can include more than the two apps you just installed, so review the file afterward and trim anything you do not want in your long-term setup.

Inspect the Result

cat ~/Brewfile

You may see lines like these:

cask "google-chrome"
cask "visual-studio-code"

Edit It in VS Code

code ~/Brewfile

That is a practical use of the code command you just enabled.

Exercise 6: Write a Small Brewfile by Hand

Now that you have seen an exported Brewfile, write a minimal one yourself so the syntax feels less mysterious.

Start Small

Use a short file first. You can add more packages later.

# My Homebrew setup

# CLI tools
brew "git"
brew "node"

# GUI apps
cask "google-chrome"
cask "visual-studio-code"
cask "iterm2"

For common packages like these, you usually do not need explicit tap lines.

Install from the Brewfile

cd ~
brew bundle

brew bundle reads ~/Brewfile, installs what is missing, and skips what is already installed.

Save to a Different Location

If you keep setup files in a dotfiles repository, you can use a custom path.

brew bundle dump --describe --file=~/dotfiles/Brewfile

Exercise 7: Add More Apps Deliberately

Once the basic flow makes sense, expand your Brewfile instead of typing large install commands from memory every time.

Useful Casks To Consider

# Browsers
cask "google-chrome"
cask "firefox"

# Development
cask "visual-studio-code"
cask "iterm2"
cask "docker"

# Productivity
cask "notion"
cask "slack"
cask "1password"

After editing the file, run this again:

brew bundle

Re-running brew bundle is normal. It installs what is still missing rather than reinstalling everything blindly.

Exercise 8: Update and Remove Casks Safely

Homebrew can manage the full lifecycle of GUI apps, not just the first install.

Upgrade One Cask

brew upgrade --cask google-chrome

Upgrade Outdated Casks

brew upgrade --cask

Some auto-updating or latest casks may not upgrade unless you use a greedier option. For beginner workflows, start with the default behavior first.

Remove a Cask

brew uninstall --cask google-chrome

Deep-Remove a Cask

brew uninstall --zap google-chrome

--zap removes the app and may also remove related settings, cache, and support files. Use it only when you want a true clean slate.

Troubleshooting

If a Cask Name Is Wrong

brew search --cask chrome

Most cask names are lowercase and hyphenated.

If Homebrew Says the App Already Exists

If you installed the app manually before, Homebrew may refuse to overwrite it.

brew install --cask google-chrome --force

Use --force carefully. It is for taking over an existing app installation, not for normal everyday installs.

If brew bundle Does Not Do What You Expect

Check whether anything in the Brewfile is still missing:

brew bundle check

brew bundle check does not validate Brewfile syntax like a linter. It tells you whether brew bundle would still need to install anything.

If Homebrew reports an error while reading the file, open the Brewfile and check lines that should start with brew, cask, or tap.

code ~/Brewfile

If a Download Fails During Install

First confirm your network is working:

ping google.com

Then run the same install command again.

brew install --cask google-chrome

Quick Reference

Command When to use it
brew install --cask <name> Install one GUI app
brew list --cask See installed casks
brew info --cask <name> Inspect one cask
brew bundle dump --describe Export current setup to a Brewfile
brew bundle Install what your Brewfile declares
brew bundle check Check whether the Brewfile still has missing items
brew upgrade --cask Upgrade outdated casks
brew uninstall --cask <name> Remove one app
brew uninstall --zap <name> Remove one app and related files

Practice Checklist

  • Install Chrome with brew install --cask google-chrome
  • Install VS Code with brew install --cask visual-studio-code
  • Confirm the code command works with which code
  • List installed GUI apps with brew list --cask
  • Export your current setup with brew bundle dump --describe
  • Open and review ~/Brewfile
  • Write or edit a small Brewfile by hand
  • Run brew bundle
  • Upgrade a cask with brew upgrade --cask
  • Remove a cask with brew uninstall --cask

Wrap-Up

You now know the last major Homebrew workflow in this series: use casks for GUI apps, export the tools you care about into a Brewfile, and rebuild that setup later with brew bundle.

That gives you something more valuable than a one-time install command. You now have a repeatable Mac setup.

💬 댓글

이 글에 대한 의견을 남겨주세요