Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arpit01

macrumors newbie
Original poster
Feb 12, 2011
2
0
Hi,

I installed and uninstalled a newer version of Python, and, by mistake, deleted /usr/bin/python.

All the system files for python are intact. Could somebody please tell me how to restore it (what files do I need to copy / create links) ?

Thanks
Arpit
 
Hi,

I installed and uninstalled a newer version of Python, and, by mistake, deleted /usr/bin/python.

All the system files for python are intact. Could somebody please tell me how to restore it (what files do I need to copy / create links) ?

Thanks
Arpit

Do you still have /usr/bin/pythonw? That file is identical to the file /usr/bin/python (I checked using diff). According to the man page for python:

Code:
PYTHON(1)                 BSD General Commands Manual                PYTHON(1)

NAME
     python, pythonw -- an interpreted, interactive, object-oriented program-
     ming language

SYNOPSIS
     python ...
     pythonw ...

DESCRIPTION
     To support multiple versions, the programs named python and pythonw now
     just select the real version of Python to run, depending on various set-
     tings.  (As of Python 2.5, python and pythonw are interchangeable; both
     execute Python in the context of an application bundle, which means they
     have access to the Graphical User Interface; thus both can, when properly
     programmed, display windows, dialogs, etc.)  The current supported ver-
     sions are 2.5 (provided for backward-compatibility with the Python 2.5
     family), 2.6 and 3.0, with the default being 2.6.  Use

           % man python2.5
           % man python2.6
           % man python3.0
           % man pythonw2.5
           % man pythonw2.6
           % man pythonw3.0

Thus you could just copy pythonw and call it python. Not sure why Apple included two identical files rather than using a symlink, but I'd make sure that I did what Apple did, i.e., copy rather than link.

You can read all about this by entering

Code:
man python

in Terminal.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.