Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

macOS 12.3 code shell command doesn't work due to Python 2 being removed #141738

Closed
fishcharlie opened this issue Jan 28, 2022 · 10 comments
Closed
Assignees
Labels
*duplicate Issue identified as a duplicate of another issue(s)

Comments

@fishcharlie
Copy link

fishcharlie commented Jan 28, 2022

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: Version: 1.63.2 (Universal)
  • OS Version: macOS 12.3 Beta (21E5196i)

Summary

In macOS 12.3 beta Apple removed support for Python 2. Additionally Python 3 no longer comes bundled with macOS. This causes the code command to not work anymore.

The fact that VS Code is using Python 2 which hasn’t been officially supported since January 2020 is kinda crazy.

This should be fixed ASAP.


Steps to Reproduce:

  1. Ensure you are running macOS 12.3 Beta (21E5196i)
  2. Shell command: Install 'code' command in path in VS Code
  3. Run code in Terminal
/usr/local/bin/code: line 6: python: command not found
/usr/local/bin/code: line 10: ./MacOS/Electron: No such file or directory
@fishcharlie
Copy link
Author

Created a PR for this at #141749. Couple of questions included in there that might lead to more work tho. But figured it'd be a good start to get the ball rolling and try to get this done as quick as possible 😃.

@bpasero
Copy link
Member

bpasero commented Jan 29, 2022

See #134635 and #138582

//cc @deepak1556 @joaomoreno

@deepak1556
Copy link
Collaborator

/duplicate #134635

@makaracc
Copy link

makaracc commented Feb 3, 2022

I got mine working by:

  1. cd /usr/local/bin
  2. nano code
  3. change python => python3 on the following line
- function realpath() { python -c ...
+ function realpath() { python3 -c ...

And it's all set, hope it helps :) , and maybe there will be update to fix this idk
edit: seems this helped a few of us, so I made it more readable :)

@MovingKyu
Copy link

I have fixed the issue with "code" not working on local computer after replacing "python" with "python3".

Does any of you have problem withe the command "code" on remote server? The "code" command on remote server stop working after I have installed Mac OS 12.3. The command simply does nothing.

For example, when I open up file from terminal, I could easily do with "code ${FILE}"

After installing Mac OS 12.3, the command does not work anymore on remote server. My second Mac without beta version works fine on remote server, and the command works as usual. Anyone has an idea how to fix the problem with 12.3 version?

@LunarLanding
Copy link

LunarLanding commented Feb 15, 2022

Apparently this script depends on python3 to provide realpath. It's a bit kaufkian; I have realpath installed with gnu utils from brew so I just commented the python line out.

@jiteshdhamaniya
Copy link

jiteshdhamaniya commented Feb 22, 2022

I got mine working by:

  1. cd /usr/local/bin
  2. nano code
  3. change python => python3 on the following line
- function realpath() { python -c ...
+ function realpath() { python3 -c ...

And it's all set, hope it helps :) , and maybe there will be update to fix this idk edit: seems this helped a few of us, so I made it more readable :)

this works for me. thanks

@LouieMjr
Copy link

LouieMjr commented Feb 26, 2022

npm install isn't working now because of the same issue it seems. Anyone get that ERR yet ?

@dmackinn
Copy link

For those of you having issues with this on 12.3 you can always just symlink python to python3 in /usr/local/bin and it will work.

@orditeck
Copy link

For those of you having issues with this on 12.3 you can always just symlink python to python3 in /usr/local/bin and it will work.

I had python3 installed through brew so I simply ran ln -s /opt/homebrew/bin/python3 /opt/homebrew/bin/python

@github-actions github-actions bot locked and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

13 participants