https://github.com/mezantrop/sockstat
FreeBSD-like sockstat for macOS using libproc
https://github.com/mezantrop/sockstat
libproc macos open-ports sockets sockstat
Last synced: 5 months ago
JSON representation
FreeBSD-like sockstat for macOS using libproc
- Host: GitHub
- URL: https://github.com/mezantrop/sockstat
- Owner: mezantrop
- License: bsd-2-clause
- Created: 2023-11-09T19:14:44.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-26T14:55:24.000Z (over 1 year ago)
- Last Synced: 2025-03-31T07:22:21.741Z (7 months ago)
- Topics: libproc, macos, open-ports, sockets, sockstat
- Language: C
- Homepage:
- Size: 249 KB
- Stars: 16
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Sockstat for macOS
[](https://github.com/mezantrop/sockstat/actions/workflows/codeql.yml)
[](https://github.com/mezantrop/sockstat/actions/workflows/c-cpp-macos.yml)## FreeBSD-like sockstat for macOS using libproc

### Download
See releases and [Download](https://github.com/mezantrop/sockstat/releases) a precompiled universal binary
### Build from sources
You can compile everything from sources. To install `sockstat` into `bin` directory under `/usr/local`, run:
```sh
make install clean
```If using a custom installation path, define `PREFIX`:
```sh
make install clean PREFIX=/path/to/install
```To build a universal binary suitable both for x64 and M-processors:
```sh
make universal install clean
```To deinstall:
```sh
make uninstall
```### Usage
```sh
Usage: sockstat [-46TUklnrquhv]-4 Show AF_INET (IPv4) sockets
-6 Show AF_INET6 (IPv6) sockets
-T Show TCP protocol
-U Show UDP protocol
-k Show AF_SYSTEM (Kernel) sockets
-n Show AF_NDRV sockets
-r Show AF_ROUTE sockets
-u Show AF_LOCAL (UNIX) sockets-l Show only LISTENing sockets
-q Quiet mode - suppress header-h This help message
-v Show program version
```Run `sockstat` as `root` to see **all**, (not only the current user's) sockets
### Performance
I do not think, performance plays here any role, but anywhy: the same good old MacBook Air late 2015, idle state.
Graphs `lsof` vs `sockstat` - the lower, the better. 
If you have an idea, a question, or found a problem, do not hesitate to open an
[issue](https://github.com/mezantrop/sockstat/issues) or mail me: Mikhail Zakharov