# MetaTrader5 Python package on Linux and macOS: it needs Windows

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/errors/mt5/python-package-needs-windows, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

The official MetaTrader5 package for Python runs on Windows only. On Linux or a Mac, pip has no build for your system, and the MQL5 forum answer is that you need Windows Python. What the sources say and the routes people use.

- Last reviewed: 2026-09-23

Unverified in part: carried over from an earlier version of this site. The links below are the sources it was written from, but its statements have not been re-read at source since the date shown, so check anything you rely on.

## What to check

1. Check what you are running: `python -c "import sys, platform; print(sys.platform, platform.machine())"`. The package's wheels are for Windows on x86-64, which prints win32 and AMD64.
2. The route the forum thread gives: Windows Python, next to a MetaTrader 5 terminal. On a Mac or a Linux machine that means a Windows environment of some kind; a separate Windows machine or virtual machine is the plain case.
3. A community route: psyb0t/mt5-httpapi runs the Windows only terminal in Docker or QEMU and puts REST and MCP in front of it. Community code under the WTFPL licence, and we have not checked how it handles credentials.
4. If all you need is your trade history, you may not need Python at all: [MetaTrader 4 and 5 trade history, no code](https://openbrokerapi.com/guides/metatrader-trade-history).

Step 2 is what the thread reports. Steps 1, 3 and 4 are ours.

Next steps for this error

- Every MetaTrader 5 endpoint No single endpoint is named for this error on this site.
- [MetaTrader 5 quickstart](https://openbrokerapi.com/platforms/metatrader-5/quickstart)

## Why it happens

The package is a bridge to the MetaTrader 5 terminal, which it reaches by interprocess communication on the same machine, and it is published for win32 and win_amd64 (Windows) only. So it is not only a question of whether Python installs: the terminal it talks to has to be running there too.

Tools built on top of MetaTrader 5 meet the same wall. The community metatrader-mcp-server tracker carries reports from Linux and macOS users running without a terminal (#29 and #32).

## Questions

### Can I pip install MetaTrader5 on macOS?

Not natively. PyPI publishes the package, 5.0.6231 of 27 Sep 2026 when we read it, as wheels for win32 and win_amd64 only, so pip on macOS has no build to install.

### Does the MetaTrader5 Python package work on Linux?

Not as a Linux package. The MQL5 forum answer of 22 Jan 2025 is that Linux and Mac users need Windows Python, and the package also needs a running MetaTrader 5 terminal to connect to.

### Why does an MT5 MCP server fail on my Mac?

The community metatrader-mcp-server has reports from Linux and macOS users running without a terminal (#29 and #32). Whichever server you use, it needs a MetaTrader 5 terminal it can reach.

### Is there a Docker image for MetaTrader 5?

One community project we list, psyb0t/mt5-httpapi, runs the terminal in Docker or QEMU with REST and MCP in front. It is not MetaQuotes' own, and we have not checked how it handles credentials.

## Sources

- [MQL5 forum: issue regarding python integration with metaTrader5](https://www.mql5.com/en/forum/480072)posted 22 Jan 2025, checked 21 Sep 2026
- [PyPI: MetaTrader5](https://pypi.org/project/MetaTrader5/)checked 21 Sep 2026
- [GitHub: metatrader-mcp-server issues #25 to #49](https://github.com/ariadng/metatrader-mcp-server/issues)10 May to 4 Sep 2026, checked 21 Sep 2026
- [MQL5 docs: MetaTrader for Python](https://www.mql5.com/en/docs/python_metatrader5)checked 20 Sep 2026

## More on the MetaTrader 5 API

- [MetaTrader 5 API quickstart](https://openbrokerapi.com/platforms/metatrader-5/quickstart): From credentials to a first call on a demo account, step by step.
- [MetaTrader 5 API error codes](https://openbrokerapi.com/errors/mt5): 311 decoded, each with what it means, and the fix where the source gives one.
- [MetaTrader 5 functions](https://openbrokerapi.com/platforms/metatrader-5/functions): 78 documented, each with its signature, arguments, return value and source.
- [MetaTrader 5 API page](https://openbrokerapi.com/platforms/metatrader-5): The full record: access, authentication, limits and the source for each.
- [Claude with MetaTrader 5: a safe, read-first setup](https://openbrokerapi.com/guides/claude-mt5): Guide
- [MetaTrader 5 for Python: which platforms does it run on?](https://openbrokerapi.com/guides/metatrader-5-python-platforms): Guide
- [MT5 trade history to a spreadsheet with Python](https://openbrokerapi.com/guides/mt5-trade-history-to-a-spreadsheet): Guide

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: MetaTrader5 Python package on Linux and macOS: it needs Windows. Broker API Hub, https://openbrokerapi.com/errors/mt5/python-package-needs-windows, newest check 2026-09-23.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
