Requirements
Xcode Command Line Tools
Install the Xcode Command Line Tools to get the Clang compiler and build tools:You don’t need the full Xcode IDE - just the Command Line Tools are sufficient.
Quick Start
Build Configurations
Apple Silicon (ARM64)
The ARM64 build includes assembler optimizations:var_mac_arm64.mak):
b/m_arm64/7zz
Intel x64
var_mac_x64.mak):
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
Architecture Variants
You can customize the ARM64 architecture flags invar_mac_arm64.mak:
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:Specific Build Targets
7zz (All Formats)
7za (Limited Formats)
7zr (7z Format Only)
Shared Library
7z.dylib
Using makefile.gcc
You can also use the genericmakefile.gcc for macOS:
Compiler Flags
macOS builds use Clang-specific warning flags (fromwarn_clang_mac.mak):
-O2
Universal Binaries
To create a universal binary (both Intel and ARM64):RAR Support Options
Control RAR support at build time:Disable All RAR Support
Disable RAR Decompression Only
Output Directories
macOS builds output to platform-specific directories:b/m_arm64/- Apple Silicon buildsb/m_x64/- Intel builds_o/- Defaultmakefile.gccbuilds
Installation
Install the built binary system-wide:Troubleshooting
xcrun: error: invalid active developer path
xcrun: error: invalid active developer path
You need to install Xcode Command Line Tools:
ld: library not found for -lpthread
ld: library not found for -lpthread
On macOS, pthread is part of the system libraries. Ensure you’re using the macOS-specific makefiles:
Architecture mismatch error
Architecture mismatch error
Make sure you’re using the correct makefile for your Mac:
- Apple Silicon:
cmpl_mac_arm64.mak - Intel:
cmpl_mac_x64.mak
dyld: Library not loaded error
dyld: Library not loaded error
If building shared libraries, ensure they’re in a location where dyld can find them:
Performance Testing
Benchmark your build: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
- 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
- Building Overview - General build information
- Building on Windows - MSVC builds
- Building on Linux - Linux builds with GCC