user1315621
user1315621

Reputation: 3412

Install Colorls on macOS and zsh

I want to install Colorls. I am completely new to Ruby. To install Colorls I executed:

gem install colorls --user-install

After I while (maybe after I installed Anaconda) Colorls is not working anymore. zsh: command not found: colorls

Here's some info:

RubyGems Environment:
  - RUBYGEMS VERSION: 3.0.2
  - RUBY VERSION: 2.6.1 (2019-01-30 patchlevel 33) [x86_64-darwin18]
  - INSTALLATION DIRECTORY: /usr/local/lib/ruby/gems/2.6.0
  - USER INSTALLATION DIRECTORY: /Users/matteo/.gem/ruby/2.6.0
  - RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/2.6.0/bin
  - SPEC CACHE DIRECTORY: /Users/matteo/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /usr/local/Cellar/ruby/2.6.1/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-18
  - GEM PATHS:
     - /usr/local/lib/ruby/gems/2.6.0
     - /Users/matteo/.gem/ruby/2.6.0
     - /usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0
     - /Users/matteo/.gem/ruby/2.6.0
     - /usr/local/lib/ruby/gems/2.6.0
     - /usr/local/lib/ruby/gems/2.6.0
     - /usr/local/opt/ruby/bin
     - /Users/matteo/bin
     - /usr/local/bin
     - /sbin
     - /usr/sbin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Library/TeX/texbin

Upvotes: 0

Views: 15637

Answers (2)

Dr Neo
Dr Neo

Reputation: 824

I always forget how to install colorls when I reformat my Mac. I have:

  • macOS Catalina Version 10.15.7 (don't miss with the preinstalled ruby)

I follow these steps:

Step -1-

Install ruby using homebrew

brew install ruby

Step -2-

Go to the directory

cd /usr/local/Celler/ruby/<x.x.x>/bin
# Or for ARM Mac I use here 3.1.1 that comes with brew install ruby
cd /opt/homebrew/Cellar/ruby/3.1.1/bin
# Then 
./gem install colorls 

my version is (3.0.1)

Step -3-

Now you are ready to link this library to the default one you installed before (following the GitHub repo steps of the colorls)

ln -s /usr/local/lib/ruby/gems/x.x.x/bin/colorls /usr/local/bin/colorls

# or for ARM Mac I use here gem 3.1.0
ln -s /opt/homebrew/lib/ruby/gems/3.1.0/bin/colorls /usr/local/bin/colorls

Hint: if you find any other colorls in the directory prior to executing the link command just remove it. now check:

enter image description here

Upvotes: 3

lacostenycoder
lacostenycoder

Reputation: 11226

Is it possible your ruby version doesn't match gem version? Seems like minor version in

/usr/local/Cellar/ruby/2.6.1/lib/ruby/gems/2.6.0

Make sure you still have the gem installed:

which colorls

#should output something like:  /Users/yourusername/.rvm/gems/ruby-2.6.0/bin/colorls

See if the gem is indeed installed

gem list colorls

Then maybe try reinstall see https://github.com/athityakumar/colorls#install

You might wanna use a version manager, I recommend RVM see https://rvm.io/rvm/install

Upvotes: 2

Related Questions