athityakumar / colorls

A Ruby gem that beautifies the terminal's ls command, with color and font-awesome icons. :tada:
MIT License
4.92k stars 387 forks source link

I dont think colorls is installing? #452

Open Rallanvila opened 3 years ago

Rallanvila commented 3 years ago

Description

I keep running into an issue with getting colorls installed. I saw issue number #280 and i've tried running with sudo and still nothing. Screen Shot 2021-04-10 at 1 12 02 PM

below is what i keep running into.

Traceback (most recent call last):
    10: from /usr/local/bin/colorls:23:in `<main>'
     9: from /usr/local/bin/colorls:23:in `load'
     8: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/exe/colorls:21:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/lib/colorls.rb:9:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle - /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)
avdv commented 3 years ago

Is this on a M1 mac? Try to run colorls in rosetta / x86 mode.

Rallanvila commented 3 years ago

Yes I’m on an M1. OK I’ll have to give it a shot, thanks!

avdv commented 3 years ago

Related to #425

Rallanvila commented 3 years ago

I'm sorry as i forgot to mention that this issue pops up when i try to add this to my .zshrc file

alias ls=’colorls — light — sort-dirs — report’
alias lc=’colorls — tree — light’
avdv commented 3 years ago

I'm sorry as i forgot to mention that this issue pops up when i try to add this to my .zshrc file

alias ls=’colorls — light — sort-dirs — report’
alias lc=’colorls — tree — light’

That looks fishy too. Why are you using backticks? Why only single dashes? And why are the flags separated with spaces from the dash?

Rallanvila commented 3 years ago

Screen Shot 2021-04-12 at 10 18 43 AM

https://medium.com/@caulfieldOwen/youre-missing-out-on-a-better-mac-terminal-experience-d73647abf6d7

This is the link that i was following to make the changes. Also, a class I'm taking online provided the same steps and it worked there however i'm not getting any luck. i've also tried eliminated the spaces and it doesn't work.

I'm trying to get this theme going. Those lines are to create the folder experience.

avdv commented 3 years ago

https://medium.com/@caulfieldOwen/youre-missing-out-on-a-better-mac-terminal-experience-d73647abf6d7

The rendering of the code is broken on this page.

It should look like this:

alias ls='colorls --light --group-directories-first --report'
alias lc='colorls --tree --light'

Do not blindly follow tutorials on the web, try to understand the implications and meaning first.

Rallanvila commented 3 years ago
alias ls='colorls --light --group-directories-first --report'
alias lc='colorls --tree --light'

When i add that to zshrc i get the original error. Thank you so much for your help on this @avdv . I'm going to abandon ship as it just seems to not work and I can do without this functionality.

Traceback (most recent call last):
    10: from /usr/local/bin/colorls:23:in `<main>'
     9: from /usr/local/bin/colorls:23:in `load'
     8: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/exe/colorls:21:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/lib/colorls.rb:9:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlsym(0x7fdfc5741620, Init_clocale): symbol not found - /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)
avdv commented 3 years ago

When i add that to zshrc i get the original error.

Yes, of course. Since you did not run it in x86 mode as I told you to. Just try with

arch -x86_64 zsh

If that works, prefix any ruby command with it...

Rallanvila commented 3 years ago

from what i've found if i run things in rosetta its just like running it in x86. I have a version of my iterm2 that opens using rosetta wouldn't that work as well?

avdv commented 3 years ago

from what i've found if i run things in rosetta its just like running it in x86. I have a version of my iterm2 that opens using rosetta wouldn't that work as well?

Yes, whatever. But I thought the goal would be to get colorls to work normally as well.

Rallanvila commented 3 years ago

Ok so i'll just need to follow your instructions in https://github.com/athityakumar/colorls/issues/425#issuecomment-741043399

I'm going to wait as you suggested that there are still too many issues and compatibility problems with the Ruby ARM Version.

Thanks again @avdv . I dont want you wasting anymore of your time on me! I appreciate you and the time you spent helping out my friend!

avdv commented 3 years ago

Maybe I am oversimplifying, but I thought this would be as easy as

  1. installing colorls inside a shell / terminal started within Rosetta
  2. try to run colorls inside Rosetta
  3. if that works, instead of calling colorls call arch -x86_64 colorls everywhere - ie. update the aliases
Rallanvila commented 3 years ago

Did the above and I cannot get it to work.

jsupa commented 3 years ago

same problem on M1 I try sudo/rosetta/arch and same problem 😄

lipemorais commented 3 years ago

I'm facing the same issue with colorls.

lipemorais commented 3 years ago

I was able to solve the problem inspired on this issue from Flutter repo.

❯ arch -x86_64 sudo gem install colorls
Password:

  *******************************************************************
    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.4.4
Parsing documentation for colorls-1.4.4
Installing ri documentation for colorls-1.4.4
Done installing documentation for colorls after 0 seconds
1 gem installed
❯ colorls
Traceback (most recent call last):
    10: from /Users/felipython/.gem/ruby/2.6.0/bin/colorls:23:in `<main>'
     9: from /Users/felipython/.gem/ruby/2.6.0/bin/colorls:23:in `load'
     8: from /Users/felipython/.gem/ruby/2.6.0/gems/colorls-1.4.4/exe/colorls:21:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /Users/felipython/.gem/ruby/2.6.0/gems/colorls-1.4.4/lib/colorls.rb:9:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle, 0x0009): missing compatible arch in /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle - /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)
❯ arch -x86_64 colorls
      Applications/      Documents/      Library/      Music/         Public/      getting-started/
      Desktop/           Downloads/      Movies/       Pictures/      dev/

    ~ ················································································
avdv commented 3 years ago

@lipemorais thanks for verifying my instructions from above are working... :laughing:

Closing as resolved...

lipemorais commented 3 years ago

There is just one small change at the first point. Start the terminal using Rosetta was not necessary.

Use sudo was also important to make it work.

lipemorais commented 3 years ago

Update: After update my MacOS to Big Sur 11.3.1

I had to remove arch -x86_64 from my alias arch -x86_64 colorls --sd -A now I can use just colorls --sd -A

    ~ ·································································································································· 1.33   18%   7.07G   at 19:54:15 
❯ arch -x86_64 colorls --sd -A
arch: posix_spawnp: colorls: Bad CPU type in executable

    ~ ·································································································································· 1.35   18%   7.04G   at 19:55:21 
❯ colorls --sd -A
      .Trash/       .oh-my-zsh/         Desktop/        Pictures/                 .bash_history         .tool-versions
      .asdf/        .rbenv/             Documents/      Public/                   .bashrc               .z
      .cache/       .ssh/               Downloads/      dev/                      .fzf.bash             .zcompdump-felipython’s MacBook Air-5.8
      .config/      .vscode/            Library/        getting-started/          .fzf.zsh              .zprofile
      .docker/      .zsh_sessions/      Movies/         .CFUserTextEncoding       .p10k.zsh             .zsh_history
      .gem/         Applications/       Music/          .DS_Store                 .python_history       .zshrc

    ~ ·································································································································· 1.37   18%   7.05G   at 19:55:30 
❯
avdv commented 3 years ago

There is just one small change at the first point. Start the terminal using Rosetta was not necessary.

I thought running in Rosetta mode is equivalent to running a command wrapped in arch -x86_64 ...?

Use sudo was also important to make it work.

That's only needed when you want to install colorls system wide. I never do this; I have enabled the gem --user-install option and just install into my local user gem folder.

After update my MacOS to Big Sur 11.3.1

I had to remove arch -x86_64 from my alias arch -x86_64 colorls --sd -A now I can use just colorls --sd -A

That's nice. Thanks for the update! :+1:

ernestasgobionis commented 3 years ago

In my case, adding arch -x86_64 to any colorls commands produces a new error:

Traceback (most recent call last):
    10: from /usr/local/bin/colorls:23:in `<main>'
     9: from /usr/local/bin/colorls:23:in `load'
     8: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/exe/colorls:21:in `<top (required)>'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     6: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     5: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/lib/colorls.rb:9:in `<top (required)>'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
     2: from /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlsym(0x7fe1fa518f00, Init_clocale): symbol not found - /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)

Anyone have an idea on how to fix this?

avdv commented 3 years ago

Anyone have an idea on how to fix this?

Seems like you should rebuild / reinstall the clocale gem.

ernestasgobionis commented 3 years ago

@avdv That worked, awesome! Thanks

bolognini commented 3 years ago

Running any colorls command such as arch -x86_64 colorls --group-directories-first --hyperlink produces this error.

Traceback (most recent call last):
    7: from /usr/local/bin/colorls:23:in `<main>'
    6: from /usr/local/bin/colorls:23:in `load'
    5: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/exe/colorls:21:in `<top (required)>'
    4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    2: from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.4/lib/colorls.rb:4:in `<top (required)>'
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': dlopen(/Library/Ruby/Gems/2.6.0/gems/etc-1.2.0/lib/etc.bundle, 9): no suitable image found.  Did find: (LoadError)
    /Library/Ruby/Gems/2.6.0/gems/etc-1.2.0/lib/etc.bundle: mach-o, but wrong architecture
    /Library/Ruby/Gems/2.6.0/gems/etc-1.2.0/lib/etc.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/etc-1.2.0/lib/etc.bundle

Trying to install it again with arch -x86_64 sudo gem install colorls produces this error:

ERROR:  Loading command: install (LoadError)
    dlopen(/Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle, 9): no suitable image found.  Did find:
    /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle: mach-o, but wrong architecture
    /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/date-3.1.1/lib/date_core.bundle
ERROR:  While executing gem ... (NoMethodError)
    undefined method `invoke_with_build_args' for nil:NilClass

I'm on a M1 too, running iTerm with Rosetta and with zshrc configuration. I have to use it with Rosetta for compatibility purposes on a repo. Even commenting all the aliases in the zshrc file produces the same error, I'm not able to make a ls command anymore :(. Does anybody have a solution for this?

Ghasak commented 3 years ago

If you using Colorls on mac you can do the following

cd /usr/local/Cellar/ruby/x.x.x/bin   [my current version is x.x.x = 3.0.2]
./gem uninstall colorls 

it will ask you to remove the colorls then at the same directory

./gem install colorls 

Now, you can link your colorls as shown in my thread Step-3-

bolognini commented 3 years ago

Hi @Ghasak thanks for the reply! Thought I don't have this Cellar folder. Is there any way to fix this? I would prefer uninstall colorls (don't know how either) than not having the ls command. I'm really stuck on this. Of course I would prefer to make colorls to work normally, but if it can't work in my terminal opened with Rosetta I'm fine with just uninstalling it. cc: @avdv if you could help with any advice on this as well.

Thanks in advance!

Edit: nvm about uninstallation. I just ran gem uninstall colorls and it uninstalled, but still preferred to keep this working 😞 Really like this lib. When trying to reinstalling it, I get this error:

image

Ghasak commented 3 years ago

don't have this Cellar folder. Is there any w

Hi @bolognini, Sorry to hear that you couldn't install it so far, please check my answer here; https://stackoverflow.com/a/67506010/10768894 Could you please let me know your current operating system, do you have (Homebrew) installed? if you have don't check them out here: homebrew websitee then: brew install colorls let me know how it goes. I can help for sure. Currently, I am using it with my macOs located at /usr/local/lib/ruby/gems/3.0.0/bin/colorls then source this path in your zsh, or bash with ($PATH) or symlink it with (ln -s /original/location/ /new/loction) image