Giter Club home page Giter Club logo

Comments (8)

lrepolho avatar lrepolho commented on August 17, 2024 14

If someone ends up here like I did, this fixes the issue:

sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells'
chsh -s /usr/local/bin/bash

As mentioned here: mathiasbynens/dotfiles#544 (comment)

from argcomplete.

kislyuk avatar kislyuk commented on August 17, 2024

The version of bash that you're using as the login shell is not the version that is available on your command line. You can find out the version of the running copy of bash with echo $BASH_VERSION, and the available copy using type bash.

To use the newer copy of bash, add it as an available shell into /etc/shells and use chsh, or customize your Terminal/iTerm2 settings.

from argcomplete.

kislyuk avatar kislyuk commented on August 17, 2024

@peterbe did this resolve your issue?

from argcomplete.

peterbe avatar peterbe commented on August 17, 2024

Sorry. Haven't had time to process your response. Vacation coming up meaning rushing to finish things.

from argcomplete.

jasonfharris avatar jasonfharris commented on August 17, 2024

Actually I have the same problem. I am on OSX Mavericks 10.9.3 which is quite current and after installing argcomplete into the directory I use for completions I am now getting the error

Last login: Sat Jun 28 11:27:17 on ttys005
-bash: complete: -D: invalid option
complete: usage: complete [-abcdefgjksuv] [-pr] [-o option] [-A action]
   [-G globpat] [-W wordlist] [-P prefix] [-S suffix] [-X filterpat] [-F function]
   [-C command] [name ...]

My version of bash is as follows:

[bolt:~] ⌘ bash --version
GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)
Copyright (C) 2007 Free Software Foundation, Inc.
[bolt:~] ⌘ echo $BASH_VERSION
3.2.51(1)-release
[bolt:~] ⌘ type bash
bash is hashed (/bin/bash)
[bolt:~] ⌘ which bash
/bin/bash

I have XCode 5.1.1 and its developer tools installed. (This is the latest public version at the time of this reporting). Is there anything else I should check?

As it currently stands this doesn't appear to work on OSX unless I am doing something wrong... Thanks!

from argcomplete.

kislyuk avatar kislyuk commented on August 17, 2024

Hi @jasonfharris. As the documentation states, you will need to use bash 4.2+ in order to use the global completion feature. As your printout indicates (and I can confirm on Mavericks), you have version 3.2.51.

You can install a newer bash using homebrew or similar, and either run it manually or select it as your shell (via chsh) or as your terminal's startup shell.

Without bash 4.2, the package still works when registering individual files, it's only global completion that doesn't work.

from argcomplete.

jasonfharris avatar jasonfharris commented on August 17, 2024

Thanks for getting back to me. Can I make a plea for some documentation to cover this being front and centre in the install section? It is kind of not so nice that OSX users on an up to date system can't basically have an off the shelf working version... Ie for myself, I thought I had obviously done something wrong in my configuration or there was something peculiar with my install. It was only towards the end that I realised that maybe things just generally don't work for off the shelf Mavericks without futzing around with it, actually having to read the documentation etc.

Of course like most people my steps were I just skimmed forward, found the install step and ran those two steps. Found that there was an error with putting the script into the completions directory (Maybe a problem only for me or maybe a problem on all OSX systems?), sighed... then went and fixed that problem by specifying a dest directory, then had the -D problem, then started googling around for that quickly and then looking in the issues. Regrettably I didn't find this a smooth process...

In the end I had to find this out via looking into the github issues. MacOSX is likely not an insignificant chunk of the platforms python developers... So a plea for others that come after me to document this a bit more...

But in any case thank you for putting the effort into what otherwise looks like a very useful tools!

Thanks!

from argcomplete.

enricomarchesin avatar enricomarchesin commented on August 17, 2024

This seems to still be the top result for the error -bash: complete: -D: invalid option in 2023, so adding a slight adaptation of @lrepolho solution that works with latest Homebrew installed Bash:

sudo bash -c 'echo /opt/homebrew/bin/bash >> /etc/shells'
chsh -s /opt/homebrew/bin/bash

from argcomplete.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.