Code Monkey home page Code Monkey logo

Comments (13)

jrusso1020 avatar jrusso1020 commented on August 16, 2024 170

@crsantos @hoangtranwork I was having a similar problem to the one described above when installing via homebrew and having rbenv previously installed. I noticed I was missing the asdf configurations in my ~/.zshrc file that you are suppose to add during setup

I uninstalled rbenv via homebrew and then ran the following commands and it seems to have fixed the problem, I'm now using the proper version of ruby globally. Hopefully this is helpful, obviously it changes slightly depending on your shell

echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.zshrc
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.zshrc
source ~/.zshrc

from asdf-ruby.

smileart avatar smileart commented on August 16, 2024 11

For someone how's coming here from Google, consider this scenario I had (macOS):

While installing asdf install ruby latest I accidentally quit the terminal where the command was running although on coming back I found asdf pretty sure that the latest ruby version was successfully installed, showing it as current and so on, but not actually changing it globally. I tried everything (adding asdf.sh higher in my ~/.zshrc), reshim, etc. – nothing helped. And then I realized that actually Ruby installation has never been finished and asdf seems to register the version before it's actually compiled and installed. The solution in such case is trivial:

asdf uninstall ruby 3.1.2  # or whichever version you have
asdf install ruby latest   # and wait till it's indeed installed
asdf global ruby latest    # 
ruby -v                    # should be the latest version, not the system one

from asdf-ruby.

jayqui avatar jayqui commented on August 16, 2024 9

@jrusso1020's solution almost worked for me, but I noticed that the asdf website's getting started instructions are slightly different (now, at least) for ZSH and Homebrew:

echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc

from asdf-ruby.

Stratus3D avatar Stratus3D commented on August 16, 2024 5

It depends on whether or not you were in a sub directory that had a local ruby version set. If you were in a sub directory with a .tool-versions file containing ruby 2.3.7, or a .ruby-version file containing 2.3.7 that is the expected behavior. If you didn't have local version set and were in your home directory then there is an issue.

from asdf-ruby.

klappradla avatar klappradla commented on August 16, 2024 4

Could it be that you also have ruby installed via Homebrew (I think for instance using vim from Homebrew will install it) and therefore this executable earlier in your $PATH @crsantos ?

You could quickly check

brew list |Β grep ruby

At least for me this also prevented asdf-ruby from working rbenv-ish. Aside that, I think using the Homebrew version also has the downside that you'll have to manually move all your plugins when upgrading the package via Homebrew πŸ€”

from asdf-ruby.

Stratus3D avatar Stratus3D commented on August 16, 2024 1

Brew has become an "official" way of installing it too, so if you can identify a specific scenario where it breaks please reopen this issue (type -a ruby is your friend).

from asdf-ruby.

hoangtranwork avatar hoangtranwork commented on August 16, 2024 1

FYI I also have the exact same issue (and the workaround by installing with git instead of brew works).
One thing I notice when installing with brew is that there's no such asdf.sh file (to be put in .zshrc). Maybe that is the catch with installing with brew.

from asdf-ruby.

crsantos avatar crsantos commented on August 16, 2024

I'm on my $HOME ~/ and I only have a .tool-versions here with with following content:

ruby 2.4.1
python 3.7.1

I have a folder with a local .ruby-version and even a .tool-versions set to 2.4.1, but even using the legacy_version_file = yes, I don't have 2.4.1 enabled on that folder.

I just don't know if this is an issue, or some "trash" config that I have left from rbenv, but I'm pretty sure I'm not loading rbenv at all.

Changed to fishshell.com, so my configs are new.

Any other idea?

from asdf-ruby.

crsantos avatar crsantos commented on August 16, 2024

I'm seeing a pattern here.
Installing via Homebrew I have this problem, but git cloning the 0.6.0 branch directly, it works just fine.
So I'm removing the Homebrew installation and using a local git folder instead.

Not sure you want me to debug anything else, but the local git folder is perfectly fine for me, and homebrew installation is not listed on the README, so I assume this makes it unofficial πŸ˜„

EDIT: I'm going to close this issue since it's working fine following the README.

from asdf-ruby.

Stratus3D avatar Stratus3D commented on August 16, 2024

I suspect there could possible be a rbenv or system installed Ruby that is on your path before asdf. Maybe the homebrew path comes after the path containing system installed ruby, but when you switc to git installed asdf it comes before system installed ruby? I'm fairly certain this is working correctly, at least for the most widely used cases.

from asdf-ruby.

crsantos avatar crsantos commented on August 16, 2024

I'll install from brew again tomorrow and will come back with more conclusions πŸ‘
Standby and thank you!

from asdf-ruby.

crsantos avatar crsantos commented on August 16, 2024

I have some new output when turning on the brew asdf-vm.

Beware that I added this to config.fish:
source /usr/local/Cellar/asdf/*/asdf.fish

  • to match the source command when using the git folder: source ~/.asdf/asdf.fish) - is that my problem?
$ which asdf             
/usr/local/Cellar/asdf/0.6.0/bin/asdf

$ asdf where ruby        
/Users/crsantos/.asdf/installs/ruby/

$ asdf which ruby
/Users/crsantos/.asdf/installs/ruby/2.4.1/bin/ruby

$ asdf global ruby 2.4.1         

$ ruby -v        
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]

$ type -a ruby           
ruby is /usr/bin/ruby

asdf.fish files are identical, even the permissions! Same user, only the group is different.

$ ls -l /usr/local/Cellar/asdf/*/asdf.fish                                                                                                           
-rw-r--r--  1 crsantos  admin   283B Oct  8 03:31 /usr/local/Cellar/asdf/0.6.0/asdf.fish


$ ls -l  ~/.asdf/asdf.fish
-rw-r--r--  1 crsantos  1052847317   283B Oct 29 21:57 /Users/ricardo.santos/.asdf/asdf.fish

Enabling the git one again, fixes the PATH, and all works: πŸ€·β€β™‚οΈ

$ type -a ruby
ruby is /Users/crsantos/.asdf/shims/ruby
ruby is /usr/bin/ruby

from asdf-ruby.

crsantos avatar crsantos commented on August 16, 2024

Well, I guess I just have ruby-build:

$ brew list | grep ruby                                                                                      
ruby-build

But I suppose that's normal, right?
So out of ideas πŸ€”

Thanks for the input.

from asdf-ruby.

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.