https://github.com/mohamedelashri/free-mac
A free-like memory monitor tool for MacOS.
https://github.com/mohamedelashri/free-mac
cli free macos memory-monitoring
Last synced: 3 months ago
JSON representation
A free-like memory monitor tool for MacOS.
- Host: GitHub
- URL: https://github.com/mohamedelashri/free-mac
- Owner: MohamedElashri
- License: mit
- Created: 2024-02-28T02:32:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-05-04T18:30:38.000Z (about 1 year ago)
- Last Synced: 2025-01-13T19:46:26.853Z (4 months ago)
- Topics: cli, free, macos, memory-monitoring
- Language: C
- Homepage:
- Size: 44.9 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/MohamedElashri/free-mac/actions/workflows/compile.yml)
# Free Command for macOS
## Overview
The `free` command is a well-known utility in Linux environments, providing a quick overview of the system's memory usage, including total, used, and free memory, along with swap space information. However, macOS lacks this tool natively. The `free` tool for macOS aims to bridge this gap, offering macOS users a similar functionality to monitor their system's memory usage directly from the command line.## Features
- **Memory Usage Overview**: Displays total, used, free, cached, app, and wired memory.
- **Swap Space Usage**: Provides details on total, used, and `free` swap space.
- **Human-Readable Format**: Outputs memory statistics in an easily understandable format.
- **Feature parity with Linux free**: The tool aims to provide similar functionality to the `free` command in Linux environments.
## Installation
### Homebrew
The free tool for macOS is available via Homebrew This is the easisest way to use it. Add this tap to your Homebrew
```bash
brew tap MohamedElashri/free-mac
```
Once the tap has been added, you can install `free-mac` by running:
```bash
brew install free-mac
```### Build for source
#### Requirements
- GCC compiler or equivalent
- macOS system
#### CompilingThe project includes a Makefile for straightforward compilation. There are two targets:
- make release for compiling the tool for production use.
- make test for compiling with AddressSanitizer for development and debugging.##### Release Build
```bash
make release
```##### Test Build
```bash
make test
```#### Running the Tool
After compilation, execute the binary from the terminal to see memory statistics:
```bash
./free
```##### Cleaning Up
To remove the compiled objects and executable:
```bash
make clean
```#### Example Output
Running the free command outputs the memory and swap usage in a formatted table, similar to the following:
```bash
total used free cached app wired
Mem: 16.00 GB 12.77 GB 26.95 MB 3.20 GB 5.15 GB 1.99 GB
Swap: 2.00 GB 359.94 MB 1.65 GB
```## Man Page
### NAME
free - display amount of free and used memory in the system
### SYNOPSIS
```bash
free [OPTIONS]
```### DESCRIPTION
The free command provides information about the total amount of physical and swap memory in the system, as well as the free and used memory.
### OPTIONS
- `-b, --bytes`: Display the amount of memory in bytes.
- `-k, --kibi`: Display the amount of memory in kibibytes. This is the default.
- `-m, --mebi`: Display the amount of memory in mebibytes.
- `-g, --gibi`: Display the amount of memory in gibibytes.
- `--tebi`: Display the amount of memory in tebibytes.
- `--pebi`: Display the amount of memory in pebibytes.
- `--kilo`: Display the amount of memory in kilobytes. Implies --si.
- `--mega`: Display the amount of memory in megabytes. Implies --si.
- `--giga`: Display the amount of memory in gigabytes. Implies --si.
- `--tera`: Display the amount of memory in terabytes. Implies --si.
- `--peta`: Display the amount of memory in petabytes. Implies --si.
- `-h, --human`: Show all output fields automatically scaled to shortest three digit unit and display the units of print out.
- `-w, --wide`: Switch to the wide mode. The wide mode produces lines longer than 80 characters.
- `-c, --count count`: Display the result count times. Requires the -s option.
- `-l, --lohi`: Show detailed low and high memory statistics.
- `-L, --line`: Show output on a single line, often used with the -s option to show memory statistics repeatedly.
- `-s, --seconds delay`: Continuously display the result delay seconds apart.
- `--si`: Use kilo, mega, giga etc (power of 1000) instead of kibi, mebi, gibi (power of 1024).
- `-t, --total`: Display a line showing the column totals.
- `-v, --committed`: Display a line showing the memory commit limit and amount of committed/uncommitted memory.
- `--help`: Print help.
- `-V, --version`: Display version information.
-
## LicenseThis project is released under the MIT License. See the LICENSE file for more details.
## Contributing
Contributions to the free-mac are welcome! Please feel free to submit pull requests or file issues through GitHub to suggest improvements or report bugs.