Ways to invoke python and Spyder on OSX

Navigate to anaconda/bin, locate spyder (or IPython, etc.), and drag it to the dock — but put it in the documents section at the end. Then you’ll have easy access to it, and when you click on it Mac OS X will launch a shell that runs it, and it will appear in the applications section, so that you can bring the running application forward by clicking on it.


You can use Automator to create an Application that will run Unix Script. Open Automator when it asks for document type put "Application"

Search and click on "Run Shell Script". You can leave /bin/bash as it is and type in the box the location of spyder (as given by typing which spyder in the terminal). Then you save the file and you are done. This also gets rid of the problem I had when terminal runs in the background and gives you a application you can drag to the dock. You can also change the logo as suggested above.

(I did this with Mac OS 10.10 and a Anaconda 2.3.0)


To make spyder callable from Spotlight or Finder:

  1. Locate where your spyder executable is by running in Terminal:

    which spyder
    

    This should yield ~/anaconda/bin/spyder if you installed spyder via Anaconda, /opt/local/bin/spyder if you used MacPorts or something similar.

  2. Create a file called spyder in your Applications directory and make it executable. Then, fill it with the output of the previous command, followed by a &; exit:

    touch /Applications/spyder
    chmod +x /Applications/spyder
    echo -e '#!/bin/bash'"\n~/anaconda/bin/spyder &\nexit" >> /Applications/spyder
    

    (if you use a different shell (e.g. tcsh), replace bash by that)

  3. Under Terminal -> Preferences -> Profiles -> "default profile" -> Shell -> When the shell exits: Select "Close if the shell exited cleanly"

Optional:

  1. Download the spyder Icon from here and open it in Preview. Copy its contents by hitting cmd+C.

  2. In Finder, locate /Applications/spyder and open its "Get Info" pane by hitting cmd+I. Select the icon in the top left corner with your mouse and hit cmd+V.


The accepted answer has two drawbacks: a console windows appears when starting spyder and one cannot keep a spyder icon in the dock. These drawbakcs can be avoided by creating a proper Mac application bundle for spyder, which is surprisingly easy to do.

To convert /usr/local/bin/spyder3 (the result of which spyder3 on my machine) into a traditional Mac application:

  1. Create a Mac application bundle (basically a folder structure containing an executable file):

    cd /Applications
    mkdir -p spyder.app/Contents/MacOS
    echo -e '#!/bin/bash'"\n /usr/local/bin/spyder3 $@" >> spyder.app/Contents/MacOS/spyder
    chmod +x spyder.app/Contents/MacOS/spyder
    
  2. Create a plain text file called Info.plist in the Contents folder (i.e. at spyder.app/Contents/Info.plist) with the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
    <plist version="0.9">
    <dict>
    <key>CFBundleExecutable</key>
    <string>spyder</string>
    <key>CFBundleInfoDictionaryVersion</key>
    <string>3.1.4</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleVersion</key>
    <string>3.1.4</string>
    </dict>
    </plist>
    
  3. (Optional) Create an app icon like in steps 4 and 5 of the accepted answer.

Voilà, spyder has become suddenly much more Mac-friendly!

EDIT:
One can further improve the mac-friendliness of spyder by:

  1. Preventing the generic python rocket icon to appear besides the spyder icon
    For this, uncheck in spyder the option Tools -> Preferences -> iPython console -> Graphics -> Activate (matplotlib)

  2. Making spyder the default editor for .py files.
    This one is more tricky. First make sure that the content of spyder.app/Contents/MacOS/spyder reads

    #!/bin/bash
    /usr/local/bin/spyder $@
    

Create then an automator script containg a single action "Execute a shell script". Paste the following (bash) script in it:

for f in "$@"
do
    open /Applications/spyder.app --args $f
done
if [ -z "$f" ]; then
    open /Applications/spyder.app --args ~
fi

Choose "As argument" for the input data, as shown in the screenshot below (the "--args ~" is missing in the screenshot but it is needed to avoid an error when launching spyder without any file). automator script
Save this script as an application called "SpyderOpener" for instance.

Make SpyderOpener the default application for opening .py files (by using the Finder "Get Info" dialog on a .py file)