Planning a trading platform around MT5 data, I assumed the official MetaTrader5 pip package would run wherever Python runs. It doesn’t. The package is Windows-only — it works by attaching to a locally running MetaTrader 5 terminal through Windows-specific interop, so there is nothing to pip install your way around on macOS or Linux.
If you’re on a Mac (mine is an M2), you have three real options:
- Run Windows in a VM and put the whole Python stack inside it. This is what I did: Windows 11 in VirtualBox on the M2, MT5 terminal plus the Python app both living in the VM. It works, with caveats — VirtualBox on Apple Silicon is its own adventure (3D acceleration gave me a black screen that took
VBoxManagesurgery to recover from), and you’re now operating a Windows machine to run a Python script. - Write the strategy natively in MQL5 and run it in the MT5 terminal you already have on the Mac. For a later bot project I pivoted to exactly this: the Python codebase got frozen as a reference implementation — the architectural spec and the source of acceptance tests — and the production logic became an MQL5 port. More rewriting, far less infrastructure.
- Split the system: something Windows-side exports or streams the terminal’s data out to wherever your analysis actually runs. Right answer when the Python side is large and the MT5 side is just a data source.
The meta-lesson: when a broker or platform offers a “Python API,” check how it connects before designing around it. An API that binds to a local desktop terminal is a very different dependency from one that speaks HTTP.