Wednesday, May 6, 2015

Macports' select command

I've been searching everywhere online and I can't find any information on Macports' "select" command. So here I list down what I personally need. I hope that helps anyone else reading this.

In OS X, after installing, say python34 via Macports, "python" still points to Yosemite's built-in Python:

$ which python
/usr/bin/python

To have "python" point to the new python34, we use Macports' "select" command:

$ sudo port select --set python python34
Selecting 'python34' for 'python' succeeded. 'python34' is now active.

$ which python
/opt/local/bin/python

$ ls -l /opt/local/bin/python
lrwxr-xr-x  1 root  admin  24 May  6 16:47 /opt/local/bin/python -> /opt/local/bin/python3.4

Perfect. Now "python" points to /opt/local/bin/python, which points to /opt/local/bin/python3.4.

To have "python" link back to Yosemite's default installation:

sudo port select --set python none
Selecting 'none' for 'python' succeeded. 'none' is now active.

$ which python
/usr/bin/python

hth





No comments:

Post a Comment