---
title: "ClickHouse® tips #2: Debugging ClickHouse® on Visual Studio Code"
excerpt: "How to configure Visual Studio Code to debug ClickHouse® on it. Part 2."
authors: "Alberto Romeu"
categories: "The Data Base"
createdOn: "2023-09-25 00:00:00"
publishedOn: "2021-02-10 00:00:00"
updatedOn: "2022-09-08 00:00:00"
status: "published"
---

<p>It’s possible to debug ClickHouse® on VSCode. These are the steps to do it:</p><ul><li>Build ClickHouse® for debugging <a href="https://clickhouse.tech/docs/en/development/developer-instruction/#the-building-process">docs</a></li><li>You can adapt the build with several flags, in my case I want to disable <code>jemalloc</code>:</li></ul><figure class="kg-card kg-embed-card"><iframe width="100%" src="https://snippets.tinybird.co/XQAAAAJAAQAAAAAAAABBKUqGk9nLKzhQ1znHNqZldxSMEjeXH_jTGeiNNjy-VujMRah2AnSz8kEa4q7Guj2e4d4KYn3sJR9r-fTLmylPz3twPdZvW3Ahp7yL6keXYCQu5bikIxsrSM6b8smKYQe4P4FImj_C8cgtBLg1KbuRalBHSFaUNGR3Mjzvd5AgadUIw0jfK72_cgQkLjVYoB5JsETLkb9n8BJ9yo2SG0n4I7gW36Gym9zHYyBOhfkI8x90rSqu5HK39EBDckw4EQONC-3hHzEox_aRW620Vu3mV3nfE8Lrhff2vlP_jmwAAA/embed"></iframe></figure><ul><li>Doing <code>ninja clickhouse-server clickhouse-client</code> the whole process takes less than one hour.</li></ul><p>And then to debug with Visual Studio Code:</p><ul><li>Install the <a href="https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools">C++ extension</a> (and gdb from brew or apt)</li><li>Create a new run config like this in <code>.vscode</code>:</li></ul><figure class="kg-card kg-embed-card"><iframe width="100%" src="https://snippets.tinybird.co/XQAAAAIpBAAAAAAAAABBKUqGk9nLKvwUd1kIR16OmLxYhPnOznAa5diEjE2_ExLLMhNx4vHT1hbWy-OtSr1kK4NAvXbGfGo1IGmlDMOYI_sEhZhw7Ty7nM_lZ_b4pPIVcr10vWj-_FAttrkEYRxehjPtJfu413BoqjEwNVfbmH4LKcImFErEAJI9o09uKpRVffffRsr0PQvx-z6NIKjryN7VcegBUl7-ASuCRUlgaSuxEeVgOC2PxUNmamxUZlyKJDfUDanBJ2qjaLEvc-wW0M-_wOREQ0ubejj5hFQqYsUPnk37F-pqn1bM_u1y8si6PEoi-Mh4seqCGWRR4MdGwLHgDX1nzEsIoqu2YOzP9Ia8OH9Dj8z6Dp72lrE6aGH9nl6jw7k5AuO5YfXZpvRwfvewC4vnNNDC_Mb2namTdf6UnSPxcWkZRv4Amkd9PIqjEiUnbQTSrKjwEbZNLYXxVyOcQkMnlsPaYw7vwOqJ22YVU8TnwrCwmnouKDPwTBJSiqP8Uc4mRJbZ3bSUHMBooPDr93AkVGngQL73LoR9waumYDSjauISbCQCNBaYPPq91W8UpW9n3_aI9qpInsTJzyl8UccK2LaHphLZLyVR9vNouIQaecX1W704udgIWTlwPceapahIn2h1ZPcZFhDgZ-ae45SoIJlwwoeu2Bd9hVov1f5fxuHAuv9yrMPtzt299Strgu3uGv_8sQkfd379UHpZT_QNdwB8zOQzWeKw8hrtkIrj_4uojiM/embed"></iframe></figure><p>Then you can just add breakpoints in any line in the editor and <code>RUN</code> from inside Visual Studio Code.</p><p>After doing any change in a cpp file, you can just recompile it, although there might be better ways to do this (<a href="https://twitter.com/tinybirdco">let us know!</a>). There’s a <code>compile_commands.json</code> file in the build folder with the commands and then call ninja to re-generate the clickhouse binary (it’ll just recompile the dependencies)</p><p>That’s it!</p>
