snpd is a small server written in Python which translates incoming SNP 3.0 requests and displays them using Notification Center.
What you need
To complete this tutorial you’ll need the following:
Before you begin
- Please note that snpd is still in development – we’re hoping this tutorial will encourage people to try it out and provide feedback on what doesn’t work and what can be improved (being able to specify the TCP port to listen on is already on the to-do list);
- snpd-osx relies on features included with Python 3.4 – earlier versions of Python (especially 2.x) will not work.
Getting up and running on OS X takes a little bit of setting up, mainly because snpd requires Python 3 which doesn’t ship with OS X.
Installing Python 3.4 and PyObjC
Firstly, download and install Python 3.4 for OS X. Once Python is installed, navigate to Applications/Python 3.4 and double-click the Update Shell Profile.command file. This will modify your $PATH variable so Python 3.4 and pip can be found.
Next, install PyObjC by launching Terminal and entering:
pip3.4 install -U pyobjc-core
This will take a little while to download and install. Once complete, enter the following:
pip3.4 install -U pyobjc
Again, this will take some time to download and install. If you get stuck, the PyObjC site has more information.
Download snpd-osx and extract the archive contents somewhere handy, such as your home folder.
Launch a terminal session, navigate to ~/snpd-osx (or wherever you unzipped it to) and run snpd.py as follows:
You should see the following text displayed:
SNP3daemon for OS X 0.1 Copyright (C) 2015 full phat products Server started on port 9887; press CTRL+C to exit.
snpd is now running. We’ll now test connectivity from the same computer. Leave this Terminal window alone and launch another Terminal. In the new window enter:
telnet 127.0.0.1 9887
To connect to port 9887 on this computer. You should see the following:
Trying 127.0.0.1... Connected to 127.0.0.1. Escape character is '^]'.
Enter the following lines, pressing return in place of the ¬ characters:
SNP/3.0¬ notify?title=Hello, OS X!&text=From Snarl&icon=!snarl¬ END¬
With luck, you should see the following displayed on screen:
And this returned in the terminal window:
SNP/3.0 OK END
Awesome! Now we’ve proven everything seems to be working, let’s test it using Snarl.