Why would you want to run Linux apps in Docker on a Mac? Maybe there's a Linux program you love or you want the added security of sandboxing an app. Or maybe, as was the case with me, you're developing a C++ program targeting Linux and don't want to cross compile your dependencies.
- Download the Linux version of CLion
- Each time dependencies change, run
create_dev_container.shto create a Docker image and container. The script assumes
~/devis your code directory. If you use something different, edit the script or run it as
start_dev_container.shto start the container and exec bash inside of it
- From inside the container, run
/home/dev/clion-XXX/bin/clion.shto start CLion. If this fails, ensure your container contains a JRE by either manually running
apt install default-jreor adding it to the Dockerfile.
- Either select "Evaluate for free" or enter your activation code
- Open your project
- Build it and enjoy code completion, etc.!
- If you make changes to settings they'll be lost each time you create a new container. To save them, run
docker cp my_project:/root/.CLionXXX/ ~/devand import them next time you start CLion in a fresh container.