- macOS 10.10 or later
- Python 3.7+ installed
- A USB drive (for testing/flashing)
-
Test if USB detection works:
python3 test_macos_usb.py
-
Manually test diskutil:
diskutil list
You should see a list of all disks including any USB drives.
# Run the main application
python3 main.py
# The system will automatically:
# - Detect your USB drive
# - Mount it if needed
# - Set up the wallet structure# Build and flash
sudo python3 flash_usb.py --build
# Or just flash an existing image
sudo python3 flash_usb.py- Main disk:
/dev/disk0(your Mac's internal drive - DO NOT FLASH THIS!) - USB drives:
/dev/disk2,/dev/disk3, etc. - Raw devices (faster):
/dev/rdisk2,/dev/rdisk3, etc. - Mount points:
/Volumes/VOLUME_NAME
# Before plugging in USB, run:
diskutil list
# Plug in your USB drive, then run again:
diskutil list
# The new disk that appears is your USB drive
# It will be labeled as (external, physical)diskutil unmount /Volumes/YOUR_USB_NAME
# or force unmount:
diskutil unmount force /Volumes/YOUR_USB_NAMEdiskutil mount /dev/disk2s1diskutil eject /dev/disk2# Format as FAT32 (Windows compatible)
diskutil eraseDisk FAT32 COLDSTAR MBR /dev/disk2
# Format as ExFAT (better for large files)
diskutil eraseDisk ExFAT COLDSTAR GPT /dev/disk2# Find what's using the disk:
lsof | grep /dev/disk2
# Force unmount:
diskutil unmount force /Volumes/YOUR_USB# Refresh disk list:
diskutil list
# Check system log:
log show --predicate 'eventMessage contains "disk"' --last 5m# For flashing operations, use sudo:
sudo python3 flash_usb.py
# For basic detection, no sudo needed:
python3 main.py-
Use raw disk device for faster writes:
- Instead of
/dev/disk2, use/dev/rdisk2 - The code does this automatically!
- Instead of
-
Larger block size:
- macOS dd uses lowercase:
bs=4m(notbs=4M) - The code handles this automatically!
- macOS dd uses lowercase:
-
Disable Spotlight on USB:
sudo mdutil -i off /Volumes/YOUR_USB
-
Verify the disk identifier:
diskutil info /dev/disk2
Check that it says "external" and shows the correct size
-
Double-check it's not your main drive:
/dev/disk0is usually your Mac's internal drive/dev/disk1might be a recovery partition- USB drives are typically
/dev/disk2or higher
-
Backup important data first!
- Flashing will ERASE ALL DATA on the drive
# 1. Test USB detection
$ python3 test_macos_usb.py
Current OS: Darwin
✓ Successfully imported USBManager
✓ Created USBManager instance
- System: Darwin
- is_macos: True
✓ Detection completed
Found 1 USB device(s)
# 2. View detected devices
Detected Devices:
Device 1:
Path: /dev/disk2
Size: 32.0 GB
Model: SanDisk USB
Mountpoint: /Volumes/COLDSTAR
# 3. Run the cold wallet system
$ python3 main.py
🔍 Detecting USB devices...
✓ Found 1 USB device(s)
✓ Selected device: /dev/disk2
✓ Using mounted volume: /Volumes/COLDSTAR
# Success!If you encounter issues:
- Run the test script with verbose output
- Check that diskutil is working:
diskutil list - Verify Python version:
python3 --version - Check system logs if drives aren't appearing
| Task | Linux | macOS |
|---|---|---|
| List disks | lsblk |
diskutil list |
| Disk info | fdisk -l |
diskutil info /dev/disk2 |
| Mount | mount /dev/sdb1 /mnt |
diskutil mount /dev/disk2s1 |
| Unmount | umount /mnt |
diskutil unmount /Volumes/USB |
| Eject | eject /dev/sdb |
diskutil eject /dev/disk2 |
| Format | mkfs.ext4 /dev/sdb1 |
diskutil eraseDisk |
| Block size | bs=4M |
bs=4m |
The Python code handles all these differences automatically! 🎉