claudevm
v0.0.2
Published
A command-line tool for macOS that opens the current directory in a virtual machine with copy-on-write file access.
Downloads
4
Readme
ClaudeVM [doesnt work yet]
A command-line tool for macOS that opens the current directory in a virtual machine with copy-on-write file access.
Features
- Creates a lightweight macOS VM using Apple's Virtualization framework
- Mounts the current directory with copy-on-write access
- Changes to files in the VM don't affect the host system
- Provides access to host system programs while keeping files isolated
- Manages VM lifecycle (start, stop, installation)
- Supports automatic macOS installation from Apple's restore images
What Is ClaudeVM?
ClaudeVM is a developer tool that creates a safe sandbox environment on macOS by:
- Opening a directory in a macOS virtual machine
- Setting up copy-on-write file access so changes in the VM don't affect the host
- Allowing you to use host system programs while keeping files isolated
- Providing a lightweight solution that shares resources with the host
This gives developers a safe environment to experiment with code, test potentially risky operations, or isolate development work.
Requirements
- macOS 13 or later
- Apple Silicon Mac
- Swift 5.8 or later
Installation
# Clone the repository
git clone https://github.com/yourusername/claudevm.git
cd claudevm
# The script will build automatically on first run
chmod +x claudevm
# Run the tool
./claudevmUsage
# Open current directory in VM
./claudevm
# Open specific directory in VM
./claudevm /path/to/directory
# Configure VM resources
./claudevm --memory 8 --cpu-count 4
# Install macOS in the VM (requires sudo)
sudo ./claudevm --install
# Force recreation of VM resources
./claudevm --force
# Show verbose output
./claudevm --verboseAccessing Shared Directory in VM
Once the VM is running, you can access the shared directory by:
- Opening Terminal in the VM
- Creating a mount point:
mkdir -p ~/shared - Mounting the shared directory:
mount -t virtiofs claudevm-shared ~/shared - Your shared directory is now available at
~/shared
All changes made to files in this directory inside the VM will not affect the original files on your host system.
How It Works
ClaudeVM uses Apple's Virtualization framework to:
- Create a macOS virtual machine with the same version as your host
- Set up directory sharing with VirtioFS for efficient file access
- Configure the shared directory with copy-on-write functionality
- Manage the VM lifecycle including installation and graceful shutdown
- Provide console and graphical access to the VM
Technical Implementation
The tool leverages several key technologies:
VZVirtualMachinefor VM creation and managementVZVirtioFileSystemDeviceConfigurationfor directory sharingVZMacOSRestoreImagefor macOS installationVZSharedDirectorywith read-write access for copy-on-write functionality- Swift Argument Parser for command-line interface
- Signal handling for graceful VM shutdown
Contributing
Contributions are welcome! To contribute:
- Fork the repository
- Make your changes
- Submit a pull request
License
MIT
