Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Pi Agent Cross-Platform Deployment

Pi Agent Cross-Platform Deployment

Pi Agent supports running on Windows, macOS, Linux, and Android (Termux).

This chapter covers the configuration points for each platform.


macOS configuration

macOS is a first-class supported platform for Pi Agent; most features work out of the box.

Recommended terminals

Terminal Installation method Reasons to recommend
iTerm2 brew install --cask iterm2 Native True Color support, good image display, rich features
Kitty brew install --cask kitty GPU-accelerated rendering, fast
Warp brew install --cask warp Modern terminal with integrated AI features

Verify True Color support



$ echo $COLORTERM

truecolor

Shell aliases

When Pi Agent runs bash in non-interactive mode (i.e. bash -c), it doesn't automatically expand your Shell aliases by default.

Core mechanism: making Pi recognize Shell aliases. To use custom aliases in Pi, write the following configuration into ~/.pi/agent/settings.json (or ~/.atomic/agent/settings.json) so it actively loads your Shell config file (such as ~/.zshrc or ~/.bashrc) at startup:

{

  "shellCommandPrefix": "shopt -s expand_aliases\neval \"$(grep '^alias ' ~/.zshrc)\""

}

**Note:** Change the path ~/.zshrc to the actual path of the Shell config file you use.


Windows configuration

On Windows, you can run Pi Agent via the native terminal or WSL2; the key is choosing the right terminal and handling keybinding conflicts.

Recommended installation method

On Windows, it's recommended to use Windows Terminal with WSL2 or use Node.js directly.

Install Git for Windows

On Windows, Pi uses Git Bash by default to execute commands.

At startup it searches in order, including the default path C:\\Program Files\\Git\\bin\\bash.exe.

If Git for Windows isn't installed, startup won't find bash; simply installing Git for Windows solves it.

If you don't want to use Git Bash, you can specify another bash via the shellPath configuration, or switch to the Power Shell tool via defaultTools.

Install Node.js

From the nodejs.org Download the installer, or use winget:



# PowerShell

> winget install OpenJS.NodeJS.LTS

Install Pi Agent

Execute in Power Shell or CMD in Windows Terminal:



# PowerShell

> npm install -g --ignore-scripts @earendil-works/pi-coding-agent

Windows-specific keybindings

Function Windows keybinding macOS/Linux keybinding
Paste images Alt+V Ctrl+V
Multi-line input Ctrl+Enter Shift+Enter
Send a follow-up message Ctrl+Q (send), Alt+Q (recall) Alt+Enter

Windows uses Ctrl+Q by default to send follow-up messages and Alt+Q to recall queued messages, no remapping needed.

Configuration is only needed if you want to switch to Alt+Enter.

In Windows Terminal, Alt+Enter is by default the fullscreen keybinding.

To let Pi Agent receive this keybinding, you need to remove or remap the fullscreen keybinding in Windows Terminal settings.

Search for "toggleFullscreen" in settings and change its keybinding to another combination.

Then bind pi's app.message.followUp to alt+enter.

Suspend behavior

The native Windows terminal doesn't support Unix job control.

On native Windows, Ctrl+Z is bound to edit undo; you need to bind a keybinding for suspend yourself.

Under WSL, use Alt+Z to suspend; Ctrl+Z can still suspend a process, and with fg you can resume it normally.


Termux (Android) configuration

Pi Agent can run on Android devices via Termux.

Installation Steps

First install Termux itself; get the latest installer from F-Droid, then run the following commands in Termux.

Example

1. Update packages and install Node.js and the termux-api command-line tools

pkg update

&&

pkg upgrade

pkg

install

nodejs termux-api

2. Install Pi Agent

npm

install

-g

--ignore-scripts

@

earendil-works

/

pi-coding-agent

3. Verify the installation

pi

--version

4. Before first using shared storage, run this once to grant access to paths such as the Downloads directory

termux-setup-storage

Besides Termux itself, you also need to install the Termux:API app on your phone.

This app can also be obtained from F-Droid; device integration capabilities such as the clipboard depend on it.

Installing only the termux-api command-line package without the Termux:API app won't make the related commands work.

Notes

The Termux environment differs from regular Linux; note the following points.

Projects Description
Storage paths Termux's storage access paths differ from regular Linux; use ~/storage/shared/ to access shared storage, and run termux-setup-storage before first use
Image display Image display may be limited in some terminals
Clipboard Termux clipboard integration only supports text; image pasting is unavailable
Input experience A Bluetooth or OTG keyboard is recommended for a better editing experience

tmux integration

Pi Agent works normally in tmux sessions.

Advantage

Put Pi Agent in tmux mainly for persistence and multi-window capabilities.

Advantage Description
Session persistence Pi Agent keeps running in the background even if SSH disconnects
Multi-window layout One window runs Pi Agent while another views code
Remote development Use Pi Agent after SSHing into a server

Recommended configuration

Add the following to ~/.tmux.conf:

Example

File path: ~/.tmux.conf

Ensure True Color support

set

-g

default-terminal

"tmux-256color"

set

-ag

terminal-overrides

",*:Tc"

Enable extended key reporting and forward key combinations in CSI-u format

Without these two lines, Shift+Enter in tmux degrades to a plain Enter

set

-g

extended-keys on

set

-g

extended-keys-format csi-u

Increase the scrollback buffer (useful when viewing large amounts of AI output)

set

-g

history-limit

50000

The two extended-keys lines are the key configuration; they let combinations such as Shift+Enter and Ctrl+Enter pass into pi correctly.

extended-keys-format csi-u requires tmux 3.5 or newer; you can check the version with tmux -V.



$ tmux -V

tmux 3.5a

Without these two lines, Shift+Enter in tmux degrades to a plain Enter and multiline input sends the message immediately.

If your tmux version is between 3.2 and 3.4, omit the csi-u line; pi still supports tmux's default xterm format.


Terminal settings optimization

Regardless of the terminal you use, the following settings directly affect Pi Agent's display.

Setting Suggested value Description
True Color Enabling Ensure the terminal supports 24-bit color
Font Monospaced font (such as JetBrains Mono, Fira Code) Ensure proper code alignment and special character display
Scrollback buffer At least 10000 lines View large amounts of AI output and history messages
VS Code terminal Set minimumContrastRatio to 1 Ensure theme colors render accurately

VS Code integrated terminal configuration

Add the following configuration to VS Code's settings.json, at path ~/Library/Application Support/Code/User/settings.json (macOS):

Example

{

  "terminal.integrated.minimumContrastRatio": 1,

  "terminal.integrated.fontFamily": "JetBrains Mono",

  "terminal.integrated.fontSize": 13

}


Shell alias suggestions

Here's a complete set of Pi Agent aliases, common to all platforms, which you can add to ~/.zshrc, ~/.bashrc, or an equivalent shell config file:

Example

File path: ~/.zshrc (~/.bashrc for bash users)

Common Pi Agent aliases

alias

pin

=

'pi --name'

         

Launch a named session

alias

pic

=

'pi -c'

             

Resume the most recent session

alias

pir

=

'pi -r'

             

Resume a history session

alias

piq

=

'pi -p'

             

Quick one-off Q&A

alias

pip

=

'pi --print'

         

Print mode (same as -p)

alias

pif

=

'pi --fork'

         

Fork session

alias

pii

=

'pi --no-session'

   

Ephemeral mode (no saving)

alias

piro

=

'pi --tools read,grep,find,ls'

 

Read-only mode

alias

pirev

=

'pi -p "Review staged code changes (git diff --cached)"'

If you use the fish shell, change alias to abbr or use fish's alias syntax.



# fish shell using abbr to define aliases

abbr -a pic pi -c