Platform Support
Conversor de Unidades Remoto is designed to run seamlessly across all major platforms:Windows
PowerShell, CMD, and Git Bash supported
macOS
Native Terminal and zsh shell
Linux
Bash and other Unix shells
Key Differences
Virtual Environment Activation
The most significant difference between platforms is how you activate the Python virtual environment.- macOS/Linux
- Windows PowerShell
- Windows CMD
Uses forward slashes and
.sh activation script:Python Command
Different platforms use different commands to invoke Python:| Platform | Command | Alternative |
|---|---|---|
| macOS/Linux | python3 | python (if aliased) |
| Windows | py | python (if in PATH) |
Path Separators
PowerShell accepts both forward and backward slashes in most contexts, making it more flexible than CMD.
Environment Variables
Setting environment variables differs significantly across platforms.Temporary Variables (Current Session)
- macOS/Linux
- Windows PowerShell
- Windows CMD
Persistent Variables
macOS/Linux - .bashrc or .zshrc
macOS/Linux - .bashrc or .zshrc
Add to Reload:
~/.bashrc (or ~/.zshrc on macOS Catalina+):Windows - System Environment Variables
Windows - System Environment Variables
- Open System Properties
- Click “Environment Variables”
- Add user or system variables
Automated Run Scripts
The project includes platform-specific automation scripts that handle differences automatically.- macOS/Linux
- Windows
File: First time setup:Run:Features:
run.sh- Color-coded output using ANSI escape codes
- Background process management with PIDs
- SIGINT/SIGTERM trap for cleanup
- Interactive ngrok prompt
Both scripts provide the same user experience with:
- ICE server startup on port 10000
- Flask server startup on port 5000
- Optional ngrok tunnel for remote access
Port Checking Commands
Checking which processes are using specific ports:- macOS/Linux
- Windows PowerShell
- Windows CMD
Check port usage:Kill process by port:Kill process by name:
File Paths in Code
When writing Python code, useos.path.join() or pathlib for cross-platform compatibility:
Development Workflow
Recommended workflow that works identically across platforms:Testing Commands
Test ICE connectivity directly:- macOS/Linux
- Windows PowerShell
Package Installation
Python Package Manager
System Package Managers
- macOS - Homebrew
- Windows - winget
- Windows - Chocolatey
- Linux - apt (Debian/Ubuntu)
Best Practices
Use Virtual Environments
Always develop inside a virtual environment to isolate dependencies across all platforms
Path Handling
Use
pathlib or os.path in Python code for automatic path separator handlingTest on Target Platforms
If possible, test your changes on Windows, macOS, and Linux before committing
Document Platform-Specific Steps
When adding features, document any platform-specific setup or commands
Git Considerations
Line Endings
Configure Git to handle line endings correctly:Execute Permissions
Bash scripts need execute permissions on Unix systems:Common Pitfalls
Mixed path separators in strings
Mixed path separators in strings
Problem: Hardcoded paths with
/ or \\ in strings.Solution: Use os.path.join() or Path:Assuming bash commands exist
Assuming bash commands exist
Problem: Using Unix commands like
lsof, kill, grep in automation scripts.Solution: Provide separate scripts for Windows (.ps1) and Unix (.sh), or use Python for automation.Hardcoded localhost
Hardcoded localhost
Problem: Not all systems resolve
localhost the same way.Solution: Make the host configurable via environment variables:Assuming Python 3 is 'python'
Assuming Python 3 is 'python'
Problem: Some systems use
python for Python 2, python3 for Python 3.Solution: Inside a venv, use python (no version). Outside venv, use python3 (Unix) or py (Windows).Summary Table
| Task | macOS/Linux | Windows PowerShell | Windows CMD |
|---|---|---|---|
| Create venv | python3 -m venv .venv | py -m venv .venv | py -m venv .venv |
| Activate venv | source .venv/bin/activate | .\.venv\Scripts\Activate.ps1 | .venv\Scripts\activate.bat |
| Run server | python3 server.py | python server.py | python server.py |
| Check port | lsof -i :10000 | netstat -ano | findstr :10000 | netstat -ano | findstr :10000 |
| Set env var | export VAR=value | $env:VAR="value" | set VAR=value |
| Run script | ./run.sh | powershell -ExecutionPolicy Bypass -File run.ps1 | N/A |