Search code examples
gclouditerm2

gcloud sdk in mac terminal - backspace does not work


Mac 10.14.6 iTerm2 Build 3.4.8 Google Cloud SDK 351.0.0 beta 2021.07.30 bq 2.0.70 core 2021.07.30 gsutil 4.66

Logging in to my virtual gcloud server without errors with: gcloud compute ssh myserver

However, the backspace key in the terminal registers as a space key.

Tried exactly the same with the stock Mac terminal, the same behaviour.

What gives?


Solution

  • The backspace key will often seem to register as a space key if the environment variable TERM is not set to a value that is defined in your terminfo configuration.

    You can check the value of TERM by running:

    echo $TERM
    

    terminfo can be configured in several places, but on Google Compute Engine it is likely using the values from /lib/terminfo. (Other possibilities include $HOME/.terminfo and /usr/share/terminfo.) You can check if your current setting for TERM corresponds to a file in this directory by running:

    find /lib/terminfo -name $TERM
    

    If the value is present, you will see something like /lib/terminfo/s/screen-256color. If it is not present, you will not see any output.

    You can fix the problem by ensuring that your TERM environment variable is set to one of the files defined in terminfo.