1

I am trying to set a symlink so that I can point the python command in Terminal to a new install of python3.

I last did this in Mojave, where one could disable csrutil and then run the following command before re-enabling:

sudo ln -s /usr/bin/python3 /usr/bin/python

Now I am trying to do the same in MacOS Ventura 13.1, and I am met with the error feedback:

ln: /usr/bin/python: Read-only file system

What is this new roadblock that "MacOSimandius, destroyer of worlds" throws in my path?

And more importantly (please): How do I set my symlink? It must still be possible. This is still unix, is it not?

10
  • How did you install Python?
    – Allan
    Feb 7, 2023 at 15:26
  • I have always done this using alias. Feb 7, 2023 at 16:23
  • @Allan It's been a while. Quite sure that I used pip.
    – Parapluie
    Feb 7, 2023 at 16:38
  • @AivarPaalberg I tried this first, and this also did not work. Perhaps these things together indicate the same problem? Or, perhaps, a bigger problem 8-(
    – Parapluie
    Feb 7, 2023 at 16:40
  • 1
    Easy enough with a search and replace. If they're written for python2, they'll probably need changing anyway.
    – benwiggy
    Feb 7, 2023 at 16:49

1 Answer 1

4

You can't modify /usr/bin any longer (at least not without disabling SSV). What you can do instead is

sudo mkdir -p /usr/local/bin
sudo ln -s /usr/bin/python3 /usr/local/bin/python

and then make sure that /usr/local/bin is in PATH.

2
  • If you install python from python.org, rather than using Apple's version which comes with Xcode Tools, it will create /usr/local/bin/python3 anyway.
    – benwiggy
    Feb 7, 2023 at 16:46
  • @nohillside This one is a winner! In my case, the final symlink was python -> ../../../Library/Frameworks/Python.framework/Versions/3.11/bin/python3. Thanks very much.
    – Parapluie
    Feb 7, 2023 at 17:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .