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
With this approach, the model file isn't written until the optimization completes. As such, you may want to solve the model with a very short TimeLimit so you don't have to wait for the model to solve to optimality.