Apple - Create Dock Icon for Spyder (installed with Anaconda)

Platypus is not necessarily needed to add an icon to spyder:

Starting spyder in the CLI is a two stage process:

~/anaconda/bin/spyder is a shell script executing the "proxy app" ~/anaconda/bin/python.app which itself launches another "proxy app" ~/anaconda/python.app/Contents/MacOS/python including an argument.


Since the last shell script resides in an app bundle you can simply add an icon:

The two proxy apps are "wrappers/launchers" for all other python science apps included in Anaconda. You don't want to break Anaconda - therefore you have to create two "spyder-only" launchers.

Make a copy of ~/anaconda/bin/python.app: ~/anaconda/bin/python.spyder.app and change the shell script inside (don't forget to also change the user in the path!).

#!/bin/bash
export PYTHONEXECUTABLE=/Users/user/anaconda/bin/python
/Users/user/anaconda/python.spyder.app/Contents/MacOS/python "$@"

Then create a copy of ~/anaconda/python.app: ~/anaconda/python.spyder.app and add an icon to it.

Started from the Terminal the command spyder will launch python.spyder.app with the custom icon.

Now you may use Platypus to create an app to launch spyder (instead of using Terminal.app). Use the following settings:

Platypus spyder

This may break after an Anaconda or a spyder update.


I don't think you can run spyder with a single spyder dock icon (with the Platypus spyder launcher as a permanent Dock item) because the python.spyder.app/python.app itself is a wrapper for spyder again. So after hitting the Platypus spyder app icon in the Dock you will always get a second spyder icon - the reason why your solution shows the default python.app icon.

Tags:

Python

Dock

Icon