Skip to content

Backups Export and Import

jayjay181818 edited this page Nov 17, 2026 · 1 revision

Backups, Export and Import

Stockbar has three ways to protect and move your data. They do different jobs:

What For Includes Where
Daily backups Undoing a mistake, recovering holdings Your holdings Backups screen, Settings → Advanced → Backups
Export & Import Moving to another Mac, keeping a full copy Settings and API keys, optionally your portfolio database Settings → Advanced → Export & Import
Backup scripts Recovery from outside the app Defaults, database, settings file, cache Scripts/ in the repository

Keychain credentials are not included in daily backups or the scripts. Only an export holds your keys (see below).

Daily backups

Stockbar makes one automatic backup per day while it is running. The files are plain JSON listing your holdings, so store them privately. They are in ~/Library/Application Support/Stockbar/Backups/ and named portfolio_backup_*.json.

The Backups screen shows Last Backup, Saved Backups and Kept For, with:

  • Back Up Now: makes a backup immediately.
  • Restore from Backup…: see below.
  • View Backups: opens the backup folder in Finder.
  • Keep Backups For: 7, 14, 30 (the default) or 90 days. Whatever the setting, the newest five backups are always kept.

The same controls are in Settings → Advanced → Backups. Make a backup before large portfolio changes, before linking Trading 212, and before upgrading from 2.x.

Restoring

  1. Choose Restore from Backup…. The sheet lists your backups.
  2. Choose Preview on one to see what it holds: the stocks, their units and average cost, and a count.
  3. Choose Restore and confirm. This replaces your current portfolio with the backup. A copy of the current portfolio is saved first, so you can restore that one if you change your mind.

Restoring is safer in 3.x than before: backups are Folync-aware and keep more fields, and older backups still restore.

Export and Import

Use this to move Stockbar to another Mac, or to keep a full copy that includes your keys.

Exporting

  1. Go to Settings → Advanced → Export & Import and choose Export….
  2. Choose what to Include:
    • Settings & Keys: your preferences plus the FMP, Twelve Data, Trading 212 and Folync keys.
    • Everything: those, plus your portfolio database. Its estimated size is shown first.
  3. Choose a password of at least 8 characters, then Export… and pick a place to save the .stockbarexport file.

The file is encrypted with AES-256-GCM under your password. It contains your API keys, so keep both the file and the password safe.

The Python environment, the interpreter path, window positions and caches are not exported. Set up Stockbar's Python again on the new Mac when asked.

Importing

  1. On the new Mac, choose Import… and pick the file.
  2. Enter the password and choose Continue.
  3. Stockbar checks the whole file first and shows This File Contains: the settings, the keys, and the portfolio database if it is included.
  4. Choose Import…, then Import and Replace to confirm.

What happens next:

  • Keys that are not in the file stay as they are.
  • Stockbar backs up your portfolio before replacing it, and rolls back on any failure.
  • It offers to relaunch afterwards; the live database stays read-only until Stockbar has relaunched.

Backup and restore scripts

For recovery from outside the app, two scripts keep the files that hold your preferences and history. See the scripts README for the full text.

  • Quit Stockbar first. The scripts refuse to run while it is running, so the database and its -wal/-shm files are copied as one consistent set. They never stop the app for you.
  • bash Scripts/backup_stockbar_data.sh writes stockbar_complete_backup_YYYY-MM-DD_HHMMSS under ~/Library/Application Support/Stockbar/Backups/. A backup may hold UserDefaults.plist, StockbarDataModel.sqlite (with its sidecar files), .stockbar_config.json, the quote cache and a MANIFEST.txt.
  • bash Scripts/restore_stockbar_data.sh <backup folder name> asks for an explicit yes, first saves your current data to a StockbarDataModel_pre_restore_* directory (and aborts if it cannot), then restores.
  • Existing backups are never deleted automatically.
  • Keychain items are not covered by either script, so credentials must be handled separately.

Related

Clone this wiki locally