How to install Homebrew, UPX and CASK on MacOS ?

install homebrew ups cask macOS
Below are the steps to install Homebrew, UPX, and Cask on macOS. Homebrew is a package manager that simplifies installing software, UPX is a tool for compressing executables, and Cask allows you to install macOS GUI apps, fonts, and more.
Since Cask is part of Homebrew as of recent versions, installing Homebrew automatically includes Cask functionality.
How to install Homebrew?
Step 1: Install Homebrew
Homebrew is the foundation for installing UPX and Cask-compatible apps.
1- Open Terminal:
- Go to
Applications > Utilities > Terminal
, or use Spotlight (Command + Space
, type “Terminal”).
2- Run the Installation Script:
- Paste this command and press Enter:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- What happens:
- It downloads the script from GitHub.
- You may be prompted to install Xcode Command Line Tools (agree and wait—it’s about 150 MB).
- Enter your admin password when asked.
- The script installs Homebrew to:
/usr/local/bin
(Intel Macs)/opt/homebrew/bin
(Apple Silicon Macs)
3- Follow Post-Installation Instructions:
- After installation, the script may display commands to add Homebrew to your PATH. For example:
- Intel Macs:
echo 'eval "$(/usr/local/bin/brew shellenv)"' >> ~/.zshrc
- Apple Silicon Macs:
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zshrc
- Intel Macs:
- Run the suggested command, then reload your shell:
source ~/.zshrc
4- Verify Installation:
- Check the version:
brew --version
- Expected output: e.g., “Homebrew 4.x.x”. If it works, Homebrew is installed.
How to install UPX?
Step 2: Install UPX (Using Homebrew)
UPX (Ultimate Packer for Executables) is available via Homebrew as a formula.
1- Install UPX:
- In Terminal, run:
brew install upx
- Homebrew downloads and installs UPX to your system.
2- Verify UPX Installation:
- Check the version:
upx --version
- Expected output: e.g., “upx 4.x.x”. If it works, UPX is ready to use.
3- Test UPX (Optional):
- Compress a test file
upx /path/to/executable
- Replace
/path/to/executable
with an actual file (e.g., a compiled binary).
How to install Cask in old Homebrew versions?
Step 3: Install and Use Cask (Part of Homebrew)
Cask is now bundled with Homebrew, so no separate installation is needed. It extends Homebrew to manage macOS GUI apps (e.g., Firefox, VLC) and other non-CLI software.
1- Confirm Cask Availability:
- Since Homebrew includes Cask, it’s already active. Verify with:
brew info --cask vlc
- This shows info about the VLC app (a Cask example), confirming Cask works.
2- Install a Cask App (Example):
- Install a GUI app, like Visual Studio Code:
brew install --cask visual-studio-code
--cask
tells Homebrew to use Cask. The app installs to/Applications
.
3- Verify the App:
- Check
/Applications
in Finder for “Visual Studio Code.app” (or your chosen app). - Launch it to confirm it works.
4- List Installed Casks (Optional):
- See all Cask-installed apps:
brew list --cask
Notes
- Architecture: Intel Macs use
/usr/local
, while Apple Silicon uses/opt/homebrew
. The install script detects this automatically. - Dependencies: Xcode Command Line Tools are required for Homebrew (installed during setup if missing).
- Updates: Keep Homebrew and its packages updated:
brew update && brew upgrade
- Permissions: If you hit permission errors, fix ownership:
sudo chown -R $(whoami):admin /usr/local/bin # Intel
sudo chown -R $(whoami):admin /opt/homebrew/bin # Apple Silicon