126

I am reading a book that speaks about Bash in Linux systems. But I am a Mac OS X user and I cant find /proc folder in my machine.

Where I can see the Mac OS X terminal equivalent of the /proc folder?

slhck
  • 223,558
  • 70
  • 607
  • 592
sensorario
  • 1,457
  • 2
  • 11
  • 10
  • 5
    read "Mac OS X internals" by Amit Singh (ISBN 0321278542 http://osxbook.com/ ) for more on the way Mac OS X specifically does things. A more generic intro to Unix: http://www.cs.duke.edu/csl/docs/unix_course/ with a nice+small chapter on shells: http://www.cs.duke.edu/csl/docs/unix_course/intro-55.html – Florenz Kley Aug 14 '13 at 07:26
  • 1
    Update for 2020: See Jonathan Levin's *Mac OS and \*OS Internals* at [newosxbook.com](http://newosxbook.com/). – Jivan Pal Sep 25 '20 at 13:21

1 Answers1

128

To communicate with the kernel, different UNIX systems use different interfaces - not necessarily procfs. It's not a must-have. While it's become quite common with Linux and FreeBSD indeed, OS X (which is based on BSD) does not implement a procfs.

The equivalents to most proc calls would be found in other tools such as sysctl(8) and the sysctl(3) call. Read the manpages (man 8 sysctl or man 3 sysctl) for some examples. Other things you can do with proc cannot be done easily on OS X. This is just a design choice.

See also:

Note that Bash is just a shell (a command line program) that you can use within a terminal emulator (such as Terminal.app on OS X). The shell does not have anything to do with the underlying file system or system architecture. You could switch to any other shell like Zsh or csh – or even another terminal emulator such as iTerm2 – and still use the procfs.

slhck
  • 223,558
  • 70
  • 607
  • 592
  • 1
    Excellent `procfs` article you linked to. – voices Mar 26 '17 at 02:09
  • Thanks for the answer, however the online man pages form Apple were archived and these links to sysctl(3) and sysctl(8) are broken now. I could find a mirror only to [sysctl.3](http://mirror.informatimago.com/next/developer.apple.com/documentation/Darwin/Reference/ManPages/man3/sysctl.3.html) only in a mirror website. I would recommend to use the built in man pages in the OS as a source of truth using `$man sysctl` – Montaro Jul 10 '18 at 14:09
  • I don't seem to have a man page for sysctl on Mojave. I miss proc. – Kallaste Feb 22 '19 at 23:56
  • @Kallaste I'm not on Mojave yet, so I can't test it, but manpages might only be available with Xcode command line tools. On High Sierra, `man sysctl` still works. – slhck Feb 23 '19 at 14:22
  • `man sysctl` works on OSX Catalina – rapidclock Oct 12 '19 at 19:48