iridakos / goto

Alias and navigate to directories with tab completion in Linux
https://iridakos.com/programming/2019/04/10/shell-navigation-with-autocomplete
MIT License
879 stars 63 forks source link

OSX doesn't install to path #36

Closed spuder closed 5 years ago

spuder commented 6 years ago
brew install goto

Close all terminal windows, and reopen

goto
-bash: goto: command not found

I've tried brew unlink goto; brew link goto, and uninstalled and reinstalled,

ll /usr/local/Cellar/goto/1.2.3/etc/bash_completion.d/goto.sh
-rw-r--r--  1 sowen  admin  11402 Mar 14 13:47 /usr/local/Cellar/goto/1.2.3/etc/bash_completion.d/goto.sh

I've also tried

chmod +x /usr/local/Cellar/goto/1.2.3/etc/bash_completion.d/goto.sh

Something is still wrong with the brew package for goto on OSX

iridakos commented 6 years ago

Hi @spuder , thank you for reporting this.

The problem is that the formula depends on the bash-completion formula (read here for more information).

For now, you can install the missing formula with:

brew install bash-completion

I will update the README file to note this dependency until I update the formula to require this.

iridakos commented 6 years ago

@spuder can you please try installing the missing formula and let me know if all good? Thank you!

spuder commented 6 years ago

I've tried installing bash-completion and also followed the instructions of that package

brew install bash-completion
echo '[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion' >> ~/.bash_profile

Then I open a new bash terminal, but goto still isn't in part of the path.

thib-rdr commented 6 years ago

Same for me, even after installing bash_completion, I got the same error message.

iridakos commented 6 years ago

Unfortunately I still can't reproduce it on my machine.

thib-rdr commented 6 years ago

If that can help, I know have this error each time I open a new terminal :

/usr/local/etc/bash_completion:59: command not found: shopt /usr/local/etc/bash_completion:65: command not found: complete /usr/local/etc/bash_completion:72: command not found: complete /usr/local/etc/bash_completion:73: command not found: complete /usr/local/etc/bash_completion:74: command not found: complete /usr/local/etc/bash_completion:76: command not found: complete /usr/local/etc/bash_completion:77: command not found: complete /usr/local/etc/bash_completion:79: command not found: complete /usr/local/etc/bash_completion:80: command not found: complete /usr/local/etc/bash_completion:81: command not found: complete /usr/local/etc/bash_completion:82: command not found: complete /usr/local/etc/bash_completion:83: command not found: complete /usr/local/etc/bash_completion:84: command not found: complete /usr/local/etc/bash_completion:85: command not found: complete /usr/local/etc/bash_completion:86: command not found: complete /usr/local/etc/bash_completion:87: command not found: complete /usr/local/etc/bash_completion:88: command not found: complete /usr/local/etc/bash_completion:89: command not found: complete /usr/local/etc/bash_completion:90: command not found: complete /usr/local/etc/bash_completion:91: command not found: complete /usr/local/etc/bash_completion:92: command not found: complete /usr/local/etc/bash_completion:93: command not found: complete /usr/local/etc/bash_completion:94: command not found: complete /usr/local/etc/bash_completion:95: command not found: complete /usr/local/etc/bash_completion:96: command not found: complete /usr/local/etc/bash_completion:97: command not found: complete /usr/local/etc/bash_completion:98: command not found: complete /usr/local/etc/bash_completion:99: command not found: complete /usr/local/etc/bash_completion:100: command not found: complete /usr/local/etc/bash_completion:101: command not found: complete /usr/local/etc/bash_completion:102: command not found: complete /usr/local/etc/bash_completion:103: command not found: complete /usr/local/etc/bash_completion:104: command not found: complete /usr/local/etc/bash_completion:105: command not found: complete /usr/local/etc/bash_completion:106: command not found: complete /usr/local/etc/bash_completion:107: command not found: complete /usr/local/etc/bash_completion:108: command not found: complete /usr/local/etc/bash_completion:110: command not found: complete /usr/local/etc/bash_completion:111: command not found: complete /usr/local/etc/bash_completion:112: command not found: complete /usr/local/etc/bash_completion:113: command not found: complete /usr/local/etc/bash_completion:114: command not found: complete /usr/local/etc/bash_completion:115: command not found: complete /usr/local/etc/bash_completion:116: command not found: complete /usr/local/etc/bash_completion:117: command not found: complete /usr/local/etc/bash_completion:118: command not found: complete /usr/local/etc/bash_completion:119: command not found: complete /usr/local/etc/bash_completion:120: command not found: complete /usr/local/etc/bash_completion:121: command not found: complete /usr/local/etc/bash_completion:122: command not found: complete /usr/local/etc/bash_completion:123: command not found: complete /usr/local/etc/bash_completion:124: command not found: complete /usr/local/etc/bash_completion:125: command not found: complete /usr/local/etc/bash_completion:126: command not found: complete /usr/local/etc/bash_completion:132: command not found: complete /usr/local/etc/bash_completion:135: command not found: complete /usr/local/etc/bash_completion:138: command not found: complete /usr/local/etc/bash_completion:141: command not found: complete /usr/local/etc/bash_completion:144: command not found: complete /usr/local/etc/bash_completion:147: command not found: complete /usr/local/etc/bash_completion:150: command not found: complete /usr/local/etc/bash_completion:153: command not found: complete /usr/local/etc/bash_completion:156: command not found: complete /usr/local/etc/bash_completion:159: command not found: complete /usr/local/etc/bash_completion:162: command not found: complete /usr/local/etc/bash_completion:341: parse error near\n'`

iridakos commented 6 years ago

@thib-rdr Is there any case you are in zsh shell instead of bash?

thib-rdr commented 6 years ago

@iridakos Yes, I am using Oh My ZSH.

mingrammer commented 6 years ago

I have same problem. I'm using ZSH too.

EdKeith commented 6 years ago

I am also having this problem using bash.

iridakos commented 6 years ago

@thib-rdr @mingrammer Sorry for the delayed response. Unfortunately, I can't test the script on MacOS' zsh any time soon. The script is only available for the bash shell on MacOS at the moment.

iridakos commented 6 years ago

@EdKeith Hello, thanks for reporting. Are you on bash or zsh shell?

JBlond commented 5 years ago

ZSH uses setopt not shopt an option might be https://github.com/larz258/Zshopt/blob/master/shopt

iridakos commented 5 years ago

Closing due to inactivity.

nurseiit commented 5 years ago

I have looked into this a little.

To me, it seems like to be able to install via brew one needs to change the structure of goto repo.

Installation process is different in a sense that simply putting the goto.sh to path is not enough. Because the way it's implemented right now is a set of global functions that need to be source-d via .bash_profile or so every time you open a terminal session.

There might be some other ways to support doing just that via brew – I'm not sure.

I would love to try update the structure, though I'm afraid to break some other things in the process. We'll need to implement tests to avoid that.

BellaTrix25336 commented 5 years ago

I am using bash on MacOs and I struggled a lot to get bash-completion activated as well as getting goto to work, seeing the same command not found error. Finally, I found this solution:

. /usr/local/etc/bash-completion.d/goto.sh

So I added this line to .bashrc (or .bash_profile in my case):

[[ $PS1 && -f /usr/local/etc/bash_completion.d/goto.sh ]] && \
    . /usr/local/etc/bash_completion.d/goto.sh

And now both goto and autocompletion are working fine.

emirlej commented 5 years ago

Great, @BellaTrix25336. That worked great. I'm using MacOS and zsh 😄 .

Maybe you could mention this in the repo, @iridakos 👍 ?

JDW818 commented 5 years ago

@BellaTrix25336 thanks! This worked for me as well.

dcchambers commented 3 years ago

In addition to the fix from @BellaTrix25336, a slightly cleaner fix is to add this to your bash_profile:

source $(brew --prefix)/etc/bash_completion.d/goto.sh