nostr cli

A human and bot-friendly command-line interface for the Nostr protocol. Post notes, send encrypted DMs, manage profiles — all from your terminal.

$ brew install xdamman/tap/nostr

Examples

Login
$ nostr login
 
How would you like to log in?
 
> Import existing nsec
Generate new keypair
 
Enter your nsec: nsec1•••••••••••••
 
✓ Logged in as npub1xsp...uvds
Keys stored in ~/.nostr/profiles/npub1xsp.../
Post a public note
$ nostr post "Hello Nostr!"
 
Posting as xavier to 5 relays
 
Signer: npub1xdm...a8f2
Event ID: a1b2c3d4e5f6...
 
relay.damus.io 142ms
nos.lol 89ms
relay.nostr.band 203ms
eden.nostr.land 2001ms
relay.snort.social 312ms
 
✓ Published to 4/5 relays
Saved locally in ~/.nostr/profiles/npub1xdm.../events.jsonl
Pipe content to Nostr
$ echo "Hello from the command line" | nostr
 
Posting as xavier to 5 relays
 
relay.damus.io 128ms
nos.lol 102ms
relay.nostr.band 187ms
eden.nostr.land 245ms
relay.snort.social 156ms
 
✓ Published to 5/5 relays
Send an encrypted DM
$ nostr dm xavier "See you at the meetup"
✓ DM sent to xavier
 
$ echo "Here's that link" | nostr dm xavier
✓ DM sent to xavier
Interactive mode — public feed
$ nostr
xavier following 42 7/7 relays
 
23/03 10:15 fiatjaf working on a new relay implementation
23/03 10:18 jb55 zaps are underrated for micropayments
23/03 10:22 odell "fix the money, fix the world"
23/03 10:30 gigi nostr is the social layer bitcoin needed
 
xavier> this is amazing!
✓ Published to 7/7 relays
Interactive mode — DM conversation
$ nostr dm xavier
Chatting with xavier
 
23/03 14:01 xavier Hey, are you coming to the meetup?
23/03 14:05 me Yes! See you there
 
me> Can't wait!
✓ Sent!

Why nostr cli?

Multi-profile

Switch between identities like git branches. Each profile has its own keys, relays, and aliases.

Human-friendly

Use aliases and NIP-05 usernames instead of raw npubs. nostr dm xavier just works.

Unix-native

Pipes, scripts, cron jobs. echo "hello" | nostr — compose with any tool.

Encrypted DMs

NIP-04 / NIP-44 encrypted direct messages with interactive chat mode.

Interactive shell

Live feed, posting, and slash commands. Like a tiny Nostr client in your terminal.

Built-in NIP viewer

nostr nip 01 fetches and renders any NIP specification right in your terminal.

Commands

Social
nostr post [message]Post a text note (interactive if no message given)
nostr dm [profile] [message]Send an encrypted DM or start interactive chat
nostr follow [profile]Follow a user
nostr [profile]View a user's profile and latest notes
nostr [profile] --watchLive-stream a user's new notes
Profile
nostr loginCreate a new profile or import an existing nsec
nostr switch [profile]Switch between profiles
nostr profileShow your current profile
nostr profile updateInteractively update your profile metadata
nostr profilesList all local profiles
Infrastructure
nostr relaysManage relays (add, remove, check status)
nostr alias [name] [npub|nip05]Create an alias for quick access
Reference
nostr nip [number]View a NIP specification in the terminal
nostr versionPrint version info
nostr updateCheck for updates and self-update

A <profile> can be an alias, npub, or NIP-05 address (e.g. user@domain.com). Append --json to most commands for machine-readable output.