Skip to main content

2 Portable | Arduino Ide

Since you cannot change global environment variables on a locked-down PC, create a batch file.

Open Notepad and paste the following (adjust drive letters as needed):

@echo off
set DRIVE=%~d0
set PORTABLE_ROOT=%DRIVE%\ArduinoPortableData

set APPDATA=%PORTABLE_ROOT%\config set USERPROFILE=%PORTABLE_ROOT% set ARDUINO15=%PORTABLE_ROOT%\Arduino15 set ARDUINO_SKETCHBOOK=%PORTABLE_ROOT%\Arduino

start "" "%DRIVE%\ArduinoIDE2\arduino-ide.exe"

Save this file as Launch_Portable_Arduino.bat in the root of your USB drive (e.g., F:\Launch_Portable_Arduino.bat).

Explanation:

Create run_portable.bat inside the main folder with:

@echo off
set ARDUINO_DATA_DIR=%~dp0data
set ARDUINO_SKETCHBOOK_DIR=%~dp0sketches
set ARDUINO_CACHE_DIR=%~dp0cache

start "" "%~dp0arduino-ide_2.x.x\Arduino IDE.exe" arduino ide 2 portable

cat > /media/usb/arduino-portable/run.sh << 'EOF' #!/bin/bash export ARDUINO_DATA_DIR="$(dirname "$0")/data" export ARDUINO_SKETCHBOOK_DIR="$(dirname "$0")/sketches" export ARDUINO_CACHE_DIR="$(dirname "$0")/cache" "$(dirname "$0")/arduino-ide_2.x.x/arduino-ide" "$@" EOF

chmod +x /media/usb/arduino-portable/run.sh

| Aspect | Standard IDE | Portable IDE | Verdict | |--------|--------------|--------------|---------| | First compile speed | Fast (toolchain in SSD user folder) | Slower first time (USB 2.0 bottleneck) | Use USB 3.0 or local SSD | | Concurrent instances | Conflict (shared global arduino15) | Isolated (each has own portable) | Portable wins | | Symlinks & Windows | Works | portable/arduino15 may have symlink issues on FAT32 | Format USB as NTFS or exFAT | | Auto-update | Works | Must manually update (update overwrites portable? Back up first) | Caution needed | Since you cannot change global environment variables on

Critical Warning: Never unplug the USB drive while the IDE is compiling. The portable/tmp folder holds active build files. Premature removal can corrupt the local arduino15 index.

Most users launch arduino-ide via a start menu shortcut. Few realize that the underlying Electron-based application (Arduino IDE 2.x shares DNA with VS Code) supports a command-line flag that changes its entire behavior.

The magic command is:

./arduino-ide --portable

When invoked without this flag, the IDE writes to user-specific global paths. When invoked with --portable, the IDE reverses its logic: it looks for a subfolder named portable inside its own installation directory. If found, it uses that folder as the root for all configuration, data, and sketch storage. Save this file as Launch_Portable_Arduino

#!/bin/bash
# Get the directory where this script resides
SCRIPT_DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" &> /dev/null && pwd )"
IDE_EXEC="$SCRIPT_DIR/Arduino IDE.app/Contents/MacOS/Arduino IDE" # macOS path
# Or for Linux: IDE_EXEC="$SCRIPT_DIR/arduino-ide"

if [ ! -f "$IDE_EXEC" ]; then echo "ERROR: IDE executable not found." exit 1 fi

# Extract Arduino IDE 2
tar -xzf arduino-ide_2.x.x_Linux_64bit.tar.gz -C /media/usb/arduino-portable/