Speedtest.net for your Terminal with tespeed

Introduction

In the last few days I had some trouble with my internet connection at home. Our walls are really thick and the w-lan router is approximately 15m away and if all doors are close my MBP rarely sends packages through the internet. I could play lottery with my ping log – it’s so randomly.

Because of this situation I visited Speedtest.net a lot to test my bandwidth. If my Laptop stands directly beside the router I have a download rate of almost 50Mbit/s. Unfortunately, in my room it sinks to 1-2Mbit/s, if I’m lucky. Speedtest is a nice website but I was sick of surfing to this site especially if it last for few minutes. I googled and found a nice Python script which uses Speedtest.net but is executable in terminal.

Tespeed

Janis Jansons (@GitHub) explains shortly in his blog what tespeed (tespeed on github) is about and how it can be used. I want to cover it shortly and show how I got it runnable on a Mac.

To use tespeed you need Python installed. Fortunately, Python is preinstalled on every Mac. If you’re interested in where Python is stored type the following command in your terminal. Usually it is stored in /usr/bin/python.

Now we can download tespeed. I cloned it with git.
git clone git://github.com/Janhouse/tespeed.git
If you don’t have git installed don’t panic. You can download it directly from github. Copy the folder where you want and you’re ready to go. If you want to run tespeed just navigate into the folder and type:
python tespeed.py

If you see something like this everything is working perfectly. Tespeed is looking for some server near your place and starts downloading and uploading files to calculate your bandwidth.

Like mentioned above I had some problems. Tespeed needs lxml and I didn’t have it. To get lxml use easy_install.
sudo easy_install lxml

 

Without sudo easy_install wasn’t able to install lxml.

Lxml installs using sudo but a bunch of warnings are printed. Don’t panic to much about it. It should work fine.

After installing lxml Tespeed worked just fine. I also added an alias to my .bash_profile to access tespeed easily.

AlfredSpeed

My internet connection isn’t fixed but I had an idea: I want to build an Alfred extension based on tespeed. So I can test my connection by trigger tespeed with Alfred. I already forked tespeed and try to have a look the next few days.