How to use Twitter via CLI (Command Line Interface) on macOS

27 Sep 2022

I'm thinking about sharing more on Twitter. Always be relunctant, but some of my notes might be of interest to some, and tweeting about them might bring some visibility.

It has to be as seamless as possible in my workflows, if I aim to get the hang of it.

Tweeting via CLI would be the easiest, as I always have a terminal window open - or can automate from it.

T | A command-line power tool for Twitter

  • not sure if working on macOS. Need to find brew for it.

twitter-cli/brew-twitter.jpg

๐Ÿค”

Official project:

Last update on 13 Feb '20.

Getting started

Confirmed that Ruby is installed on my system with ruby -v.

gem install t

A Twitter API access and "App" created on Twitter are necessary.

I have already access for Twittee Twittee but my app is for https://btobsales.eu/ - need to create a new one.

Getting error:

Enter your API key: xxxxxxxx
Enter your API secret: xxxxxxxx
/Library/Ruby/Gems/2.6.0/gems/t-3.1.0/lib/t/cli.rb:82:in `authorize': uninitialized constant Twitter::REST::Client::BASE_URL (NameError)
    from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /Library/Ruby/Gems/2.6.0/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    from /Library/Ruby/Gems/2.6.0/gems/t-3.1.0/bin/t:20:in `<top (required)>'
    from /usr/local/bin/t:23:in `load'
    from /usr/local/bin/t:23:in `<main>'
xxxxxxxx@xxxxxxxx ~ % 

Seems it's a known one, with no resolution: ๐Ÿ˜•

Own solution?

Else I might first write my note for Twittee Twittee to refresh my memory on Twitter's API, and build something myself.

Easiest workflow I can think of:

  • write anywhere and copy content
  • Alfred workflow with keyword ct (Clipee Tweet) tweets content of clipboard

Danger to tweet something wrong ๐Ÿ˜…๐Ÿ˜‚

Perhaps opening tweet after posting for double-check, and deleting tweet if mistake, is a fine workaround.

Moving to note:

Clipee

links

social