CLion 2018.3 Help

Remote Projects

Introduction

Remote projects support enables you to work on a macOS, Linux, or Windows desktop targeting a remote Linux machine connected via SSH.

For remote development, the CLion instance runs locally, and your source files are also placed on the local client, with automatic synchronization to the remote host. On the remote host side, CLion performs compilation and build using host compilers and CMake, uses host GDB for debug, and runs the application on the remote target.

Summarizing the currently supported options and prerequisites:

  • Local client machine: macOS/Linux/Windows

  • Remote host: Linux

  • Sources location: originally on the local machine, with automatic synchronization to the remote host

  • Project model: CMake

  • Additionally for macOS/Linux client: rsync installed on the remote host

Configuring remote projects

For Windows local machines

  1. Due to the IntelliJ platform issue, you need to set the property value idea.case.sensitive.fs=true in the idea.properties file (to access the property file, select Help | Edit Custom Properties... on the main menu), then restart CLion with cache reset (File | Invalidate Caches / Restart...).

  2. For files synchronization on Windows, CLion relies on its own Remote Host Access and compression on the host side using the tar utility. This mechanism causes the synchronization to perform slower than rsync on macOS and Linux.

Create a toolchain with remote credentials

  1. Go to Settings / Preferences | Build, Execution, Deployment | Toolchains and click plus icon to create a new toolchain.

  2. Select Remote Host from the drop-down menu and provide the remote host credentials:

    credentials to access the remote host

  3. After the connection is established, CLion attempts to detect the CMake executable and debugger in the default locations /usr/bin/cmake and /usr/bin/gdb or using the paths that you have provided manually. When the checks finish successfully, the toolchain is ready for use:

    remote toolchain configured successfully

  4. You can make the newly created toolchain the default one (for this, move it to the top of the toolchains list by clicking move upmove down). When set as default, the remote toolchain is used for all the projects you create and open in CLion.

    Note that if you set the remote toolchain as default, the default CMake profile will connect to it automatically, so you do not need to configure a separate CMake profile for it.

Create a corresponding CMake profile

  • Go to Settings / Preferences | Build, Execution, Deployment | CMake, click plus icon to create a new CMake profile, and connect it to your remote toolchain using the Toolchain field:

    cmake profile for the remote toolchain

    After the changes are applied, CLion switches the CMake profile and reloads your project:

    reloading cmake project with remote toolchain

Check and adjust the deployment configuration

  1. When you create a connection entity for the remote toolchain, CLion puts it in the list of server access configurations in Settings / Preferences | Build, Execution, Deployment | Deployment:

    deployment configuration for remote host access

  2. CLion automatically configures the paths to be used for your project code synchronization. Use the Mappings tab if you need to change the default mappings.

  3. You can monitor the synchronization process in the File Transfer tool window (View | Tool Windows | File Transfer):

    file transfer tool window

Working with remote projects

Now that you have a remote toolchain and the corresponding CMake profile configured, you can build, run, and debug your application and tests in the completely remote way simply by selecting the proper CMake profile in the Run/Debug configuration switcher.

The demo below shows how the application output changes depending on the OS that it runs on. Having macOS as a local system, we connect remotely to the Ubuntu target and check the OS name. In this example, code highlighting depends on the OS identifier. That is why when we switch the CMake profile, and the resolve context changes accordingly, or when we switch the resolve context manually in the right-bottom corner of the status bar, we can see the corresponding code branch being highlighted:

Last modified: 14 February 2019