Create Dock Icon for Spyder (installed with Anaconda)
How can I create a single dock icon for an application that is launched via the Terminal?
I have installed spyder using anaconda. I can create a launcher app using Platypus (see this answer). But the actual spyder-application opens a new (ugly) dock icon labeled "python" next to it:
The confusion starts when I want to switch to the Spyder app: I have to click on the python icon and not on the spyder one...
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:
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.