How to Twitter from Terminal on the Mac

By 6 de mayo de 2008 Hakintosh 3 Comments

Copy&paste.....

How to Twitter from Terminal on the Mac
The Mac’s Terminal is the UNIX command line. It’s hard core, the stuff that Apple actually tries to keep away from the casual user. It’s the direct line to the heart of the machine, and it’s where cool scripting action can occur. Here’s how to set it up so that with a couple of key strokes, you can send a Twitter absurdly fast. You’ll need to have curl compiled and installed on your Mac as a prerequisite.

1. Copy this script to a text file named twit.sh:

#!/bin/bash
curl -u twitterusername:twitterpassword -d status="$1" http://twitter.com/statuses/update.xml

Obviously, substitute twitterusername and twitterpassword for your credentials.

2. Open Terminal and sudo chmod this file to 777.

3. Copy it to your home directory or put the location in your path.

4. Next, open up your bashrc file, which on the Mac is located at /etc/bashrc - note that you’ll have to either chmod it (bad) or sudo pico / sudo nano it to save your changes.

5. Set up an alias for the twitter script:

alias tw="/Users/yourmacusername/twit.sh"

6. Close and quit Terminal, then relaunch it. If you plan on using this a lot, you’ll probably want to put Terminal in your Dock, if it’s not there already.

7. Pop open terminal and type:

tw “Testing twitter from the command line!”

8. Check your twitter page to ensure your Tweet posted.

3 Comments

Leave a Reply

Your email address will not be published.