4

There are no /proc in macOS, however I want to get infomation about my system such as:

  1. /proc/loadavg
  2. /proc/cpuinfo
  3. /proc/meminfo
  4. /proc/mounts
  5. /proc/stat

Is there any alternatives in macOS for that?

Yash Chitroda
  • 645
  • 4
  • 8
  • 27
calvin
  • 2,125
  • 2
  • 21
  • 38
  • Analogous info is mostly available via commands in macOS, rather than being mapped into the filesystem. See [serverfault: "How can I get CPU count and total RAM from the OS X command line?"](https://serverfault.com/questions/112711/how-can-i-get-cpu-count-and-total-ram-from-the-os-x-command-line) for some examples. – Gordon Davisson Aug 14 '21 at 03:55
  • "/proc" is Linux. MacOS is emphatically *NOT* Linux: it's a BSD derivative. You can look [here](https://macdevelopers.wordpress.com/2014/01/24/programmatically-retrieving-system-information-on-mac/) for `system_profiler`, or [here](https://stackoverflow.com/questions/53073677/how-do-i-use-libproc-h-in-a-modular-swift-framework) for `libproc`. There might be other options, depending on your OS version. – paulsm4 Aug 14 '21 at 04:19

1 Answers1

7

In MacOS, you can get all this informations in CLI with sysctl command.

sysctl -a //for all information
or
sysctl hw.memsize //for memory
sysctl hw.ncpu //cpu info
Chris Hess
  • 129
  • 3