'command not found' error trying to run uru from Git Bash

Issue #91 resolved
Wayne Vucenic created an issue

@jonforums Thanks for uru! It works great when I'm running cmd.exe (on Win 7 Professional SP1 x64).

However, it doesn't work when I'm running Git Bash from Git for Windows:

#!

wayne@P50 MINGW64 ~
$ uru
bash: uru: command not found

wayne@P50 MINGW64 ~
$ uru.bat
uru v0.8.2
Usage: uru [options] CMD ARG...

where CMD is one of:
   TAG   use ruby identified by TAG, 'auto', or 'nil'
 admin   administer uru installation
   gem   run a gem command with all registered rubies
    ls   list all registered ruby installations
  ruby   run a ruby command with all registered rubies

for help on a particular command, type `uru help CMD`

OK, no big deal, I'll just use "uru.bat":

#!

wayne@P50 MINGW64 ~
$ uru.bat 231
---> now using ruby 2.3.1-p112 tagged as `231p112`

wayne@P50 MINGW64 ~
$ ruby -v
bash: ruby: command not found

I saw the same behavior above for Git for Windows 2.9.0-64 and the current 2.10.0-64

I get the same behavior on two different machines, so hopefully it's not just some configuration error on my end.

I did notice the git bash issue at the end of issue #60, but I'm seeing something a bit different. I'd be very glad to help debug this.

Comments (4)

  1. Jon repo owner

    I suspect the problem is that uru needs to be "installed" in your Git for Windows environment similar to this recipe. Specifically, the portion in which eval "$(uru_rt admin install)" must be added to an appropriate shell startup script.

    On my Win8.1 x64 machine using the portable version of 2.10.0 x64 (installed to C:\Apps\git) I see the following when running Git Bash after tweaking Git Bash's C:\Apps\git\etc\profile script:

    Jon@BLACK MINGW64 ~/Documents
    $ git version
    git version 2.10.0.windows.1
    
    Jon@BLACK MINGW64 ~/Documents
    $ tail -5 /etc/profile
    
    # JDM updates
    export HISTSIZE=100
    export HISTFILE=/C/Apps/git/tmp/.bash_history
    eval "$(uru_rt admin install)"
    
    Jon@BLACK MINGW64 ~/Documents
    $ cygpath -w /etc/profile
    C:\Apps\git\etc\profile
    
    Jon@BLACK MINGW64 ~/Documents
    $ typeset -f
    ...
    uru ()
    {
        export URU_INVOKER='bash';
        uru_rt "$@";
        if [[ -d "$URU_HOME" ]]; then
            if [[ -f "$URU_HOME/uru_lackee" ]]; then
                . "$URU_HOME/uru_lackee";
            fi;
        else
            if [[ -f "$USERPROFILE/.uru/uru_lackee" ]]; then
                . "$USERPROFILE/.uru/uru_lackee";
            fi;
        fi
    }
    
    Jon@BLACK MINGW64 ~/Documents
    $ uru ver
    uru v0.8.2 [windows/386 go1.6.3]
    
    Jon@BLACK MINGW64 ~/Documents
    $ uru ls
        226p369-x32 : ruby 2.2.6p369 (2016-08-16 revision 55943) [i386-mingw32]
        232p182-x32 : ruby 2.3.2p182 (2016-08-30 revision 56032) [i386-mingw32]
        jruby       : jruby 9.1.3.0 (2.3.1) 2016-08-29 a2a3b29 Java HotSpot(TM) 64-Bit...
    
    Jon@BLACK MINGW64 ~/Documents
    $ uru 232
    ---> now using ruby 2.3.2-p182 tagged as `232p182-x32`
    
    Jon@BLACK MINGW64 ~/Documents
    $ uru ls
        226p369-x32 : ruby 2.2.6p369 (2016-08-16 revision 55943) [i386-mingw32]
     => 232p182-x32 : ruby 2.3.2p182 (2016-08-30 revision 56032) [i386-mingw32]
        jruby       : jruby 9.1.3.0 (2.3.1) 2016-08-29 a2a3b29 Java HotSpot(TM) 64-Bit...
    
    Jon@BLACK MINGW64 ~/Documents
    $ ruby --version
    ruby 2.3.2p182 (2016-08-30 revision 56032) [i386-mingw32]
    
    Jon@BLACK MINGW64 ~/Documents
    $ uru nil
    ---> removing non-system ruby from current environment
    
    Jon@BLACK MINGW64 ~/Documents
    $ uru ls
        226p369-x32 : ruby 2.2.6p369 (2016-08-16 revision 55943) [i386-mingw32]
        232p182-x32 : ruby 2.3.2p182 (2016-08-30 revision 56032) [i386-mingw32]
        jruby       : jruby 9.1.3.0 (2.3.1) 2016-08-29 a2a3b29 Java HotSpot(TM) 64-Bit...
    

    If updating your shell config fixes the problem you're seeing, please close out this issue. If not, provide failure specifics and we'll figure it out.

  2. Wayne Vucenic reporter

    Thanks!!! Doing as you suggested in the first two sentences above fixed this on both my systems.

    On a slightly different note, I notice you've got Ruby 2.3.2. May I ask where you downloaded it? I don't see anything newer than 2.3.1 on rubyinstaller.org.

  3. Jon repo owner

    Glad to hear uru and Git Bash are now playing nicely on your system.

    re: ruby 2.3.2, I build ruby from source on windows using my customizations to the rubyinstaller.org build recipes. I re-use the dev environment I used while a core developer of rubyinstaller.org. I retired from the project a few years ago as I don't use ruby much anymore.

  4. Log in to comment