| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A free command replacement for macOS that displays memory usage information similar to the Linux free command.
macOS doesn't include a free command like Linux. This utility provides a familiar interface for checking memory usage, using native macOS APIs to gather accurate memory statistics.
makemake debuggit clone https://github.com/techquestsdev/mac-free.git
cd mac-free
# Build and install
make
sudo make install
# or use Homebrew
brew install techquestsdev/tap/mac-freeInstalling from source will add free command to /usr/local/bin/. You can specify a different prefix:
sudo make install PREFIX=/opt/localfree [options]| Option | Long Form | Description |
|---|---|---|
| -b | --bytes | Display output in bytes |
| -k | --kibi | Display output in kibibytes (default) |
| -m | --mebi | Display output in mebibytes |
| -g | --gibi | Display output in gibibytes |
| -h | --human | Display output in human-readable format |
| -w | --wide | Wide output (show all memory categories) |
| -t | --total | Show total for RAM + swap |
| -s N | --seconds N | Repeat printing every N seconds |
| -c N | --count N | Repeat printing N times, then exit |
| -P | --pressure | Show macOS memory pressure (kernel signal) |
| -V | --version | Output version information and exit |
| --help | Display help and exit |
$ free
total used free shared buff/cache available
Mem: 16777216 8388608 2097152 0 6291456 8388608
Swap: 2097152 524288 1572864Human-readable format:
$ free -h
total used free shared buff/cache available
Mem: 16.0Gi 8.0Gi 2.0Gi 0B 6.0Gi 8.0Gi
Swap: 2.0Gi 512.0Mi 1.5GiWide output with all memory categories:
$ free -w -h
total used free active inactive wired compressed available
Mem: 16.0Gi 8.0Gi 2.0Gi 4.0Gi 2.0Gi 2.0Gi 1.0Gi 8.0Gi
Swap: 2.0Gi 512.0Mi 1.5GiMonitor memory every 2 seconds:
free -h -s 2Monitor memory 5 times with 1 second interval:
free -h -s 1 -c 5Show macOS memory pressure (real kernel signal):
$ free -h -P
total used free shared buff/cache available
Mem: 16.0Gi 8.0Gi 2.0Gi 0B 6.0Gi 8.0Gi
Swap: 2.0Gi 512.0Mi 1.5Gi
Pressure: normal (50% available)Show totals:
$ free -h -t
total used free shared buff/cache available
Mem: 16.0Gi 8.0Gi 2.0Gi 0B 6.0Gi 8.0Gi
Swap: 2.0Gi 512.0Mi 1.5Gi
Total: 18.0Gi 8.5Gi 3.5Gi| Column | Description |
|---|---|
| total | Total installed physical memory |
| used | Used memory(Active + Wired + Compressed) |
| free | Completely unused memory |
| shared | Always 0: macOS exposes no system-wide shared-memory counter |
| buff/cache | Reclaimable file cache (Inactive + Purgeable + Speculative) |
| available | Estimate of memory available for starting new applications |
| Column | Description |
|---|---|
| active | Memory currently in use or recently used |
| inactive | Memory marked as not recently used |
| wired | Memory that cannot be paged out(kernel, drivers) |
| compressed | Memory that has been compressed to save space |
This utility uses macOS - specific APIs to gather memory information:
buff/cache: On Linux, this shows buffer and cache memory separately. On macOS, we sum the reclaimable file cache: inactive + purgeable + speculative pages.
shared: Linux tracks shared memory segments (Shmem). macOS exposes no equivalent system-wide counter, so this is reported as 0 rather than a misleading approximation.
available: Both systems estimate available memory, but the calculation differs due to different memory management strategies.
Wide mode: Shows macOS-specific categories (compressed memory is unique to macOS).
Memory pressure (-P): macOS relieves memory pressure with an in-RAM compressor before it touches swap, so the Linux-style free/swap columns can look healthy while the system is actually thrashing. -P prints the real kernel signal (kern.memorystatus_vm_pressure_level — the same one Activity Monitor uses): normal, warning, or critical.
sudo make uninstallOr manually:
sudo rm /usr/local/bin/freeUse sudo for installation:
sudo make installThis is expected.Activity Monitor may use slightly different calculations or update at different intervals.The values should be close but not identical.
macOS uses dynamic swap. If no swap file has been created yet, total swap may show as 0. Swap files are created on - demand in /private/var/vm/.
Contributions are welcome! Please feel free to submit issues or pull requests.
# Build with debug symbols
make debug
# Run tests
make test
# Clean build artifacts
make cleanMIT License - See LICENSE file for details.
| Back | FazBrowse Home | New Git URL |