Skip to content

Shell prompt lag in macOS #318

@apas

Description

@apas

Longtime user and fan of z.sh. After many attempts to no avail at debugging the following, I'm opening this issue for discussion.

I'm running two machines, a macOS (local) and an Ubuntu (remote,) with the same dotfiles and shell configuration. Both are running the same version of bash (5.1.16(1).) Both shells are interactive login shells. And yet, when z.sh is sourced, the macOS shell prompt experiences a short but highly noticeable lag on each Return press, while the Ubuntu prompt is rendered instantly.

I was wondering if anyone else is experiencing the same issue (or similar) and how to fix — if possible.

Shell environment settings: (also available in my repo)

  • ~/.bash_profile which sources three different bash files where .shell/utils.sh is relevant for our case
  • ~/.shell/utils which exports PROMPT_COMMAND with history -a and at the end of the file sources z.sh from a specific directory:
export PROMPT_COMMAND="history -a"
# other lines...
# point to and source z in order to track and build dir list
. $HOME/.bin/z.sh
  • No other changes to PROMPT_COMMAND or other shell configurations occur at the shell level after sourcing z.sh above.

As such, the PROMPT_COMMAND reads: history -a (_z --add "$(command pwd -P 2>/dev/null)" 2>/dev/null &);

$HOME/.bin/z.sh reflects the latest version from the master brach.

This has been also tested on a fresh macOS virtual machine with the same results.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions