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:
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
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>
(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:
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)
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).
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)