MuJoCo Setup on macOS

Reinforcement Learning with Physics simulations

MuJoCo stands for Multi-Joint dynamics with Contact. Generally, any reinforcement algorithm takes in pixels as inputs viz. a game state. In MuJoCo, the inputs are the angles. When we use the trained models on real-world robots, they perform well.

To set up the MuJoCo environment we need to have a license. We can take a free 30-day trial license or student license or personal/commercial licenses. You can go to this page for details.

  1. Download the key for the respective OS. In my case, I chose free 30-day trial on OSX which downloaded a file getid_osx
  2. Change the permissions of the file by running chmod 777 getid_osx
  3. Run the file in terminal ./getid_osx
  4. It will generate the Computer ID.
  5. Copy that and paste in the website and provide your details.
  6. You will receive an email with License.txt and mjkey.txt. Download them
  7. Click here to download the mujoco-py for macOS. Unzip it.
  8. Paste these downloaded files ( License.txt and mjkey.txt) inside mujoco200 directory.
  9. Move the directory to HOME by running mv mujoco200 ~/.mujoco/mujoco200
  10. open ~/.bash_profile
  11. Add these lines in that bash_profile file

12. cd ~/.mujoco/mujoco200/bin

13. Run ./simulate ../model/humanoid.xml

14. If it is successful, it should open the below simulator.

Common Errors

MuJoCo python failing on macOS older version

brew install llvm boost hdf5

There is no way you don’t have llvm and still want to proceed with gcc . If you are in an older version of macOS Sierra like me, upgrade your gcc to new versions.

Installation of llvm especially when you are running out of memory is painful. It takes a lot of time. It is around 1–3 GB in size.

Please do not try to install installing llvm before upgrading your gcc . It is tonnes of time waste and finally, llvm throws an error saying incompatible gcc version .

Consultant