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
Due to the IntelliJ platform issue, you need to set the property value
idea.case.sensitive.fs=truein the idea.properties file (to access the property file, select on the main menu), then restart CLion with cache reset ( ).
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
Go toand click to create a new toolchain.
Select Remote Host from the drop-down menu and provide the remote host credentials:
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:
You can make the newly created toolchain the default one (for this, move it to the top of the toolchains list by clicking ). 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 CMake profile, and connect it to your remote toolchain using the Toolchain field:, click to create a new
After the changes are applied, CLion switches the CMake profile and reloads your project:
Check and adjust the deployment configuration
When you create a connection entity for the remote toolchain, CLion puts it in the list of server access configurations in :
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.
You can monitor the synchronization process in the 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: