Complete VS Code Installation and Setup Guide for Beginners
A step-by-step guide to installing Visual Studio Code on Windows, macOS, and Linux, including interface overview and plugin setup.
Visual Studio Code (VS Code) is a free, lightweight but powerful code editor created by Microsoft. It’s like a smart notepad for writing code, with helpful features like:
- Color-coding for different programming languages
- Auto-completion suggestions while you type
- Built-in terminal for running commands
- Extensions to add more features
Think of it as a Swiss Army knife for coding—it works with almost any programming language!
2. Installation Guides
Windows Installation
Step 1: Download VS Code
- Open your web browser (Chrome, Edge, Firefox)
- Go to:
https://code.visualstudio.com/ - Click the large blue “Download for Windows” button
- Wait for the download to complete (file name:
VSCodeSetup.exe)
Step 2: Run the Installer
- Find the downloaded file (usually in your “Downloads” folder)
- Double-click
VSCodeSetup.exe - If Windows asks “Do you want to allow this app to make changes?”, click “Yes”
Step 3: License Agreement
- Read the license agreement
- Select “I accept the agreement”
- Click “Next”
Step 4: Choose Install Location
- Keep the default location (recommended)
- Click “Next”
Step 5: Start Menu Folder
- Keep the default folder name “Visual Studio Code”
- Click “Next”
Step 6: Select Additional Tasks Check these boxes (VERY IMPORTANT):
- ✅ “Add ‘Open with Code’ action to Windows Explorer file context menu”
- ✅ “Add ‘Open with Code’ action to Windows Explorer directory context menu”
- ✅ “Register Code as an editor for supported file types”
- ✅ “Add to PATH” (this is crucial!)
- Click “Next”
Step 7: Install
- Click “Install”
- Wait for installation to complete (1-2 minutes)
- Uncheck “Launch Visual Studio Code” for now
- Click “Finish”
macOS Installation
Step 1: Download VS Code
- Open Safari or Chrome
- Go to:
https://code.visualstudio.com/ - Click “Download for Mac”
- Wait for the
.zipfile to download
Step 2: Extract the File
- Find
VSCode-darwin.zipin your Downloads folder - Double-click it to extract (if it doesn’t auto-extract)
- You’ll see “Visual Studio Code.app”
Step 3: Move to Applications
- Open Finder
- Go to Downloads folder
- Drag “Visual Studio Code.app” to your “Applications” folder
- Wait for the copy to finish
Step 4: First Launch
- Go to Applications folder
- Double-click “Visual Studio Code”
- If you see a warning: “Visual Studio Code can’t be opened because Apple cannot check it for malicious software”:
- Click “OK”
- Go to System Preferences → Security & Privacy
- Click “Open Anyway” next to VS Code
- VS Code will open
Step 5: Add to Dock (Optional)
- Right-click the VS Code icon in your Dock
- Select Options → “Keep in Dock”
Linux Installation
Ubuntu/Debian Method (Recommended for beginners):
Step 1: Download
- Open Firefox or Chrome
- Go to:
https://code.visualstudio.com/ - Click “Download for Linux”
- Choose “.deb” option (for Ubuntu, Debian)
- Save the file
Step 2: Install the .deb Package
- Open your Downloads folder
- Right-click the downloaded
.debfile - Select “Open With Software Install”
- Click “Install”
- Enter your password when prompted
- Wait for installation to complete
Alternative Method (Terminal):
- Press
Ctrl + Alt + Tto open Terminal - Navigate to Downloads:
cd ~/Downloads - Install the package:
sudo dpkg -i code_*.deb - If errors appear:
sudo apt-get install -f - Enter your password when prompted
Other Linux Distributions:
Fedora/RHEL:
- Download the
.rpmfile - Open Terminal
- Run:
sudo rpm -i code-*.rpm
Snap Method (Universal Linux):
- Open Terminal
- Run:
sudo snap install code --classic
3. Interface Overview
When you first open VS Code, you’ll see several important areas. Here’s a visual guide:
Key Interface Components Explained:
-
Activity Bar (Leftmost narrow bar): Switch between different views:
- 📁 Explorer: Browse your files and folders
- 🔍 Search: Find text across all your files
- 🔄 Source Control: Git integration
- 🐛 Run and Debug: Test and fix your code
- ▯ Extensions: Install plugins
-
Sidebar: Shows contents based on what you select in the Activity Bar
-
Editor Area: Where you write and edit your code
-
Status Bar (Bottom blue bar): Shows:
- Current Git branch
- Errors and warnings count
- Line and column number
- Language mode
- Encoding
-
Panel (Bottom section): Contains Terminal, Output, Debug Console
4. Installing Your First Plugin (Prettier - Code Formatter)
A code formatter automatically makes your code look neat and organized.
Step 1: Open Extensions View
- Click the square icon (▯) in the Activity Bar on the left side
- Or press
Ctrl + Shift + X(Windows/Linux) - Or press
Cmd + Shift + X(Mac)
- Or press
Step 2: Search for Prettier
- In the search box at the top, type:
Prettier - Look for “Prettier - Code formatter” by Prettier
- It should have a checkmark ✅ and many downloads
Step 3: Install
- Click the green “Install” button
- Wait a few seconds for installation
- The button will change to “Uninstall” when done
Step 4: Set as Default Formatter
- Press
Ctrl + ,(Windows/Linux) orCmd + ,(Mac) to open Settings - In the search bar, type:
default formatter - From the dropdown, select “Prettier - Code formatter”
Step 5: Enable Format on Save
- In Settings, search for:
format on save - Check the box for “Editor: Format On Save”
Now every time you save a file, Prettier will automatically format your code!
5. Setting Up Multiple Java Versions
This guide helps you switch between different Java versions (like Java 8, 11, 17, 21) in VS Code.
Prerequisites:
- Have multiple Java versions installed on your computer
- Note where each version is installed
Method 1: Using Settings (Easiest for Beginners)
Step 1: Install Java Extension Pack
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for “Extension Pack for Java”
- Click Install
Step 2: Configure Java Home for Projects
- Open VS Code Settings:
Ctrl + ,(Windows/Linux) orCmd + ,(Mac) - Click the “Workspace” tab (not “User”)
- Search for:
java home - Type the path to your Java installation
Example paths:
- Windows:
C:\Program Files\Java\jdk-17.0.1 - macOS:
/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home - Linux:
/usr/lib/jvm/java-17-openjdk-amd64
Method 2: Using Settings.json (More Control)
Step 1: Create Workspace Settings
- Open your project folder in VS Code
- Create a folder called
.vscodein your project - Inside
.vscode, create a file calledsettings.json
Step 2: Add Configuration
Add this content to settings.json:
{
"java.configuration.runtimes": [
{
"name": "JavaSE-1.8",
"path": "C:/Program Files/Java/jdk1.8.0_301",
"default": false
},
{
"name": "JavaSE-11",
"path": "C:/Program Files/Java/jdk-11.0.12",
"default": false
},
{
"name": "JavaSE-17",
"path": "C:/Program Files/Java/jdk-17.0.1",
"default": true
}
]
}
IMPORTANT: Change the paths to match where YOUR Java versions are installed!
For macOS users, paths look like:
"path": "/Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home"
For Linux users, paths look like:
"path": "/usr/lib/jvm/java-17-openjdk-amd64"
Step 3: Select Java Version Per Project
- Open Command Palette:
Ctrl + Shift + P(Windows/Linux) orCmd + Shift + P(Mac) - Type:
Java: Configure Java Runtime - Select the version you want for this project
Method 3: Environment Variables (Affects ALL programs)
Windows:
- Search “Environment Variables” in Start Menu
- Click “Environment Variables”
- Under “System Variables”, find “JAVA_HOME”
- Click “Edit”
- Paste the path to your desired Java version
- Click OK three times
- Restart VS Code
macOS/Linux:
- Open Terminal
- Edit your shell profile:
nano ~/.bashrcornano ~/.zshrc - Add:
export JAVA_HOME=/path/to/your/jdk - Save:
Ctrl + O, then Enter, thenCtrl + X - Reload:
source ~/.bashrcorsource ~/.zshrc
6. Troubleshooting Guide
Problem 1: “VS Code is not recognized” in Terminal
This means VS Code didn’t add itself to your system PATH
Windows Fix:
- Uninstall VS Code
- Reinstall and MAKE SURE to check “Add to PATH” during installation
- OR add manually:
- Find VS Code location (usually
C:\Users\[YourName]\AppData\Local\Programs\Microsoft VS Code) - Add this to PATH in System Environment Variables
- Find VS Code location (usually
macOS Fix:
- Open VS Code
- Press
Cmd + Shift + P - Type “Shell Command: Install ‘code’ command in PATH”
- Select it and press Enter
Linux Fix:
- The code command should be automatically available
- If not, reinstall using the Snap method:
sudo snap install code --classic
Problem 2: Extensions Won’t Install
“Error while installing extension” message
Fix:
- Check your internet connection
- Try installing from command line:
Ctrl + P(orCmd + Pon Mac)- Type:
ext install [extension-name]
- Disable antivirus temporarily
- Clear extension cache:
- Close VS Code
- Delete
%USERPROFILE%\.vscode\extensionsfolder (Windows) - Delete
~/.vscode/extensions(macOS/Linux)
Problem 3: Java Extension Pack Not Working
Red squiggly lines everywhere, no code completion
Fix:
- Check Java is installed: Open terminal and type
java -version - If not installed, download from Adoptium
- Set JAVA_HOME environment variable (see Method 3 above)
- In VS Code, press
Ctrl + Shift + P - Type “Java: Clean Java Language Server Workspace”
- Select and confirm to restart
Problem 4: Format on Save Not Working
Code doesn’t auto-format when saving
Fix:
- Check Prettier is installed (see Extensions)
- Check “Format On Save” is enabled in Settings
- Make sure no other formatter is conflicting:
- Open Settings
- Search: “default formatter”
- Ensure “Prettier” is selected
- For specific file types, add this to settings.json:
"[javascript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
Problem 5: VS Code Running Very Slow
Laggy performance, high CPU usage
Fix:
- Disable unused extensions:
- Go to Extensions view
- Right-click unused extensions → Disable
- Exclude large folders from search:
- Open Settings
- Search “files exclude”
- Add patterns like:
**/node_modules,**/.git
- Disable hardware acceleration:
- Open Command Palette
- Type “Preferences: Configure Runtime Arguments”
- Add:
"disable-hardware-acceleration": true
Problem 6: “Cannot find module” Errors
Red line under imports, module not found
Fix:
- Open the folder containing your project files (not just a single file)
- File → Open Folder
- If Node.js project: Delete
node_modulesfolder and runnpm installin terminal - If Java project: Right-click project folder and select “Add Folder to Java Source Path”
Problem 7: Terminal Not Opening
Terminal panel is blank or shows error
Windows Fix:
- Press
Ctrl + Shift + P - Type “Terminal: Select Default Profile”
- Choose “Command Prompt” or “PowerShell”
- If neither works, choose “Git Bash” (if installed)
macOS Fix:
- Default should be zsh
- If broken, select Terminal: Select Default Profile → bash
Linux Fix:
- Select appropriate shell (bash, zsh, fish)
- Ensure terminal permissions are correct
Problem 8: Red Error: “The language server crashed”
Usually affects Java, Python, or C++
Fix:
- Restart VS Code completely
- If persists, clean the workspace:
- Open Command Palette
- Type “[Language]: Clean Language Server Workspace”
- Example: “Java: Clean Java Language Server Workspace”
- Check system requirements (some language servers need specific versions)
Still Having Problems?
Quick Checklist:
- VS Code is latest version (Help → Check for Updates)
- Computer meets minimum requirements
- Internet connection is stable
- Correct project folder is open
- JAVA_HOME/other paths are set correctly
- VS Code restarted after changes
Get Help:
- Visit VS Code GitHub Issues
- Search Stack Overflow
- Check VS Code Documentation
Quick Reference: Keyboard Shortcuts
| Action | Windows/Linux | macOS |
|---|---|---|
| Open Settings | Ctrl + , | Cmd + , |
| Command Palette | Ctrl + Shift + P | Cmd + Shift + P |
| Extensions | Ctrl + Shift + X | Cmd + Shift + X |
| Terminal | Ctrl + ` | Cmd + ` |
| Quick File Open | Ctrl + P | Cmd + P |
| Save File | Ctrl + S | Cmd + S |
| Search Files | Ctrl + Shift + F | Cmd + Shift + F |
This guide should help you get started with VS Code. Remember, practice makes perfect—don’t worry if things seem confusing at first. Happy coding! 🚀
Subscribe & Follow
Get notified of new technical articles on AI/ML, Java, Python, and system architecture.