How to open cursor from terminal

Dear all,

I’m new to Cursor IDE. Could anyone here teach me how to open Cursor IDE from terminal such as the way to often do when using VSCode "open terminal → cd to folder → typing ‘code .’ ". Is there the same way for Cursor?

4 Likes

I have the same issue that this feature fails during installation.

3 Likes

You need to run the Shell Command: Install 'cursor' command command from the Command Palette in Cursor.

4 Likes

not available on ubuntu is it normal?

1 Like

Hey! Not an official answer, but I managed to get it working by creating a function in .bashrc or .zshrc that points to the .AppImage (I create a function instead of an alias in order to use arguments). I did it as follows:

On zsh:

function cursor {
        /home/user/path_to_appimage/Cursor.AppImage $@
}

On bash:

cursor() {
    /home/user/path_to_appimage/Cursor.AppImage "$@"
}

So far I have encountered no issues, since it works as the code command. For example, cursor . opens a window in the current directory or cursor file_1 file_2 file_3 opens all three files.

4 Likes

This doesn’t work in some of the windows terminals however. For example, my default terminal is GitBash and the command is unrecognized there where vscode works fine.

Thanks! I was able to get this to work on Mac by adding this to ~/.zshrc

function cursor {
  open -a "/Applications/Cursor.app" "$@"
}

With your solution it kept sending messages such as the PID number and other annoying info when i’d close the app. With this slight alteration i don’t see any weird messages in the terminal:

function cursor {
  (nohup /path/to/cursor.appimage "$@" > /dev/null 2>&1 &)
}

(I’m on Ubuntu)

2 Likes

Open Your Cursor App

CMD(Ctrl) + Shift + P

Shell Command :Install Cursor command

3 Likes

Worked like a charm. Thanks

On Ubuntu 24.04: option to add code or cursor command fails during setup, and there’s no shell command in command palette.

3 Likes

confirming this :point_up:

Hey there, I’ve implemented this workaround in Pop Os which is a distro based on Ubuntu. I’m using zsh so it would be like this:

nano $HOME/.zshrc

function cursor() {
    /home/<your_username>/<path_to_appimage> </dev/null &>/dev/null $1 &
}

source $HOME/.zshrc

Usage:

cursor <your_file_or_folder>

Hope it works for you guys :slight_smile:

On Ubuntu 22.04.5 LTS this option is not available.

After you run this shell command… then what?

Added this to Ubuntu bashrc file

sudo nano ~/.bashrc

function cursor {
    if [[ $# = 0 ]]
    then
        open -a "Cursor"
    else
        local argPath="$1"
        [[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
        open -a "Cursor" "$argPath"
    fi
}

Load the changes

source ~/.bashrc

I suspect this should with zsh as well

In Ubuntu just do this:

  1. Run:
    find ~/ -name “*.AppImage”
    and copy the cursor path

  2. Open .zshrc file and paste this:
    function cursor {
    /home/madhavmadupu/Applications/cursor-0.40.3x86_64_0624b665a8721425564eff1bb6c8cc88.AppImage $@
    }

  3. Done!

In my case (macOS), I just ran:

CMD + Shift + P

Shell Command :Install Cursor command

After that, navigate to your folder in the terminal and run cursor .

1 Like

After that, navigate to your folder in the terminal and run cursor . (macOS)