How to open cursor from terminal

It works for me. Thanks

thank you it was helpful

1 Like

this works and i have also been trying to run it in the background using & or nohup but hard luck it closes when i close the terminal

cursor() {
    /opt/cursor.AppImage --no-sandbox "$@" &
}
cursor() {
    nohup /opt/cursor.AppImage --no-sandbox "$@" > /dev/null 2>&1 &
}
1 Like

this is not okay. i’m paying for pro (edit: paid), and it works on Mac, but the install script to get the majorly useful CLI command still fails in Linux and is not available in the command palette. I guess Linux simply isn’t supported. And no, I’m not hacking around to get something working when I’m paying money for it…

1 Like

Just for other people coming here, this is my final version (so far). This allows me to run the cursor command without seeing any output, and be able to close the terminal without exiting cursor. The extra parenthesis launches it in a subshell, suppressing the output from nohup

cursor() {
  # Run the cursor command and suppress background process output completely
  (nohup cursor "$@" >/dev/null 2>&1 &)
}
1 Like

function cursor() {
open -a ‘Cursor’ $@
}
works fine for me

ubuntu

Yep. A workaround its to add to your ‘.bashrc’ an alias.
alias cursor='~/Desktop/Cursor.AppImage'
obs: and maybe you will have to use the no sandbox flag --no-sandbox

Thanks dude, also your solution worked perfectly on ubuntu 24 @mvavassori

Check. :ok_hand:t2::ok_hand:

I work for a company where we want to roll out cursor but our machines don’t have admin privileges which means we can’t run OSAScript commands.

OSAScript is super outdated anyways is there another way of installing the cursor command without needing admin permissions or manually adding a bash script?

1 Like

cc @danperks

Hey, I’ll pass this to the team, but I don’t believe there is a way to install the Cursor shell command without having admin, or doing some manual work to install the shell command right now!

1 Like

Thank you!

./Cursor.AppImage should suffice?

This is the best so far in Ubuntu, zshrc

nano ~/.zshrc

Then paste this to the end of the line

cursor() {
  ( nohup /home/yourusername/yourpathto/cursor.AppImage --no-sandbox "$@" >/dev/>
}

nohup make sure it wont kill if the opening terminal be killed
dev/null make sure of clean log

then

source ~/.zshrc

it may open cursor for the first time

then close terminal and open a new terminal session.

You can try:

cursor .
cursor something.py

In Fedora Workstation 40, I just added this to my .zshrc file:

cursor() {
  (nohup /opt/cursor.appimage --no-sandbox "$@" >/dev/null 2>&1 &)
}
1 Like

NOte: i have been back adn forth with AI to fix this problem. The following is written by gemini but I followed, it works and I believe more resilient than any of the answers above.


For anyone on Ubuntu or other Linux distributions, here is a resilient method to launch Cursor from the terminal. This setup automatically finds the latest version of the AppImage, so you don’t need to edit a script every time Cursor updates.

Step 1: Organize Your AppImage

Create a dedicated directory for your applications and move your Cursor AppImage into it. This keeps your home directory clean and makes the script simpler.

mkdir -p ~/Applications
mv ~/Cursor-*.AppImage ~/Applications/

Step 2: Create a Launcher Script

This script will find and run the latest version of Cursor.

  1. Create the script file:

    touch ~/.local/bin/cursor-launcher.sh
    nano ~/.local/bin/cursor-launcher.sh
    
  2. Paste the following code into the file:

    #!/bin/bash
    
    # Directory where your Cursor AppImages are stored.
    APPIMAGE_DIR="$HOME/Applications"
    
    # Find the newest Cursor AppImage file.
    LATEST_APPIMAGE=$(find "$APPIMAGE_DIR" -name "Cursor-*.AppImage" -type f | sort -V | tail -n 1)
    
    # Exit if no AppImage is found.
    if [ -z "$LATEST_APPIMAGE" ]; then
      echo "Error: No Cursor AppImage found in $APPIMAGE_DIR" >&2
      exit 1
    fi
    
    # Make the AppImage executable if it isn't.
    if [ ! -x "$LATEST_APPIMAGE" ]; then
      chmod +x "$LATEST_APPIMAGE"
    fi
    
    # Launch Cursor in the background, detached from the terminal.
    # The --no-sandbox flag is often required for AppImages.
    (nohup "$LATEST_APPIMAGE" --no-sandbox "$@" >/dev/null 2>&1 &)
    

Step 3: Make the Script Executable

chmod +x ~/.local/bin/cursor-launcher.sh

Step 4: Create a Shell Function

Add a function to your shell’s configuration file to call the launcher. This works better than an alias for passing arguments.

  1. Open your config file (use .bashrc for Bash or .zshrc for Zsh):

    # For Zsh users
    nano ~/.zshrc
    
    # For Bash users
    nano ~/.bashrc
    
  2. Add this function to the end of the file:

    cursor() {
      ~/.local/bin/cursor-launcher.sh "$@"
    }
    

    (Optional: If you want a shorter alias like k, also add alias k=cursor right below the function).

Step 5: Reload Your Shell

Apply the changes to your current terminal session.

# For Zsh users
source ~/.zshrc

# For Bash users
source ~/.bashrc

Usage

You can now open Cursor from any new terminal:

# Open the current folder
cursor .

# Open a specific file
cursor my_project/README.md

# If you added the alias 'k'
k .

If people use Fish, I made a gist for a Fish function to launch cursor: Fish Shell function to launch Cursor AI editor · GitHub

After some trial and error here is what I used to get cursor to launch AS A NORMAL ***** APP on Ubuntu 22.04 (Jammy Jellyfish). Should work for all subsequent versions.

I kept running into xdg-open: unexpected option '-a' with this solution.

Adding disown removes the job from the shell’s job table, so you won’t see job control messages like [1]+ Done when the process exits, and the shell won’t wait for the background job when exiting.

function cursor {
    if [[ $# = 0 ]]
    then
        nohup ~/Applications/Cursor-1.2.2-x86_64.AppImage >/dev/null 2>&1 &
        disown
    else
        local argPath="$1"
        [[ $1 = /* ]] && argPath="$1" || argPath="$PWD/${1#./}"
        nohup ~/Applications/Cursor-1.2.2-x86_64.AppImage "$argPath" >/dev/null 2>&1 &
        disown
    fi
}

Hope this helps someone

On Ubuntu, I got Cursor AppImage working from the terminal with line/column support.

If you’re using zsh, add this to your ~/.zshrc:

# ~/.zshrc

function cursor() { 
  /<your-path-to-curosr>/cursor.appimage --no-sandbox -g $@
}

The -g flag tells Cursor to correctly interpret file:line[:column] (e.g. login.tsx:41:34).

Then reload your config:

source ~/.zshrc

:white_check_mark: Now you can do:

cursor index.tsx:120
cursor login.tsx:41:34

and Cursor will jump directly to the specified line (and column).