athityakumar/colorls

mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')

Flcwl opened this issue · 5 comments

Flcwl commented

Description

  1. I have installed according to the Readme tutorial was successful.
  2. But when I run the colorls command, appeared the following error.
  3. run colorls
<internal:/opt/homebrew/Cellar/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': dlopen(/opt/homebrew/lib/ruby/gems/3.1.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle, 0x0009): tried: '/opt/homebrew/lib/ruby/gems/3.1.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')) - /opt/homebrew/lib/ruby/gems/3.1.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)
	from <internal:/opt/homebrew/Cellar/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
	from <internal:/opt/homebrew/Cellar/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/opt/homebrew/Cellar/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/colorls-1.4.6/lib/colorls.rb:10:in `<top (required)>'
	from <internal:/opt/homebrew/Cellar/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from <internal:/opt/homebrew/Cellar/ruby/3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
	from /opt/homebrew/lib/ruby/gems/3.1.0/gems/colorls-1.4.6/exe/colorls:21:in `<top (required)>'
	from /opt/homebrew/lib/ruby/gems/3.1.0/bin/colorls:25:in `load'
	from /opt/homebrew/lib/ruby/gems/3.1.0/bin/colorls:25:in `<main>'

ruby: 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]
gem: 3.3.11


OS: macOS 12.3.1 21E258 x86_64
Kernel: 21.4.0
Packages: 1 (brew)
Shell: zsh 5.8
Resolution: 1440x900
DE: Aqua
WM: Quartz Compositor
WM Theme: Green (Dark)
Terminal: iTerm2
Terminal Font: HackNerdFontComplete-Regular 12
CPU: Apple M1
GPU: Apple M1


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

Maybe you can find some help / inspiration here: #452

Also, maybe just use homebrew?

Flcwl commented

Maybe you can find some help / inspiration here: #452

Also, maybe just use homebrew?

I have try to run arch -x86_64 colorls but get another error as follow:

arch: posix_spawnp: colorls: Bad CPU type in executable

@avdv I used the homebrew to install ruby then install colorls still the same error

/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): tried: '/Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle' (mach-o file, but is an incompatible architecture (have 'arm64', need 'x86_64')) - /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.6/lib/colorls.rb:10:in `<top (required)>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
        from /Library/Ruby/Gems/2.6.0/gems/colorls-1.4.6/exe/colorls:21:in `<top (required)>'
        from /usr/local/bin/colorls:23:in `load'
        from /usr/local/bin/colorls:23:in `<main>'
avdv commented

@uduwage you seem to have installed colorls into the system Ruby, try to use the homebrew Ruby instead to run colorls. (I only have a remote idea how everything works on darwin, so I can't really tell you how)

Apparently, you may install homebrew on arm64 natively, or in rosetta mode. See https://blog.smittytone.net/2021/02/07/how-to-migrate-to-native-homebrew-on-an-m1-mac/

Depending on what you did, you need to make sure not to mix any of the tools; especially when calling gem install.

Seems like you have used the x86_64 gem to install colorls (and build the native modules) whereas your system Ruby is arm64 and that's a problem...

I'm having the same issue, but when running with asdf as my runtime manager. I'm running an M2 MBP on version 13.6 (22G120):

❯ arch
arm64

❯ ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]

❯ which ruby
/Users/drew.daniels/.asdf/shims/ruby

❯ which gem
/Users/drew.daniels/.asdf/shims/gem

❯ gem install colorls
Fetching colorls-1.4.6.gem

  *******************************************************************
    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.6
Parsing documentation for colorls-1.4.6
Installing ri documentation for colorls-1.4.6
Done installing documentation for colorls after 0 seconds
1 gem installed

❯ which colorls
/Users/drew.daniels/.asdf/shims/colorls

❯ colorls
<internal:/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require': dlopen(/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle, 0x0009): tried: '/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle' (no such file), '/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) - /Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/clocale-0.0.4/lib/clocale/clocale.bundle (LoadError)
        from <internal:/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
        from /Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/clocale-0.0.4/lib/clocale.rb:15:in `<top (required)>'
        from <internal:/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
        from <internal:/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
        from /Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/colorls-1.4.6/lib/colorls.rb:10:in `<top (required)>'
        from <internal:/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
        from <internal:/Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/site_ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:86:in `require'
        from /Users/drew.daniels/.asdf/installs/ruby/3.2.2/lib/ruby/gems/3.2.0/gems/colorls-1.4.6/exe/colorls:21:in `<top (required)>'
        from /Users/drew.daniels/.asdf/installs/ruby/3.2.2/bin/colorls:25:in `load'
        from /Users/drew.daniels/.asdf/installs/ruby/3.2.2/bin/colorls:25:in `<main>'