Prezto: ls: illegal option -- -

Created on 5 Sep 2015  ·  14Comments  ·  Source: sorin-ionescu/prezto

I have issue using ls command mostly in tmux but It happen sometimes in regular terminal session.

ls: illegal option -- -
usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file ...]
❯❯❯ zsh --version
zsh --version
zsh 5.1 (x86_64-apple-darwin14.5.0)
❯❯❯ which ls                                                                                                                                                                      ⏎
which ls
ls: aliased to ls --group-directories-first --color=auto

I'm using OSX 10.10.5 and iTterm2 Build 2.9.20150905-nightly but I do not thing that issue is related to terminal emulator.

Thanks for any help.

Discussion

Most helpful comment

RESOLVED

I have to replace old:

export PATH="$PATH:$(brew --prefix coreutils)/libexec/gnubin"

with new:

export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

THX again

All 14 comments

The problem is in condition

if is-callable 'dircolors'; then

modules/utilitity/init.zsh

function is-callable {
  (( $+commands[$1] )) || (( $+functions[$1] )) || (( $+aliases[$1] ))
}

modules/helper/init.zsh

In my case this should return false but return true instead. I can fix it with redefinig ls alias in my .zshrc file for now.

I was having this problem but I just found out the solution. On your .zpreztorc file, the one where you load the modules, just load the gnu-utility before the utility module :)

@filipekiss this doesn't work for me:(

@turboMaCk I'm guessing you installed coreutils package via brew? If that's the case, remove the coreutils package and install it again using the following option:

brew install coreutils - - default-names 

Then load the gnu-utility package on your prezto and see if that works. :)

@filipekiss Yeah! It works now. Thanks a lot man.

I ran into this again on my new machine. brew install coreutils - - default-names does not work for me now and brew install coreutils --with-default-names do not fix this issue. Any idea?

Just checked brew info and found this:

==> Caveats
All commands have been installed with the prefix 'g'.

If you really need to use these commands with their normal names, you
can add a gnubin directory to your PATH from your bashrc like:

PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Additionally, you can access their man pages with normal names if you add
the gnuman directory to your MANPATH from your bashrc as well:

MANPATH="/usr/local/opt/coreutils/libexec/gnuman:$MANPATH"

This should work for ZSH/prezto as well. Can you try this and let me know how it goes? :)

Sound reasonable. I had not much time look at this right now (working hard to finish sprint). But I definitely look at this later and post solution in here for a record. THX for your advice. I see the same guid when running brew info coreutils so I believe that this should fix this issue.

No problem! Let me know how this goes. :)

On Fri, Jan 15, 2016 at 2:17 PM Marek Fajkus [email protected]
wrote:

Sound reasonable. I had not much time look at this right now (working hard
to finish sprint). But I definitely look at this later and post solution in
here for a record. THX for your advice. I see the same guid when running brew
info coreutils so I believe that this should fix this issue.


Reply to this email directly or view it on GitHub
https://github.com/sorin-ionescu/prezto/issues/966#issuecomment-172004239
.

Filipe Kiss
————————
+55 11 972-417-669
[email protected]
www.filipekiss.com.br

RESOLVED

I have to replace old:

export PATH="$PATH:$(brew --prefix coreutils)/libexec/gnubin"

with new:

export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

THX again

Just bumped into this one in the future, installing coreutils and adding it to the PATH resolved the issue.

For reference:

brew install coreutils
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

For reference:

brew install coreutils
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Thanks. That worked!

For reference:
brew install coreutils
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"

Thanks. That worked!

Thanks. That worked! (I had the same issue after reinstalling brew and I forgot I already have found the solution - don't judge me!).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daiyanze picture daiyanze  ·  4Comments

entertvl picture entertvl  ·  3Comments

hiqua picture hiqua  ·  6Comments

EllieRagone picture EllieRagone  ·  4Comments

michaelaye picture michaelaye  ·  4Comments