question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`pidcat` installed via `brew` no longer works on macOS 12.3, due to Python 2 having been removed

See original GitHub issue

Hey!

First off, thank you for the great util, Jake. And all the other cool stuff you’ve built througout the years.

I’m having an issue where pidcat, installed from brew, can no longer run on macOS 12.3. I believe this is because of Python 2 having been removed on this version of macOS.

I’m getting the following output, when attempting to run pidcat:

~ pidcat
zsh: /opt/homebrew/bin/pidcat: bad interpreter: /usr/bin/python: no such file or directory

This in turn is caused by https://github.com/JakeWharton/pidcat/blob/44b4a106bb25776cbb551044b303520a07a51c1e/pidcat.py#L1:

#!/usr/bin/python -u

On macOS 12.3, /usr/bin/python does not exist - only /usr/bin/python3.

Running on the latest development version (as listed in the current README.md, does not solve the issue, as it still looks for python, which still does not exist.

One alternative that could resolve the issue would be to update pidcat to explicitly try to use python3, but this would have some less desirable backwards compatibility issues, perhaps.

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:36
  • Comments:18

github_iconTop GitHub Comments

34reactions
rafaelmaeuercommented, May 11, 2022

I was able to fix it with following steps:

# Use pyenv to install python2 with:
brew install pyenv
pyenv install 2.7.18
 
# Optionally set it to your global default:
pyenv global 2.7.18
 
# Create Alias in .zshrc
alias python=/Users/<user>/.pyenv/versions/2.7.18/bin/python
 
# Reload shell and test
source .zshrc
python -V

# Find Pidcat script
which pidcat

# Edit shebang line
sudo nano path/to/pidcat

# Replace first line:
#!/Users/<user>/.pyenv/versions/2.7.18/bin/python -u

9reactions
joxcommented, Mar 25, 2022

Simply symlinking python to python3 isn’t a good idea. First of all, it is not “simple” on macOS due to SIP since OS X 10.11. Secondly, it might produce confusion and unexpected results on other ends (e.g. Python things that expect python to be Python 2).

The real solution would be to fully depend Pidcat on Python 3. It’s also about time, since Python 2 has long-since reached end of life.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Restoring Python 2 on macOS 12.3 and Higher - BytesGuys' Bits
Python 2 has been deprecated, and EOL, for a number of years now (Homebrew deleted the formula some time ago), so the removal...
Read more >
env: python: No such file or directory when building app ...
Homebrew only installs the binary python3 , just to be safe. Xcode is complaining about a lack of the binary python (note the...
Read more >
Apple Finally Removing Python 2 in macOS 12.3
Apple will no longer bundle Python 2.7 with macOS 12.3, according to developer release notes for the upcoming software update. Python 2 has...
Read more >
Python 2.7 was removed from macOS in this update and ...
All of them rely on Python 2. Who deleted my Python? It took me a moment to realize that a new Mac OS...
Read more >
Apple removes Python 2 in macOS Monterey. What now?
Apple has been warning that the Python 2 binary will be removed. ... been updated to macOS 12.3 and higher can help workaround...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found