Skip to main content

Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.

Project description

MacNotesApp

All Contributors

Work with Apple MacOS Notes.app from the command line. Also includes python interface for scripting Notes.app from your own python code.

Installation

Installation

The recommended way to install macnotesapp is via the uv python package manager tool.

Installation using uv

  • Open Terminal (search for Terminal in Spotlight or look in Applications/Utilities)
  • Install uv by running the following command in Terminal:
curl -LsSf https://astral.sh/uv/install.sh | sh

If you previously installed uv, upgrade to the latest version:

uv self update
  • Type the following into Terminal:
uv tool install --python 3.13 macnotesapp
  • Now you should be able to run macnotesapp by typing: macnotesapp

Once you've installed macnotesapp with uv, to upgrade to the latest version:

uv tool upgrade macnotesapp

If you want to try macnotesapp without installing it, you can run uv tool run --python 3.13 macnotesapp or uvx --python 3.13 macnotesapp.

Note: If installing on an older version of macOS and you encounter issues installing with uv, try installing python 3.13 from python.org then running uv to install macnotesapp.

Note: Currently tested on MacOS 10.15.7/Catalina and 13.1/Ventura.

Install with homebrew

Once you have installed homebrew, you can install the CLI in the terminal with:

brew tap RhetTbull/macnotesapp https://github.com/RhetTbull/macnotesapp
brew update
brew install macnotesapp
  • Now you should be able to run notes by typing: notes

Note: This only works for Apple Silicon (M1, etc.) Macs. If you are using an Intel Mac, use the uv instructions above.

Documentation

Full documentation available at https://RhetTbull.github.io/macnotesapp/

Command Line Usage

Usage: notes [OPTIONS] COMMAND [ARGS]...

  notes: work with Apple Notes on the command line.

Options:
  -v, --version  Show the version and exit.
  -h, --help     Show this message and exit.

Commands:
  accounts  Print information about Notes accounts.
  add       Add new note.
  cat       Print one or more notes to STDOUT
  config    Configure default settings for account, editor, etc.
  delete    Delete a note.
  dump      Dump all notes or selection of notes for debugging
  edit      Edit an existing note's body.
  help      Print help; for help on commands: help <command>.
  list      List notes, optionally filtering by account or text.
  mkdir     Create a new folder.
  move      Move a note to a different folder.
  rename    Rename a note.
  rmdir     Delete a folder.

Use notes help COMMAND to get help on a specific command. For example, notes help add:

Usage: notes add [OPTIONS] NOTE

  Add new note.

  There are multiple ways to add a new note:

  Add a new note from standard input (STDIN):

  notes add

  cat file.txt | notes add

  notes add < file.txt

  Add a new note by passing string on command line:

  notes add NOTE

  Add a new note by opening default editor (defined in $EDITOR or via `notes
  config`):

  notes add --edit

  notes add -e

  Add a new note from URL (downloads URL, creates a cleaned readable version
  to store in new Note):

  notes add --url URL

  notes add -u URL

  If NOTE is a single line, adds new note with name NOTE and no body. If NOTE is
  more than one line, adds new note where name is first line of NOTE and body is
  remainder.

  Body of note must be plain text unless --html/-h or --markdown/-m
  flag is set in which case body should be HTML or Markdown, respectively. If
  --edit/-e flag is set, note will be opened in default editor before
  being added. If --show/-s flag is set, note will be shown in Notes.app
  after being added.

  Account and top level folder may be specified with --account/-a and
  --folder/-f, respectively. If not provided, default account and folder
  are used.

Options:
  -s, --show             Show note in Notes after adding.
  -F, --file FILENAME
  -u, --url URL
  -h, --html             Use HTML for body of note.
  -m, --markdown         Use Markdown for body of note.
  -p, --plaintext        Use plaintext for body of note (default unless changed
                         in `notes config`).
  -e, --edit             Edit note text before adding in default editor.
  -a, --account ACCOUNT  Add note to account ACCOUNT.
  -f, --folder FOLDER    Add note to folder FOLDER.
  --help                 Show this message and exit.

Python Usage

"""Example code for working with macnotesapp"""

from macnotesapp import NotesApp

# NotesApp() provides interface to Notes.app
notesapp = NotesApp()

# Get list of notes (Note objects for each note)
notes = notesapp.notes()
note = notes[0]
print(
    note.id,
    note.account,
    note.folder,
    note.name,
    note.body,
    note.plaintext,
    note.password_protected,
)

print(note.asdict())

# Get list of notes for one or more specific accounts
notes = notesapp.notes(accounts=["iCloud"])

# Create a new note in default folder of default account
new_note = notesapp.make_note(
    name="New Note", body="This is a new note created with #macnotesapp"
)

# Create a new note in a specific folder of a specific account
account = notesapp.account("iCloud")
account.make_note(
    "My New Note", "This is a new note created with #macnotesapp", folder="Notes"
)

# If working with many notes, it is far more efficient to use the NotesList object
# Find all notes with "#macnotesapp" in the body
noteslist = notesapp.noteslist(body=["#macnotesapp"])

print(f"There are {len(noteslist)} notes with #macnotesapp in the body")

# List of names of notes in noteslist
note_names = noteslist.name
print(note_names)

See Also

  • apple-notes-parser: Reads data directly from the Apple Notes database. Read-only but is faster than using the AppleScript API. Supports tags and folders.
  • mcp-apple-notes-py: MCP server that uses macnotesapp and apple-notes-parser; provides LLMs access to your notes.

Known Issues and Limitations

  • Password protected notes are not supported; unlocked password-protected notes can be accessed but locked notes cannot
  • Notes containing tags (#tagname) can be read but the tags will be stripped from the body of the note
  • Tags cannot be added to notes and will show up as plaintext if added manually with macnotesapp
  • Currently, only notes in top-level folders are accessible to macnotesapp (#4)
  • Attachments are not currently handled and will be ignored (#15)
  • The title style is not correctly set (#13)

Contributors ✨

Thanks goes to these wonderful people (emoji key):

chadmando
chadmando

📓
JonathanDoughty
JonathanDoughty

🐛
Brian McCallister
Brian McCallister

💻
Andrew Furman
Andrew Furman

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

macnotesapp-0.8.2.tar.gz (89.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

macnotesapp-0.8.2-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file macnotesapp-0.8.2.tar.gz.

File metadata

  • Download URL: macnotesapp-0.8.2.tar.gz
  • Upload date:
  • Size: 89.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for macnotesapp-0.8.2.tar.gz
Algorithm Hash digest
SHA256 5099f4e32360e59f6034490f3551ec039b9e318cf494413b89c793226237edb1
MD5 44f9feeaa5815115b9a44b26a56191c9
BLAKE2b-256 c1ca37cbcf66a8b6533611c1e178f42f38e0983769ea02968264048bf98b17a1

See more details on using hashes here.

File details

Details for the file macnotesapp-0.8.2-py3-none-any.whl.

File metadata

File hashes

Hashes for macnotesapp-0.8.2-py3-none-any.whl
Algorithm Hash digest
SHA256 875aa89b333c546a49b0686a5bd84797b97fb87ee7a362e2dd1fac2f999a408c
MD5 06e5632d1f2523238d27532c15745a2e
BLAKE2b-256 02a2e89e03627880b551335af8276493999f3cdb9804d21cb11a70bb586f5398

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page