Score:4

How do I install "colorls" on Ubuntu?

bd flag

I would like to install colorls . It looks handy:

Screenshot

I tried to follow the installation instructions. However, they don't seem to be made for Ubuntu.

First, because gem did not exist, I had to run sudo apt install ruby-rubygems .

Now, I experience this error when I try to install it:

$ gem install colorls
Fetching colorls-1.4.6.gem
...
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /var/lib/gems/3.0.0 directory.

So I try using the --user-install flag:

$ gem install --user-install colorls
WARNING:  You don't have /home/flimm/.local/share/gem/ruby/3.0.0/bin in your PATH,
      gem executables will not run.
Successfully installed unicode-display_width-2.4.2
Successfully installed rainbow-3.1.1
Successfully installed manpages-0.6.1
Successfully installed filesize-0.2.0
Building native extensions. This could take a while...
ERROR:  Error installing colorls:
    ERROR: Failed to build gem native extension.

    current directory: /home/flimm/.local/share/gem/ruby/3.0.0/gems/clocale-0.0.4/ext/clocale
/usr/bin/ruby3.0 -I /usr/lib/ruby/vendor_ruby -r ./siteconf20230407-19626-voy41j.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /home/flimm/.local/share/gem/ruby/3.0.0/gems/clocale-0.0.4 for inspection.
Results logged to /home/flimm/.local/share/gem/ruby/3.0.0/extensions/x86_64-linux/3.0.0/clocale-0.0.4/gem_make.out

How do I install (and uninstall) colorls on Ubuntu?

Score:3
bd flag
  1. Install Ruby Gem with development headers:

    sudo apt install ruby-rubygems ruby-dev
    
  2. Download and install a Nerd Font (needed in order to get the pretty icons to display properly). Open the downloaded archive file, and open each font file, and click the "Install" button:

    Screeshot

  3. Set your terminal to use that font. (This step may not be needed)

  4. Install colorls:

     $ gem install --user-install colorls
     WARNING:  You don't have /home/flimm/.local/share/gem/ruby/3.0.0/bin in your PATH,
           gem executables will not run.
     ...
    
  5. If the previous command warns you that you don't have the correct location in your path, modify ~/.bashrc (or equivalent in your favourite shell) to add this line, which modifies your PATH:

     PATH="$PATH:$HOME/.local/share/gem/ruby/3.0.0/bin"
    
  6. To add tab completion, add this line to ~/.bashrc (or equivalent in your favourite shell):

     source $(dirname $(gem which colorls))/tab_complete.sh
    
  7. Now restart your terminal. You should be able to run colorls now, with the new font taking effect.

To uninstall colorls, run gem uninstall colorls and remove the added lines in ~/.bashrc. You might want to undo the installation of the dependencies as well.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.