How to get Visual Studio Code to run on Android with Termux -- Mar 2023 Update
Tags: android, termux, vscode, samsungdex
Published: 2020-10-06 05:51:39

---
title: How to get Visual Studio Code to run on Android with Termux -- Mar 2023 Update
published: true
description: Step-by-step to get VSCode on Android
tags: android,termux,vscode,samsungdex
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/nrv3efcego8ncd9l0vty.jpg
---

Every below is from before 2020 so **Don't use Termux from the Play Store** use [Termux from F-droid](https://f-droid.org/en/packages/com.termux/)

Getting `code-server` is now easier with the following commands:

    pkg install tur-repo
    pkg install code-server

**Start old stuff**

~~[Termux from Play Store](https://play.google.com/store/apps/details?id=com.termux)~~ is an app which provides a Unix/Linux-like environment on your Android device. But getting an familiar IDE like Visual Studio Code previous required a number of steps. Recently this seems to have been streamlined by the various package maintainers and now can be done in fewer steps.

First is that we will be installing the the open source version of Visual Studio Code (VS Code), called [code-server](https://github.com/cdr/code-server).

`code-server` is an [Electron app](https://en.wikipedia.org/wiki/Electron_(software_framework)) and needs support from [`nodejs` environment](https://en.wikipedia.org/wiki/Node.js).

In Termux run the following commands:

    pkg install nodejs

    pkg install yarn

Per the [Termux NodeJS wiki](https://wiki.termux.com/index.php?title=Node.js) also install:

    pkg install build-essential

    pkg install python

    pkg install git

As they are needed for building native extensions.

And finally install `code-server` itself.

    yarn global add code-server

**Note: Installing `code-server` will take a while**

`code-server` is now installed and will be the back end server to your front end client, a [Chromium](https://en.wikipedia.org/wiki/Chromium_(web_browser)) browser, like Chrome for Android or Microsoft Edge.

Now from the command line run `code-server` or have it run in the background by adding an ampersand like `code-server &`.

    code-server &

You'll get some output logs about where the password is located.

In my case I used `cat ~/.config/code-server/config.yaml` to find out what was configured.

Open up a browser, as I was using Samsung DeX as a desktop, I used Samsung Internet, connected to 127.0.0.1:8080 and entered the password.

![Screenshot_20201005-220244_Samsung Internet](https://dev-to-uploads.s3.amazonaws.com/i/59kr39foh7nseihcgcs2.jpg)

Once connected, you can install plugins. As you can see, the MS Python plugin appears to work. 

A few caveats:

* [`code-server` is not Microsoft Visual Studio Code](https://github.com/cdr/code-server/blob/v3.5.0/doc/FAQ.md#differences-compared-to-vs-code) The summary is that not all plugins are supported, YMMV.

* I'm using Termux and code-server with Samsung DeX so I don't have any the soft keyboard issues that others have encountered.

**Updating VS Code/`code-server` to latest (1.50.0)**

Step 1: kill `code-server` if running

Step 2: Now update all of the packages (check above list)

    pkg update

Step 3: In order to force a rebuild, use `yarn` to remove `code-server`

    yarn global remove code-server

Step 4: And add/install `code-server` (yes it will take a while)

    yarn global add code-server

**Getting Search to work**

Thanks to [yozman on this issue ticket](https://github.com/cdr/code-server/issues/1730#issuecomment-721515979)

Install the package ripgrep:

    pkg install ripgrep

And add to the `code-server` directory 

which is in my setup can be reached by:

    cd /data/data/com.termux/files/home/.config/yarn/global/node_modules/code-server

a softlink to the `rg` binary:

    ln -s $PREFIX/bin/rg ./lib/vscode/node_modules/vscode-ripgrep/bin/rg