# How to prevent the "code . " command in the terminal from opening Cursor

**URL:** <https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983>\
**Category:** Bug Reports\
**Created:** [December 7, 2023, 5:53pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983 "2023-12-07T17:53:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![marektchas](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/marektchas/32/851_2.png) [@marektchas](https://forum.cursor.com/u/marektchas)\
**Post date:** [December 7, 2023, 5:53pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/1 "2023-12-07T17:53:48Z")

</div>

Hi. I’ve been using Cursor for a while now and it’s really great.

One thing that really irritates me, however, is the fact that after installing Cursor, when I run the " **code .**" command in the terminal, instead of launching my default VSC editor, Cursor is launched.

How do I get VSC back to opening on this command? Cursor is great, but I still want to leave **"code .**" for VSCode.

---

<div class="post-metadata">

**Author:** ![Jakob](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jakob/32/93_2.png) [@Jakob](https://forum.cursor.com/u/Jakob)\
**Post date:** [December 7, 2023, 5:55pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/2 "2023-12-07T17:55:25Z")

</div>

You need to reinstall the “code” command from normal VSCode so that it overrides it again.

> **[Running Visual Studio Code on macOS](https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line)**
>
> Get Visual Studio Code up and running on Mac (macOS).

---

<div class="post-metadata">

**Author:** ![marektchas](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/marektchas/32/851_2.png) [@marektchas](https://forum.cursor.com/u/marektchas)\
**Post date:** [December 7, 2023, 7:25pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/3 "2023-12-07T19:25:42Z")

</div>

Weird, but I can’t see this command. But isn’t this instruction only for macOS? I am working on windows

 ![image](https://us1.discourse-cdn.com/cursor1/original/1X/be34975d61a0385e6cdfe9024e1028f140f5f830.png)

---

<div class="post-metadata">

**Author:** ![Jakob](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/jakob/32/93_2.png) [@Jakob](https://forum.cursor.com/u/Jakob)\
**Post date:** [December 9, 2023, 4:00pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/4 "2023-12-09T16:00:09Z")

</div>

Hmm. You should also get the option to install the “code” command when running the VSC installer.

---

<div class="post-metadata">

**Author:** ![ubergonmx](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/ubergonmx/32/1302_2.png) [@ubergonmx](https://forum.cursor.com/u/ubergonmx)\
**Post date:** [February 19, 2024, 12:14am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/5 "2024-02-19T00:14:15Z")

</div>

If you’re in Windows, open Run (Win+R) and type:  
`%localappdata%\Programs\cursor\resources\app\bin`

Delete two files:

- code
- code.cmd

I hope this helped.

---

<div class="post-metadata">

**Author:** ![beduffy](https://avatars.discourse-cdn.com/v4/letter/b/ecb155/32.png) [@beduffy](https://forum.cursor.com/u/beduffy)\
**Post date:** [April 5, 2024, 1:24pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/6 "2024-04-05T13:24:12Z")

</div>

I have the same problem. Not sure if I should reinstall the Appimage by deleting it or something else

---

<div class="post-metadata">

**Author:** ![Daenus](https://avatars.discourse-cdn.com/v4/letter/d/85e7bf/32.png) [@Daenus](https://forum.cursor.com/u/Daenus)\
**Post date:** [April 28, 2024, 9:47pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/7 "2024-04-28T21:47:18Z")

</div>

> [@ubergonmx](#):
>
> If you’re in Windows, open Run (Win+R) and type:  
> `%localappdata%\Programs\cursor\resources\app\bin`
> 
> Delete two files:
> 
> - code
> - code.cmd
> 
> I hope this helped.

This solved the problem for me.

My issue was that after installing Cursor in Windows, the “code” command in WSL2 stopped working.

The error message was “Unable to determine app path from symlink : /mnt/c/Users/Ivan/AppData/Local/Programs/cursor/resources/app/bin/code”

After deleting the 2 files and launching “code” in wsl2, VSCode started installing itself again.

---

<div class="post-metadata">

**Author:** ![rrandrews](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/rrandrews/32/2216_2.png) [@rrandrews](https://forum.cursor.com/u/rrandrews)\
**Post date:** [June 5, 2024, 4:37am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/8 "2024-06-05T04:37:08Z")

</div>

This is so obnoxious. Just highlights the fact that there is no reason this shouldn’t be an VS code extension rather than piggybacking on top of Code breaking things left and right.

---

<div class="post-metadata">

**Author:** ![machin1st](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/machin1st/32/4019_2.png) [@machin1st](https://forum.cursor.com/u/machin1st)\
**Post date:** [September 3, 2024, 1:45pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/9 "2024-09-03T13:45:50Z")

</div>

Worked. And a note to the devs, this intrusive behavior is only irritating and makes me look harder for other tools.

---

<div class="post-metadata">

**Author:** ![gyurisc](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/gyurisc/32/4966_2.png) [@gyurisc](https://forum.cursor.com/u/gyurisc)\
**Post date:** [September 16, 2024, 10:44am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/10 "2024-09-16T10:44:54Z")

</div>

My solution for this was to rename the code command to cur.

I also added the VS Code folder to the system path before Cursor, just in case.

---

<div class="post-metadata">

**Author:** ![hdou533](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/hdou533/32/5358_2.png) [@hdou533](https://forum.cursor.com/u/hdou533)\
**Post date:** [September 19, 2024, 3:39am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/11 "2024-09-19T03:39:51Z")

</div>

It works for me. Thanks!

---

<div class="post-metadata">

**Author:** ![garvitj2003](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/garvitj2003/32/7141_2.png) [@garvitj2003](https://forum.cursor.com/u/garvitj2003)\
**Post date:** [October 3, 2024, 10:50am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/12 "2024-10-03T10:50:30Z")

</div>

If you’re in Windows, open Run (Win+R) and type:  
`%localappdata%\Programs\cursor\resources\app\bin`

Delete two files:

- code
- code.cmd

I hope this helped.

# Note -

- If you are deleting above files make sure you will re-start the terminal cause it will still look the same path for code command and give the error that code is not found in \Programs\cursor\resources\app\bin.

- the above step helps you delete the over written file written by cursor to open it using terminal command “code” which was for vs code.

- now to open any directory in-

### cursor -

`cursor _dirname`

### VScode -

`code _dirname`

---

<div class="post-metadata">

**Author:** ![vchrombie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/vchrombie/32/9084_2.png) [@vchrombie](https://forum.cursor.com/u/vchrombie)\
**Post date:** [October 19, 2024, 7:41pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/13 "2024-10-19T19:41:09Z")

</div>

Faced this issue on Mac OS. The cursor application overrides the `code` command and the only way to revert this is delete the `code` script (`rm /usr/local/bin/code`) and install ‘code’ command in PATH.

Alternatively you can edit the `code` script (`nano /usr/local/bin/code`).

```diff
-	REMOTE_CLI="$(which -a 'cursor' | grep /remote-cli/)"
+	REMOTE_CLI="$(which -a 'code' | grep /remote-cli/)"

- ELECTRON="$CONTENTS/MacOS/Cursor"
+ ELECTRON="$CONTENTS/MacOS/Electron"

```

This way, `cursor` would run cursor application and `code` runs vs code.

---

<div class="post-metadata">

**Author:** ![YasserMuhamed](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/yassermuhamed/32/11024_2.png) [@YasserMuhamed](https://forum.cursor.com/u/YasserMuhamed)\
**Post date:** [November 7, 2024, 4:03am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/14 "2024-11-07T04:03:48Z")

</div>

works for me, thank you 🙂

---

<div class="post-metadata">

**Author:** ![TechPreacher](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/techpreacher/32/11442_2.png) [@TechPreacher](https://forum.cursor.com/u/TechPreacher)\
**Post date:** [November 11, 2024, 8:50am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/15 "2024-11-11T08:50:21Z")

</div>

No need to delete anything on Windows, just make sure the path to VS Code is set before the path to Cursor. That’s all that’s needed to make this work.

---

<div class="post-metadata">

**Author:** ![ed1432](https://avatars.discourse-cdn.com/v4/letter/e/c67d28/32.png) [@ed1432](https://forum.cursor.com/u/ed1432)\
**Post date:** [November 12, 2024, 2:09am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/16 "2024-11-12T02:09:08Z")

</div>

Thanks for sharing. Alternatively, renaming the files to code\_old and code\_old.cmd seems to work too.

---

<div class="post-metadata">

**Author:** ![myersd08](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/myersd08/32/11646_2.png) [@myersd08](https://forum.cursor.com/u/myersd08)\
**Post date:** [November 13, 2024, 12:35am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/17 "2024-11-13T00:35:17Z")

</div>

using windows, and the suggestion to delete the 2 files worked!

until it came back…

I have a feeling this has to do with cursor updates? I actually uninstalled cursor, rebooted and installed. It never asked me (like the first time) if I wanted to use “code” to open cursor and those files showed up upon the fresh install. Any suggestions? Where does the choice to use “code” to open cursor get stored during install?

---

<div class="post-metadata">

**Author:** ![rpetersson](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/rpetersson/32/13262_2.png) [@rpetersson](https://forum.cursor.com/u/rpetersson)\
**Post date:** [November 26, 2024, 11:46am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/18 "2024-11-26T11:46:21Z")

</div>

Signed up just to say intrusive behavior like this will never make me use your product.

---

<div class="post-metadata">

**Author:** ![deanrie](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/deanrie/32/1263_2.png) [@deanrie](https://forum.cursor.com/u/deanrie)\
**Post date:** [November 26, 2024, 11:47am UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/19 "2024-11-26T11:47:34Z")

</div>

Hey, I don’t think this is intentional. You can install both commands, but for VSCode, install it directly from there, and for Cursor, install it directly from Cursor.

---

<div class="post-metadata">

**Author:** ![eana](https://sea3.discourse-cdn.com/cursor1/user_avatar/forum.cursor.com/eana/32/17800_2.png) [@eana](https://forum.cursor.com/u/eana)\
**Post date:** [December 29, 2024, 7:53pm UTC](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983/21 "2024-12-29T19:53:54Z")

</div>

Since Curosr keeps re-adds `code.cmd` into the folder. A better way to solve this is to ensure VSCode takes higher priority in the `PATH` environment variable than Cursor.

[Next page](https://forum.cursor.com/t/how-to-prevent-the-code-command-in-the-terminal-from-opening-cursor/1983.md?page=2)
