Deleted /usr/bin/python by mistake

Discussion in 'Mac Apps and Mac App Store' started by arpit01, Feb 12, 2011.

  1. arpit01 macrumors newbie

    Joined:
    Feb 12, 2011
    #1
    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
     
  2. LPZ macrumors 65816

    Joined:
    Jul 11, 2006
    #2
    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.
     
  3. arpit01 thread starter macrumors newbie

    Joined:
    Feb 12, 2011

Share This Page