Summary This paper presents PolyMPC, an open-source C++ library for pseudospectral-based real-time predictive control of nonlinear systems. It provides a necessary background on the computational aspects of the pseudospectral approximation of optimal control problems and explains how various model predictive control and parameter estimation algorithms can be implemented using the software. We discuss the key algorithmic modules and architectural features of the PolyMPC library. The workflow of a path following controller design for a highly nonlinear mechatronic system is demonstrated in a tutorial example. Another example illustrates how the core functionality might be used to approximate and solve a custom optimal control problem.