asdf-ruby icon indicating copy to clipboard operation
asdf-ruby copied to clipboard

Ruby 2.7 on M1 mac

Open spsaucier opened this issue 2 years ago • 1 comments

First off, I have to use sudo because asdf install ruby 2.7.5 begets:

Installing ruby-2.7.5...
mkdir: /opt/homebrew: Permission denied

I tried updating permissions on /opt but get Permission denied on that too.

So I run sudo asdf install ruby 2.7.5 and get further, failing with this log:

...
compiling readline.c
linking shared-object monitor.bundle
linking shared-object pty.bundle
linking shared-object syslog.bundle
compiling objspace_dump.c
readline.c:1904:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
                                    rl_username_completion_function);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    rl_username_completion_function
readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
# define rl_username_completion_function username_completion_function
                                         ^
/usr/local/opt/readline/include/readline/readline.h:485:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function PARAMS((const char *, int));
             ^
1 error generated.
make[2]: *** [readline.o] Error 1
installing default digest libraries
linking shared-object strscan.bundle
make[1]: *** [ext/readline/all] Error 2
make[1]: *** Waiting for unfinished jobs....
installing default nkf libraries
compiling date_parse.c
linking shared-object digest.bundle
compiling console.c
compiling date_strftime.c
installing default console libraries
installing digest libraries
compiling date_strptime.c
installing default date_core libraries
linking shared-object objspace.bundle
linking shared-object io/console.bundle
linking shared-object nkf.bundle
linking shared-object date_core.bundle
make: *** [build-ext] Error 2

I was able to install using arch -x86_64, but it broke all commands that use ruby, so I don't think that's right.

spsaucier avatar Aug 19 '22 21:08 spsaucier

This is probably down to the ruby-build project you might want to raise an issue there. I probably hasn't been update to run on the M1 because people are using ruby v3. Probably needs a new build script and patches. Meantime you could use a VM or Docker for the linux version or port your code to ruby v3.

andrewcrook avatar Sep 04 '22 16:09 andrewcrook

2.7.7 got released with a fix for OS 13 Ventura.

Hope this helps.

mathieujobin avatar Nov 25 '22 06:11 mathieujobin

Bump. Heroku's minimum ruby version is 2.7.7. It would be fantastic to get this version supported on asdf. Thank you!

mkolenda avatar Mar 22 '23 20:03 mkolenda

Ruby 2.7.7 installed via asdf is working on Apple silicon for me, and I'm using it right now. There is a big difference between homebrew on Apple silicon and homebrew on Intel though. The error mkdir: /opt/homebrew: Permission denied gives me pause.

I would recommend blowing away the homebrew installation, and reinstalling.

Of note, Ruby 2.7 is the oldest version of Ruby that will install for me on Apple silicon.

pboling avatar Mar 22 '23 21:03 pboling

Weird, I don't see 2.7.7 when I issue a asdf list all ruby command after I reinstall asdf.

> brew uninstall asdf
> brew install asdf
> asdf --version
v0.10.2-7e7a1fa

> asdf list all ruby | grep 2.7
1.8.6-p287
2.0.0-p247
2.2.7
2.7.0-dev
2.7.0-preview1
2.7.0-preview2
2.7.0-preview3
2.7.0-rc1
2.7.0-rc2
2.7.0
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.7.6
jruby-9.2.7.0
rbx-2.2.7
rbx-2.7
rbx-2.71828182

Any idea what I am doing wrong? Thanks in advance!

mkolenda avatar Mar 22 '23 22:03 mkolenda

Here's a bit about my env:

❯ asdf info
OS:
Darwin mb-pboling.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:43 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8112 arm64

SHELL:
zsh 5.8.1 (x86_64-apple-darwin22.0)

ASDF VERSION:
v0.11.1

ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/opt/homebrew/opt/asdf/libexec

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master e3622e6
java                         https://github.com/halcyon/asdf-java.git master 116adad
mongodb                      https://github.com/sylph01/asdf-mongodb.git master d071b3c
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master c9e5df4
ruby                         https://github.com/asdf-vm/asdf-ruby.git master 335f356 #<=== I am guessing you have an older version

pboling avatar Mar 23 '23 12:03 pboling

mine is up-to-date as of this minute

Personally I do not use the brew asdf I have had troubles in the past with it using wrong paths in shims. I install asdf manually and use its own update feature which is git based. I have a thing about not using package managers to manage package managers.

>asdf info    
OS:
Darwin xxxx-MBP 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103 arm64

SHELL:
zsh 5.9 (arm-apple-darwin21.3.0)

ASDF VERSION:
v0.11.3-0adc6c1

ASDF ENVIRONMENT VARIABLES:
ASDF_DIRENV_BIN=/opt/homebrew/bin/direnv
ASDF_DIR=/Users/xxxx/.asdf

ASDF INSTALLED PLUGINS:
direnv                       https://github.com/asdf-community/asdf-direnv.git master 1a140d6
lua                          https://github.com/Stratus3D/asdf-lua.git master 6d4e66a
nodejs                       https://github.com/asdf-vm/asdf-nodejs.git master 644ada3
php                          https://github.com/asdf-community/asdf-php.git master 1eaf4de
python                       https://github.com/danhper/asdf-python.git master 8505457
ruby                         https://github.com/asdf-vm/asdf-ruby.git master cfc5fb1
>asdf list all ruby | grep 2.7  
1.8.6-p287
2.0.0-p247
2.2.7
2.7.0-dev
2.7.0-preview1
2.7.0-preview2
2.7.0-preview3
2.7.0-rc1
2.7.0-rc2
2.7.0
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.7.6
2.7.7
jruby-9.2.7.0
rbx-2.2.7
rbx-2.7
rbx-2.71828182

andrewcrook avatar Mar 23 '23 12:03 andrewcrook

I think people having this issue of not finding 2.7.7 probably just need to update the asdf ruby plugin. I just updated mine. Perhaps the necessity of continually updating the plugin could be made more prominent in the README?

❯ asdf plugin update ruby
Updating ruby to master
From https://github.com/asdf-vm/asdf-ruby
   335f356..cfc5fb1  master     -> master
   335f356..cfc5fb1  master     -> origin/master
Already on 'master'
Your branch is up to date with 'origin/master'.

Aside from that, I think this issue should be closed. It is unlikely the homebrew permissions thing in OP was caused by or relevant to this project.

pboling avatar Mar 23 '23 13:03 pboling

@pboling yes, that is a common issue that should be documented. Anyone is welcome to create a PR for that. Or I will if I get a chance.

Stratus3D avatar Jun 09 '23 13:06 Stratus3D