· how to software social media

Using Twitter from the Command Line

(In a similar vein to some “Yours Truly, Johnny Dollar” episodes, this post could have a few alternate titles: “How to Install oysttyer on Mac.” Or “oysttyer Means Pearls of Wisdom for Twitter.” Or “Forget Commando, Let’s Go Command Line!”)

If you’re a geek, you love the command line. But that doesn’t mean you can’t also use Twitter.

Up until recently, the standard Twitter client for command line access has been TTYtter from Floodgap Software. Unfortunately, development was infrequent the past few years and has now officially stopped.

But oysttyer picked up where TTYtter left off: many of the commands are the same.

I used TTYtter occasionally on my Mac and needed to re-install after upgrading to the latest OS, so I took the opportunity to move to oysttyer.

Screenshot showing oysttyer

This screenshot is an example of what oysttyer looks like. Different types of Twitter messages (follows, mentions, direct messages, etc.) can appear in different colours but there are none in this case.

Installing oysttyer

A command line Twitter client is not for everyone but if you’re interested, here are the steps to install it on Mac or Linux:

  1. Download and extract oysttyer. I used the master branch but you could probably use any of the other GitHub tags if you want a more stable/tested version.
  2. Put the script in the /opt/local/bin directory. This is just a location that should not interfere with anything else and follows Unix standards.
  3. Run sudo chmod 755 /opt/local/bin/oysttyer.pl for proper permissions.
  4. Download and extract the Term::ReadLine::TTYtter Perl module.
  5. Install the Perl module: perl Makefile.PL, make, and sudo make install. The computer may have more than one copy of Perl installed (i.e. OS and MacPorts) so note where the module was installed.
  6. Generate a Twitter API key for your copy of oysttyer. From the user guide:

    • Log in to the Twitter Application Management page with your Twitter user name and password.
    • Click Create New App.
    • Fill out the new app form:
      • Name – The globally unique name for your application. We suggest something like “oysttyer (YourCoolTwitterHandle)”
      • Description – Please use “An interactive console text-based command-line Twitter client written in Perl”
      • Website – Please use “http://oysttyer.github.io/”
      • Callback URL – (leave blank)
    • Check the box to agree to the developer agreement and click Create Your Twitter Application.
    • Update your application to be able to send and receive direct messages.
      • Click the Permissions tab.
      • Select Read, Write and Access direct messages.
      • Click Update application.
    • Get your keys.
      • Click the Key and Access Tokens tab.
      • Note the Consumer Key (API Key) and Consumer Secret (API Secret).
  7. Run the script using the Consumer Key and Secret you got: /opt/local/bin/oysttyer -oauthkey=KEY -oauthsecret=SECRET. (Replace KEY and SECRET with the info that was generated in step 6.)

  8. Follow the on-screen instructions to grant access to your Twitter account.

  9. Edit (or create) the configuration file: nano ~/.oysttyerrc. Add the following lines, again substituting your Consumer Key and Secret from step 6:

    • oauthkey=KEY
    • oauthsecret=SECRET
  10. Run oysttyer: /opt/local/bin/oysttyer.pl It should load up and display your Twitter timeline!

You can see a list of available commands in the oysttyer User Guide. Many (all?) commands for TTYtter also work in oysttyer.

For reference, my .oysttyerrc file also includes:

Each of these were carried over from TTYtter and are documented on the TTYtter Command Line Options page.

Thank You

Thanks to Cameron Kaiser at Floodgap Software for the original development of TTYtter, and the crew who took it over and continue building it as oysttyer!