Prerequisites
Ensure you have all build requirements installed:- Python 3 with Meson
- Ninja
- Clang and LLD
- sqlite3
- libarchive
Building the CLI Tool
Set up the build directory
Use Meson to configure the build:This creates a
build/ directory with the build configuration.Creating an Alpine Filesystem
To run the iSH CLI tool, you need an Alpine Linux root filesystem:Download Alpine minirootfs
Download the Alpine minirootfs tarball for i386 from the Alpine downloads page.
Run fakefsify
Use the This creates an
fakefsify tool to create a filesystem from the tarball:alpine/ directory with the extracted filesystem.If
tools/fakefsify doesn’t exist, libarchive wasn’t found during build configuration. See build requirements for installation instructions.Running iSH
Once you have a filesystem set up, run iSH:Command-Line Options
-f <filesystem_dir>: Path to the root filesystem directory<command>: Command to execute (e.g.,/bin/sh,/bin/ls)[args...]: Arguments to pass to the command
Example Usage
Build Configuration Options
You can customize the build with Meson options:Configure After Initial Build
Common Options
Enable logging channels:strace: Log system callsinstr: Log every instruction (very slow)verbose: General debug output
x86 (default), x86_64
Change emulation engine:
asbestos (default), unicorn
Change kernel mode:
ish (default), linux
View Current Configuration
Debugging with ptraceomatic
ptraceomatic only works on 64-bit Linux 4.11 or later.
ptraceomatic tool runs programs in a real process and single-steps through execution, comparing registers at each step. This is extremely useful for debugging emulation issues.
Building ptraceomatic
On compatible Linux systems, ptraceomatic is built automatically:Using ptraceomatic
Replaceish with tools/ptraceomatic:
Development Workflow
Making Changes
- Edit source code
- Rebuild:
- Test your changes:
Incremental Builds
Ninja automatically detects which files changed and only rebuilds what’s necessary:Clean Build
To rebuild everything:Additional Tools
fakefsify and unfakefsify
fakefsify: Converts a tarball to a fake filesystem:unicornomatic
If Unicorn library is available, theunicornomatic tool is built for testing with the Unicorn engine:
Troubleshooting
Build Failures
Problem: Meson configuration fails. Solution:- Check that all dependencies are installed
- Verify Clang and LLD are in your PATH:
- Check Python 3 and Meson versions:
Missing fakefsify
Problem:tools/fakefsify doesn’t exist after building.
Solution:
Install libarchive:
macOS:
Runtime Errors
Problem: “No such file or directory” when running./ish.
Solution:
- Ensure you’re in the
build/directory - Check that the filesystem path is correct:
- Verify the command exists in the filesystem:
Linking Errors
Problem: Undefined symbols during linking. Solution:- Ensure sqlite3 is installed:
- Check that all submodules are initialized:
- Try a clean rebuild:
ptraceomatic Not Available
Problem:tools/ptraceomatic not built.
Explanation: ptraceomatic is only built on 64-bit Linux systems with kernel 4.11 or later. It requires:
host_machine.system() == 'linux'host_machine.cpu() == 'x86_64'- Linux kernel 4.11+
Performance Tips
Faster Builds
- Use ninja’s parallel compilation (automatic by default)
- Use incremental builds instead of clean rebuilds
- Build with release optimizations:
Faster Runtime
- Use the default
asbestosengine (3-5x faster than alternatives) - Avoid enabling
instrlogging (very slow) - Use 32-bit guest architecture unless you need 64-bit
Next Steps
- Build for iOS - Build the full iOS app
- Learn about debugging - Debug iSH effectively
- Explore the codebase - Understand the architecture