LogoLogo
  • Pear by Holepunch
  • Pear runtime
    • Command-Line-Interface (CLI)
    • Application-Programming-Interface (API)
    • Application Configuration
    • Troubleshooting Applications
    • Frequently Asked Questions
  • Bare reference
    • Overview
    • Application-Programming-Interface (API)
    • Node.js Compatibility with Bare
    • Bare Modules
    • Troubleshooting with Bare
  • Guides
    • Getting Started
    • Starting a Pear Desktop Project
    • Making a Pear Desktop Application
    • Starting a Pear Terminal Project
    • Making a Pear Terminal Application
    • Sharing a Pear Application
    • Marking a Release
    • Making a Bare Mobile Application
    • Debugging a Pear Terminal Application
    • Creating a Pear Init Template
    • Best Practices
  • Building blocks
    • Hypercore
    • Hyperbee
    • Hyperdrive
    • Autobase
    • HyperDHT
    • Hyperswarm
  • How-tos
    • Connect two peers
    • Connect many peers
    • Replicate & persist
    • Manage multiple Hypercores
    • Share append-only databases
    • Create a p2p filesystem
  • Helpers
    • Corestore
    • Localdrive
    • Mirrordrive
    • Secretstream
    • Compact encoding
    • Protomux
  • Tools
    • Hypershell
    • Hypertele
    • Hyperbeam
    • Hyperssh
    • Drives
  • Apps
    • Keet
  • Examples
    • Bare on Mobile
    • React App using Pear
Powered by GitBook

Copyright © 2024 - 2025 Holepunch, S.A. de C.V. All rights reserved.

On this page
  • Step 1. Install pear-inspect
  • Step 2. Add Code
  • Step 3. Run In Dev Mode
  • Step 4. Add to Pear Runtime Desktop
  • Step 5. Open in Chrome
  1. Guides

Debugging a Pear Terminal Application

Last updated 4 months ago

Debugging Pear Terminal Applications is different than debugging Desktop Applications because they do not come with a UI. Instead a few steps are needed.

Use together with the Pear Runtime Desktop and use any tool that supports DevTools like Chrome.

Step 1. Install pear-inspect

First install pear-inspect:

npm install pear-inspect

Step 2. Add Code

This code should run as the first thing in the application:

if (Pear.config.dev) {
  const { Inspector } = await import('pear-inspect')
  const inspector = await new Inspector()
  const key = await inspector.enable()
  console.log(`Debug with pear://runtime/devtools/${key.toString('hex')}`)
}

Step 3. Run In Dev Mode

As the code specifies, pear-inspect is only running when in dev mode, so start the app:

pear run --dev .

The application will output something similar to:

Debug with pear://runtime/devtools/a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2

Step 4. Add to Pear Runtime Desktop

Open the Pear Runtime Desktop app by running pear run pear://runtime. Then go to Developer Tooling and paste in the key.

Note that the key can also be sent to someone else and they can debug the app remotely.

Step 5. Open in Chrome

Click on Open in Chrome or copy the link into a tool that support DevTools.

Pear Inspect