Skip to content

Commit 3bc6d9f

Browse files
authored
docs: Add instructions about profiling on macOS (#4202)
Unfortunately SIP gets in the way of profiling system binaries using pyspy. benfred/py-spy#397 (comment)
1 parent e37b302 commit 3bc6d9f

File tree

1 file changed

+19
-0
lines changed
  • docs/sources/configure-client/language-sdks

1 file changed

+19
-0
lines changed

‎docs/sources/configure-client/language-sdks/python.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ To capture and analyze profiling data, you need either a hosted Pyroscope OSS se
2323

2424
The Pyroscope server can be a local server for development or a remote server for production use.
2525

26+
### Profiling on macOS
27+
28+
macOS has a feature called System Integrity Protection (SIP) that prevents even the root user from reading memory from any binary located in system folders.
29+
30+
The easiest way to avoid interference from SIP, is by installing a Python distribution into your home folder. This can be achieved for example by using `pyenv`:
31+
32+
```bash
33+
# Setup pyenv
34+
brew update
35+
brew install pyenv
36+
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
37+
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
38+
echo 'eval "$(pyenv init - zsh)"' >> ~/.zshrc
39+
# Restart your shell
40+
exec "$SHELL"
41+
# Install Python 3.12
42+
pyenv install 3.12
43+
```
44+
2645
## Add Python profiling to your application
2746

2847
Install the `pyroscope-io` pip package:

0 commit comments

Comments
 (0)