Skip to main content

Disable Visual Studio Code telemetry

Overview

About this script

This script improves your privacy on Linux.

These changes use Linux system commands to update your settings.

The telemetry.telemetryLevel preference can be adjusted as follows 1:

  • default (on): Transmits usage data, errors, and crash reports.
  • error: Transmits general error telemetry and crash reports.
  • crash: Transmits OS-level crash reports.
  • off: Disables all product telemetry.

This script disables telemetry data, which includes usage data, errors, and crash reports.

The telemetry.enableTelemetry was the primary option to disable telemetry collection 2. This disabled the collection of diagnostic data 3. However, it has been deprecated and replaced by the telemetry.telemetryLevel setting 4 5.

Crash reports use a unique ID to identify you 6. They were initially controlled using the telemetry.enableCrashReporter setting 7, but this setting has been deprecated and replaced by the telemetry.telemetryLevel setting 7.

This script uses Bash (Shell script) scripting language.

Safe for General Use

This script is recommended for all users. It helps to improve privacy without affecting stability.

Implementation Details
  • Language: bash

  • Required Privileges: Root/sudo access

  • Compatibility: Linux only

  • Reversibility: Can be undone using provided revert script

Explore Categories

This action belongs to Disable Visual Studio Code data collection category. Visual Studio Code, also commonly referred to as VS Code, is a source-code editor made by Microsoft. Visual Studio Code makes outgoing network requests to collect data in the background without users invoking a feature that requires online access. The requests include, but are not limited to,... Read more on category page ▶

Apply now

Choose one of three ways to apply:

  1. Automatically via privacy.sexy: The easiest and safest option.
  2. Manually by downloading: Requires downloading a file.
  3. Manually by copying: Advanced flexibility.

Alternative 1. Apply with Privacy.sexy

privacy.sexy is free and open-source application that lets securely apply this action easily.

Open privacy.sexy

You can fully restore this action (revert back to the original behavior) using the application.

privacy.sexy instructions
  1. Open or download the desktop application
  2. Search for the script name: Disable Visual Studio Code telemetry.
  3. Check the script by clicking on the checkbox.
  4. Click on Run button at the bottom of the page.

Alternative 2. Download

Irreversible Changes

This script is irreversible, meaning there is no straightforward method to restore changes once applied. Exercise caution before running, restoring it may not be possible.

  1. Download the script file by clicking on the button below:

    Download script

  2. Run the script file by clicking on it.

Download revert script

This file restores your system to its original state, before this script is applied.

Download restore script

Alternative 3. Copy

This is for advanced users. Consider automatically applying or downloading the script for simpler way.

  1. Open Terminal

  2. Copy the following code:

Code to apply changes
if ! command -v 'python3' &> /dev/null; then
echo 'Skipping because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'telemetry.telemetryLevel'
target = json.loads('"off"')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print('Settings file is empty. Treating it as default empty JSON object.')
file_content = '{}'
json_object = None
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Settings "{property_name}" is not configured.')
else:
existing_value = json_object[property_name]
if existing_value == target:
print(f'Skipping, "{property_name}" is already configured as {json.dumps(target)}.')
continue
print(f'Setting "{property_name}" has unexpected value {json.dumps(existing_value)} that will be changed.')
json_object[property_name] = target
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully configured "{property_name}" to {json.dumps(target)}.')
EOF
fi
if ! command -v 'python3' &> /dev/null; then
echo 'Skipping because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'telemetry.enableTelemetry'
target = json.loads('false')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print('Settings file is empty. Treating it as default empty JSON object.')
file_content = '{}'
json_object = None
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Settings "{property_name}" is not configured.')
else:
existing_value = json_object[property_name]
if existing_value == target:
print(f'Skipping, "{property_name}" is already configured as {json.dumps(target)}.')
continue
print(f'Setting "{property_name}" has unexpected value {json.dumps(existing_value)} that will be changed.')
json_object[property_name] = target
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully configured "{property_name}" to {json.dumps(target)}.')
EOF
fi
if ! command -v 'python3' &> /dev/null; then
echo 'Skipping because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'telemetry.enableCrashReporter'
target = json.loads('false')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print('Settings file is empty. Treating it as default empty JSON object.')
file_content = '{}'
json_object = None
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Settings "{property_name}" is not configured.')
else:
existing_value = json_object[property_name]
if existing_value == target:
print(f'Skipping, "{property_name}" is already configured as {json.dumps(target)}.')
continue
print(f'Setting "{property_name}" has unexpected value {json.dumps(existing_value)} that will be changed.')
json_object[property_name] = target
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully configured "{property_name}" to {json.dumps(target)}.')
EOF
fi
  1. Paste the code into terminal.
  2. Press Enter to apply the code.

Some scripts requires restarting your computer to take affect.

Copy restore code

Copy and run the following code to restore changes:

Revert code
if ! command -v 'python3' &> /dev/null; then
>&2 echo 'Cannot revert because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'telemetry.telemetryLevel'
target = json.loads('"off"')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print(f'Skipping, no need to revert because settings file is empty: "{settings_file}".')
continue
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Skipping, "{property_name}" is not configured.')
continue
existing_value = json_object[property_name]
if existing_value != target:
print(f'Skipping, "{property_name}" is configured using {json.dumps(existing_value)} instead of {json.dumps(target)}.')
continue
del json_object[property_name]
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully reverted "{property_name}" setting.')
EOF
fi
if ! command -v 'python3' &> /dev/null; then
>&2 echo 'Cannot revert because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'telemetry.enableTelemetry'
target = json.loads('false')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print(f'Skipping, no need to revert because settings file is empty: "{settings_file}".')
continue
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Skipping, "{property_name}" is not configured.')
continue
existing_value = json_object[property_name]
if existing_value != target:
print(f'Skipping, "{property_name}" is configured using {json.dumps(existing_value)} instead of {json.dumps(target)}.')
continue
del json_object[property_name]
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully reverted "{property_name}" setting.')
EOF
fi
if ! command -v 'python3' &> /dev/null; then
>&2 echo 'Cannot revert because "python3" is not found.'
else
python3 <<EOF
from pathlib import Path
import os, json, sys
property_name = 'telemetry.enableCrashReporter'
target = json.loads('false')
home_dir = f'/home/{os.getenv("SUDO_USER", os.getenv("USER"))}'
settings_files = [
# Global installation (also Snap that installs with "--classic" flag)
f'{home_dir}/.config/Code/User/settings.json',
# Flatpak installation
f'{home_dir}/.var/app/com.visualstudio.code/config/Code/User/settings.json'
]
for settings_file in settings_files:
file=Path(settings_file)
if not file.is_file():
print(f'Skipping, file does not exist at "{settings_file}".')
continue
print(f'Reading file at "{settings_file}".')
file_content = file.read_text()
if not file_content.strip():
print(f'Skipping, no need to revert because settings file is empty: "{settings_file}".')
continue
try:
json_object = json.loads(file_content)
except json.JSONDecodeError:
print(f'Error, invalid JSON format in the settings file: "{settings_file}".', file=sys.stderr)
continue
if property_name not in json_object:
print(f'Skipping, "{property_name}" is not configured.')
continue
existing_value = json_object[property_name]
if existing_value != target:
print(f'Skipping, "{property_name}" is configured using {json.dumps(existing_value)} instead of {json.dumps(target)}.')
continue
del json_object[property_name]
new_content = json.dumps(json_object, indent=2)
file.write_text(new_content)
print(f'Successfully reverted "{property_name}" setting.')
EOF
fi

Support

This website relies on your support.

Support now

Your donation helps keep the project alive and improves its content ❤️.

Share this page: