I've been wanting to try out SiriProxy for some Arduino home automation projects, but I refuse to buy a new phone when my iPhone 4 is still working just fine (yes, I stopped using my HTC One X; 6 months with Android is more than enough for me). But then I realized; I have Siri already, on my iPad 3. Surely I could use that? Indeed you can. So in this tutorial I'll walk you through getting SiriProxy working with your iPad 3 and Mac OS X - much of this will be relevant to Mountain Lion only though.
I also warn you in advance, this is pretty difficult stuff and almost all done on the command line, and while I've tried to break it down step by step in the exact manner that worked for me, you may need to Google some errors yourself as and when they arise.
Requirements
- iPad or iPhone with Siri capabilities. I won't be showing how to hack Siri onto older devices using fake servers, so don't ask.
- Mac OS X. You can install SiriProxy on Linux too but I won't be trying that today.
- iOS6.1
Preparing
Download the pkg installer for your OS X version from MacPorts.org. MacPorts allows us to install a variety of UNIX utilities that have been ported to Mac. You also need to have XCode installed, which can be downloaded for free from the Mac App Store, but it's a hefty download so get started now.
MacPorts adds some new path entries to your system, but doesn't update correctly. To avoid port command not found errors later, run
source .profile
At this point, you'll need to install XCode too, from the app store. When installed run this command to tell your system where the compiler is:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Next, install DNSMasq; a simple DNS forwarder that let's us intercept requests to a certain IP.
sudo port install dnsmasq
Install Ruby and RVM
Download and install RVM package manager with this command:
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
Then run this to correctly add it to your system:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
Install Ruby using the following command; this will use the latest version 1.9.3 at the time of writing, and I suggest you do the same or the rest of this guide probably won't work.
rvm install 1.9.3
If you get a bunch of random red text with an error, run this instead:
rvm install 1.9.3 –with-gcc=clang
then do
rvm use 1.9.3 default
to set the default ruby environment version. Congratulations, you now have Ruby on your system!
Download SiriProxy
Begin by using Git to clone the SiriProxy project to your machine.
git clone git://github.com/plamoni/SiriProxy.git
cd /SiriProxy
When you first do this, you may get a security warning about script files detected. Go ahead and trust this if you've download from the github source.
Next we're going to copy across the config file.
mkdir ~/.siriproxy
cp ./config.example.yml ~/.siriproxy/config.yml
Open up that config file using your favorite text editor, and change the IP at the top of the file from 0.0.0.0 to your Mac's local IP. Moving on:
rvmsudo gem install rake bundler
rvmsudo rake install
This should install SiriProxy for you, but we'll need to repeat this later on to deal with errors. For now, let's continue and make some certificates.
We'll need OpenSSL installed first.
sudo port install openssl
The first time I ran this, it failed with numerous zlib errors; to fix this I needed to run
sudo port -f activate zlib
Next, we'll generate certificates:
siriproxy gencerts
If all goes well, you should see a message similar to this.
Use the Finder->Go to Folder menu option to enter the path listed in the output; you should find a ca.pem file there. Email that to yourself, and then open it on your Siri capable device. This will jump over to settings, and give you the option to install it as a new certificate. Not, yours will say it's untrusted (in red) the first time around - I took this screenshot after installing, so it says trusted.
Back on your Mac, run the following command to update some random files that are needed.
bundle install
Setup DNS forwarding
The final step is to make your Mac into a DNS server that can intercept calls to Apple's servers and route them via SiriProxy instead. Again, using Finder->Go To Folder, open up /opt/local/etc, and edit dnsmsq.conf. Add the following line, replacing 192.168.0.6 with the local IP address of your Mac.
address=/guzzoni.apple.com/192.168.0.6
To activate DNSMasq service, run the following. You'll need to do this upon every restart (along with launching SiriProxy as we describe later).
sudo /opt/local/sbin/dnsmasq
On your iPad, or iPhone, open your network settings and change the DNS server of the WiFi to your Mac IP address. Yes, SiriProxy will only work over your home WiFi, but you can theoretically VPN into your home router if you wish to use it while out and about. We won't cover that today.
I also needed to set a new port forwarding rule on my router; port 53 should be forwarded to your Mac IP. (This is the port used by DNS)
Start SiriProxy
The final step is to start the SiriProxy server and test. Do this using:
export rvmsudo_secure_path=1
If at this point, you are getting a screen full of errors like "invalid symbol" as soon you press the home button, continue on with this bit. You're getting errors due to an older version of CFPropertyList included with the SiriProxy package. Hopefully this will be fixed soon, so you may not need this, but just in case…
Download the newest version of CFPropertyList like this:
sudo gem install CFPropertyList -v 2.1.2
Now, use Finder to Go To Folder ~/.rvm/gems/ . Navigate inside the lastest Ruby - in my case ruby-1.9.3-p385/ and copy the gems/CFPropertyList-2.1.2/lib folder over to ruby-1.9.3-p385@SiriProxy/gems/CFPropertyList 2.2.0 . Yes, authenticate and overwrite the older version lib with the lib from the newer version; a horrible hack, but the only way I could get it working. The final fix needed is to manually edit the gemspec file. Do this by changing to the SiriProxy directory, and opening up siriproxy.gemspec. Do this from the command line with VI or Nano using:
sudo vi siriproxy.gemspec
Or just use a text editor. Replace the line which is about 4 lines from bottom containing "CFPropertyList" with the following:
s.add_runtime_dependency('CFPropertyList', '2.1.2')
Now run
rvmsudo siriproxy update
And all should be good with the world. Start the server again and retest.
rvmsudo siriproxy server
Test it by asking Siri to "test siri proxy" and you should get a response that it's up and running. View more test commands here.
Next time, we'll look at some SiriProxy plugins you can run and actually start making use of this thing.
To be honest, that whole process was more immensely complicated than I hoped, but I hope this guide turns out useful for some of you, since it literally took me all day to get right. Do you have any recommendations for SiriProxy plugins that I should check out? Did this process work for you? Let us know in the comments, and I'll try to help you out, but the project GitHub page is full of far more knowledgeable folks.