Gurobi can export your model to several different file formats. This is done by invoking the write function of the appropriate API. The file name extension (.lp, .mps, .rew, etc.) of the string argument provided to the write function determines the type of model file that will be written. You can also append an extension to specify a compression algorithm (.bz2, .zip, etc.).
Using an API
The write functions for each supported programming language are listed below.
For example, in Python:
Using the command-line tool
gurobi_cl ResultFile=model.rew model.mps
Because the MPS file isn't written until after the optimization completes, you may also want to use a very short TimeLimit. This way, you don't have to wait for the model to solve to optimality.