Skip to main content
7-Zip can be compiled on macOS for both Intel (x64) and Apple Silicon (arm64) platforms using Clang.

Requirements

Xcode Command Line Tools

Install the Xcode Command Line Tools to get the Clang compiler and build tools:
xcode-select --install
Verify installation:
clang --version
make --version
You don’t need the full Xcode IDE - just the Command Line Tools are sufficient.

Quick Start

1

Navigate to Source Directory

cd CPP/7zip/Bundles/Alone2
2

Build for Your Architecture

make -j -f ../../cmpl_mac_arm64.mak
3

Run the Binary

./b/m_arm64/7zz

Build Configurations

Apple Silicon (ARM64)

The ARM64 build includes assembler optimizations:
cd CPP/7zip/Bundles/Alone2
make -j -f ../../cmpl_mac_arm64.mak
Configuration (from var_mac_arm64.mak):
PLATFORM=arm64
IS_ARM64=1
USE_ASM=1
CC=clang
CXX=clang++
MY_ARCH=-arch arm64
Output: b/m_arm64/7zz

Intel x64

cd CPP/7zip/Bundles/Alone2
make -j -f ../../cmpl_mac_x64.mak
Configuration (from var_mac_x64.mak):
PLATFORM=x64
IS_X64=1
CC=clang
CXX=clang++
MY_ARCH=-arch x86_64
Output: b/m_x64/7zz

Architecture-Specific Details

Apple Silicon Optimizations

Apple Silicon builds use ARM64 assembler for performance:
Assembler Features:
  • Uses GNU assembler syntax with preprocessor
  • Supported natively by Clang for ARM64
  • Includes optimizations for LZMA decoding
  • Hardware-accelerated cryptography where available
The assembler code is located in:
Asm/arm64/LzmaDecOpt.S
Asm/arm64/7zAsm.S

Architecture Variants

You can customize the ARM64 architecture flags in var_mac_arm64.mak:
# Basic ARM64 support
MY_ARCH=-arch arm64

# With specific features
MY_ARCH=-arch arm64 -march=armv8-a
The default configuration uses -arch arm64 which is compatible with all Apple Silicon processors.

Build All Targets

Navigate to the main makefile directory and build everything:
cd CPP/7zip
make -j -f ../../cmpl_mac_arm64.mak  # For Apple Silicon
This builds all UI and Bundle targets.

Specific Build Targets

7zz (All Formats)

cd CPP/7zip/Bundles/Alone2
make -j -f ../../cmpl_mac_arm64.mak

7za (Limited Formats)

cd CPP/7zip/Bundles/Alone
make -j -f ../../cmpl_mac_arm64.mak

7zr (7z Format Only)

cd CPP/7zip/Bundles/Alone7z
make -j -f ../../cmpl_mac_arm64.mak

Shared Library

cd CPP/7zip/Bundles/Format7zF
make -j -f ../../cmpl_mac_arm64.mak
Output: 7z.dylib

Using makefile.gcc

You can also use the generic makefile.gcc for macOS:
cd CPP/7zip/Bundles/Alone2
make -j -f makefile.gcc
This auto-detects the platform but may not use optimal flags.

Compiler Flags

macOS builds use Clang-specific warning flags (from warn_clang_mac.mak):
CFLAGS_WARN = \
  -Werror -Wall -Wextra \
  -Wconversion \
  -Wimplicit-fallthrough
Optimization level: -O2

Universal Binaries

To create a universal binary (both Intel and ARM64):
1

Build for ARM64

make -j -f ../../cmpl_mac_arm64.mak
cp b/m_arm64/7zz 7zz_arm64
2

Build for x64

make -j -f ../../cmpl_mac_x64.mak
cp b/m_x64/7zz 7zz_x64
3

Combine with lipo

lipo -create 7zz_arm64 7zz_x64 -output 7zz_universal
4

Verify

file 7zz_universal
lipo -info 7zz_universal

RAR Support Options

Control RAR support at build time:

Disable All RAR Support

make -j -f ../../cmpl_mac_arm64.mak DISABLE_RAR=1

Disable RAR Decompression Only

make -j -f ../../cmpl_mac_arm64.mak DISABLE_RAR_COMPRESS=1
RAR decompression codecs have license restrictions. Use DISABLE_RAR_COMPRESS=1 to build a version that can list RAR archives but not decompress them.

Output Directories

macOS builds output to platform-specific directories:
  • b/m_arm64/ - Apple Silicon builds
  • b/m_x64/ - Intel builds
  • _o/ - Default makefile.gcc builds

Installation

Install the built binary system-wide:
sudo cp b/m_arm64/7zz /usr/local/bin/
sudo chmod 755 /usr/local/bin/7zz
Verify:
7zz --version

Troubleshooting

You need to install Xcode Command Line Tools:
xcode-select --install
On macOS, pthread is part of the system libraries. Ensure you’re using the macOS-specific makefiles:
make -j -f ../../cmpl_mac_arm64.mak
Make sure you’re using the correct makefile for your Mac:
  • Apple Silicon: cmpl_mac_arm64.mak
  • Intel: cmpl_mac_x64.mak
Check your architecture:
uname -m
# arm64 = Apple Silicon
# x86_64 = Intel
If building shared libraries, ensure they’re in a location where dyld can find them:
export DYLD_LIBRARY_PATH=$PWD/b/m_arm64:$DYLD_LIBRARY_PATH

Performance Testing

Benchmark your build:
./b/m_arm64/7zz b
This runs the built-in benchmark to test compression/decompression performance.

Differences from p7zip

7-Zip for macOS is the official port from Igor Pavlov, distinct from the older p7zip project:
7-Zip for macOS (this build):
  • Current version (26.00 in this source)
  • Up-to-date with Windows version
  • Official support from 7-Zip developer
p7zip (legacy):
  • Last version: 16.02 (outdated)
  • Independent community port
  • No longer actively maintained

Next Steps

  • Test archive operations: ./b/m_arm64/7zz --help
  • Create archives: ./b/m_arm64/7zz a archive.7z files/
  • Extract archives: ./b/m_arm64/7zz x archive.7z

See Also

Build docs developers (and LLMs) love