I have been using Xcode 7 as my default python editor for some time now. The usual method to run python from Xcode is given here https://stackoverflow.com/questions/5276967/python-in-xcode-7/8636301#8636301.
But with the new release of El Capitan (OS X 10.11), the /usr/local/bin/ directory is locked and in the step in "Edit Scheme > Info > Executable" where the executable has to be selected from a pop-up window, since the SIP is enforced, this is not possible. I already own the /usr/local/ but this hasn't helped. It is worthwhile to note that this problem should not be python version specific.
Can somebody suggest a workaround for this?
I know I will receive suggestions for using other editors and engines such as Eclipse and Canopy, but no thank you (no offence to Eclipse or Enthought of course).
Best Answer
My system is OS X 10.11 El Capitan with SIP enabled, with Xcode 7.2.1, and the following solution work for me.
The solution briefly: for your executable, select the Python installed in your system, which resides in:
The location of Python.framework depends on which distribution of Python you're using. Most often it can be found in
/Library/Frameworks
.More comprehensive directions below.
Edit your Xcode scheme:
Now, the place where the actual executables varies, depending on which Python distribution you chose to install. None of those, to my knowledge, place anything but symlinks to
/usr/local/bin
or/opt/local/bin
. Below, I'll provide directions to finding your Python executable file.MacPython
This is the version from the official Python website, and it resides in
/Library/Frameworks/Python.framework
.ActiveState ActivePython
Installs to the same directory as MacPython.
MacPorts
MacPorts installs its python to
/opt/local/Library/Frameworks/Python.framework
.HomeBrew
HomeBrew has two possible locations for your Python.framework, because unlike any other distribution, HomeBrew installs them separately.
/usr/local/Cellar/python
/usr/local/Cellar/python3
Inside either of them, you'll find
Frameworks/Python.framework
.All distributions
Inside any
Python.framework
, you'll want to open a folder namedVersions
. Inside, you'll find folders corresponding to Python versions installed on your system. Open whichever one you want to use, and inside You'll find an executable namedPython
. You're done!