How to fix the 'zsh: command not found: code' error in macOS Terminal

The quickest way to open a directory in VS Code is to use the `code` command in the Terminal. However, if its not configured correctly, you might encounter the error `zsh: command not Found: code`.

The quickest way to open a folder in VS Code is to use the `code` command in the Terminal. However, if not configured correctly, you might encounter the error "zsh: command not Found: code". Follow these two steps to resolve the issue.

 

1. Reinstall Visual Studio Code

Typically, the recommended way to install software on a Mac is through the App Store. However, since VS Code is not available on the App Store, downloading it from the official Visual Studio Code website is your only option.

Even after doing that, you still can't run the application from the Downloads folder in macOS. So, make sure you move the executable file to the Applications folder instead.

2. Install the code command for the PATH variable.

After moving VS Code to the Applications folder, you must add the command to your PATH variables. Once the command is in the PATH environment variable, you can run it from the Terminal application in macOS.

Fortunately, you don't need to use the command line to do that. VS Code provides a one-click solution to add commands to your PATH variables by doing the following:

1. Open VS Code on your Mac.

2. Press Cmd + Shift + P to open the Command Palette.

3. Now, type Shell Command . From the results displayed, select Install 'code' command in PATH .

 

4. Next, VS Code will ask for permission to install the code command. Select OK .

5. Enter your Mac's admin password at the next prompt and press OK .

Once complete, the "Shell command 'code' successfully installed in PATH" dialog box will appear. Now, even if you don't know how to use Mac Terminal, you can quickly open a folder in macOS using the code command. Simply open Terminal on your Mac and navigate to the folder using the `cd` command . Once you are in the folder of interest, type " code . " in Terminal and press Return (or Enter ).

As one of the best free code editors, VS Code offers many features that make software development and debugging easy. If you prefer using the Terminal to navigate your file system, the `code` command will help you easily open the current directory in the editor.

Related posts
Other Mac OS System software articles
Category

System

Windows XP

Windows Server 2012

Windows 8

Windows 7

Windows 10

Wifi tips

Virus Removal - Spyware

Speed ​​up the computer

Server

Security solution

Mail Server

LAN - WAN

Ghost - Install Win

Fix computer error

Configure Router Switch

Computer wallpaper

Computer security

Mac OS X

Mac OS System software

Mac OS Security

Mac OS Office application

Mac OS Email Management

Mac OS Data - File

Mac hardware

Hardware

USB - Flash Drive

Speaker headset

Printer

PC hardware

Network equipment

Laptop hardware

Computer components

Advice Computer

Game

PC game

Online game

Mobile Game

Pokemon GO

information

Technology story

Technology comments

Quiz technology

New technology

British talent technology

Attack the network

Artificial intelligence

Technology

Smart watches

Raspberry Pi

Linux

Camera

Basic knowledge

Banking services

SEO tips

Science

Strange story

Space Science

Scientific invention

Science Story

Science photo

Science and technology

Medicine

Health Care

Fun science

Environment

Discover science

Discover nature

Archeology

Life

Travel Experience

Tips

Raise up child

Make up

Life skills

Home Care

Entertainment

DIY Handmade

Cuisine

Christmas

Application

Web Email

Website - Blog

Web browser

Support Download - Upload

Software conversion

Social Network

Simulator software

Online payment

Office information

Music Software

Map and Positioning

Installation - Uninstall

Graphic design

Free - Discount

Email reader

Edit video

Edit photo

Compress and Decompress

Chat, Text, Call

Archive - Share

Electric

Water heater

Washing machine

Television

Machine tool

Fridge

Fans

Air conditioning

Program

Unix and Linux

SQL Server

SQL

Python

Programming C

PHP

NodeJS

MongoDB

jQuery

JavaScript

HTTP

HTML

Git

Database

Data structure and algorithm

CSS and CSS3

C ++

C #

AngularJS

Mobile

Wallpapers and Ringtones

Tricks application

Take and process photos

Storage - Sync

Security and Virus Removal

Personalized

Online Social Network

Map

Manage and edit Video

Data

Chat - Call - Text

Browser and Add-on

Basic setup