Reputation: 81
I need to get the pid of current processs on Mac OS? I find that GetCurrentProcess function is deprecated. So is there any other methods?
Upvotes: 1
Views: 3652
Reputation:
By using getpid()
, just like any other UNIX system. (The documentation I've linked to is related to iOS, but the system call works identically on macOS.)
The GetCurrentProcess call was part of the Carbon API, which was made available for porting applications from Mac OS 9. It's no longer available in current versions of macOS.
Upvotes: 3
Reputation: 2771
You can install pidof with Homebrew:
`
brew install pidof
pidof <process_name>
`
Upvotes: -1