colorls: zsh: command not found: colorls

Description

After running gem install colorls I get this message:

 *******************************************************************
    Changes introduced in colorls

    Sort by dirs  : -sd flag has been renamed to --sd
    Sort by files : -sf flag has been renamed to --sf
    Git status    : -gs flag has been renamed to --gs

    Clubbed flags : `colorls -ald` works
    Help menu     : `colorls -h` provides all possible flag options

    Tab completion enabled for flags

    -t flag : Previously short for --tree, has been re-allocated to sort results by time
    -r flag : Previously short for --report, has been re-allocated to reverse sort results

    Man pages have been added. Checkout `man colorls`.

  *******************************************************************
Successfully installed colorls-1.1.1
Parsing documentation for colorls-1.1.1
Done installing documentation for colorls after 0 seconds
1 gem installed

Which looks fine and dandy but when I try to run something like colorls -lA I get

zsh: command not found: colorls

which ruby: /usr/local/opt/ruby/bin/ruby ruby --version: ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin18]

  • Relevant Issues : (none)
  • Relevant PRs : (none)
  • Type of issue :
    • [ X] Installation
    • Font-related
    • Feature request
    • Bug in existing feature
    • Developer mode : Code quality / Tests / Documentation

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 21

Most upvoted comments

@aimuch as I already said, you need to ensure your shell is able to find the colorls script. You should add the Gem.bindir directory to your PATH environment variable in order to run scripts from any installed gem.

Look at the output of gem environment. The directory mentioned in EXECUTABLE DIRECTORY should be also listed in SHELL PATH.

Add this to your shell init file:

PATH=$PATH:$(ruby -e 'puts Gem.bindir')

source $(dirname $(gem which colorls))/tab_complete.sh

That is only loading the completions support.

In order to run commands from installed Ruby gems, you need to add the bin path of your gem folder to the PATH.

For Zsh:

path+=(
    $(ruby -e 'puts File.join(Gem.user_dir, "bin")')
)

@aimuch as I already said, you need to ensure your shell is able to find the colorls script. You should add the Gem.bindir directory to your PATH environment variable in order to run scripts from any installed gem. Look at the output of gem environment. The directory mentioned in EXECUTABLE DIRECTORY should be also listed in SHELL PATH. Add this to your shell init file:

PATH=$PATH:$(ruby -e 'puts Gem.bindir')

Thanks for your reply, but the script did not work for me(Every time open a new session, it need to source ~/.zshrc to reload colorls ). So, I have been changed it to

echo $(ruby -e 'puts Gem.bindir')
/usr/local/lib/ruby/gems/2.6.0/bin

PATH=$PATH:/usr/local/lib/ruby/gems/2.6.0/bin

Same problem. fixed with PATH=$(ruby -e 'puts Gem.bindir'):$PATH

@aimuch as I already said, you need to ensure your shell is able to find the colorls script. You should add the Gem.bindir directory to your PATH environment variable in order to run scripts from any installed gem.

Look at the output of gem environment. The directory mentioned in EXECUTABLE DIRECTORY should be also listed in SHELL PATH.

Add this to your shell init file:

PATH=$PATH:$(ruby -e 'puts Gem.bindir')

Thanks for your reply, but the script did not work for me(Every time open a new session, it need to source ~/.zshrc to reload colorls ). So, I have been changed it to

echo $(ruby -e 'puts Gem.bindir')
/usr/local/lib/ruby/gems/2.6.0/bin

PATH=$PATH:/usr/local/lib/ruby/gems/2.6.0/bin

@aimuch as I already said, you need to ensure your shell is able to find the colorls script. You should add the Gem.bindir directory to your PATH environment variable in order to run scripts from any installed gem.

Look at the output of gem environment. The directory mentioned in EXECUTABLE DIRECTORY should be also listed in SHELL PATH.

Add this to your shell init file:

PATH=$PATH:$(ruby -e 'puts Gem.bindir')

this one works fine try it

@aimuch as I already said, you need to ensure your shell is able to find the colorls script. You should add the Gem.bindir directory to your PATH environment variable in order to run scripts from any installed gem.

Look at the output of gem environment. The directory mentioned in EXECUTABLE DIRECTORY should be also listed in SHELL PATH.

Add this to your shell init file:

PATH=$PATH:$(ruby -e 'puts Gem.bindir')

Thanks,I solved this problem.This is my solution. Edit ~/.zshrc and add the following line: export PATH=$PATH:$(ruby -e 'puts Gem.bindir') Then,source ~/.zshrc and colorls can work.

This happened to me after upgrading MacOS to Catalina. Didn’t try any fix so far, don’t like to mess up with gems/ruby.