Prerequisites
Before you begin, make sure you have:- Installed twitter-cli (see Installation)
- A Twitter/X account
- Logged into x.com in one of these browsers: Chrome, Firefox, Edge, or Brave
Authentication Setup
twitter-cli uses browser cookies for authentication. There are two methods:- Environment Variables
Your First Command
Letβs fetch your home timeline (βFor Youβ feed):By default, twitter-cli fetches 50 tweets. You can customize this with the
--max flag.Expected Output
You should see a formatted table of tweets:Essential Commands
Now that youβre authenticated, try these common operations:Fetch Following Feed
Fetch Following Feed
View tweets from accounts you follow (chronological order):
View Your Bookmarks
View Your Bookmarks
See your saved/bookmarked tweets:
Search Tweets
Search Tweets
Search for tweets by keyword:Search with filters:Available filters:
Top, Latest, Photos, VideosView User Profile
View User Profile
Look up any userβs profile:View their tweets:
Post a Tweet
Post a Tweet
Create a new tweet:Reply to a tweet:
Export Data as JSON
All read commands support JSON output for scripting and automation:Advanced: Filtering Tweets
Filter tweets by engagement score:- Likes (weight: 1.0)
- Retweets (weight: 3.0)
- Replies (weight: 2.0)
- Bookmarks (weight: 5.0)
- Views (logarithmic, weight: 0.5)
config.yaml (see Configuration).
Common Authentication Issues
No Twitter cookies found
No Twitter cookies found
Cookie expired or invalid (HTTP 401/403)
Cookie expired or invalid (HTTP 401/403)
Twitter API error 404
Twitter API error 404
Error:
Twitter API error 404This happens when Twitter rotates their GraphQL query IDs.Solution: Simply retry the command. twitter-cli includes fallback logic to fetch fresh query IDs.Browser access denied (macOS)
Browser access denied (macOS)
Error: Cookie extraction fails on macOSSolution:
- Grant Terminal/your terminal app access to Chrome in System Settings
- Go to System Settings β Privacy & Security β Full Disk Access
- Add your terminal application
Setting Up a Proxy (Optional)
For privacy or to avoid rate limiting, route requests through a proxy:Quick Reference
Here are the most common commands:Next Steps
Command Reference
Explore all available commands and options
Configuration
Customize behavior with config.yaml
Best Practices
Learn how to avoid bans and rate limits
JSON Export
Export data for scripting and automation
