4

I got error message when installing ruby 2.3.1 using rbenv. My environment is below.

  • MacOS 10.10.5
  • rbenv 1.0.0

The log message is below.

$ rbenv install 2.3.1

...

Last 10 log lines:
compiling enc/unicode.c
compiling enc/utf_8.c
compiling enc/trans/newline.c
linking miniruby
generating encdb.h
make: ./miniruby: Permission denied
make: ./miniruby: Permission denied
make: *** [.rbconfig.time] Error 1
make: *** Waiting for unfinished jobs....
make: *** [encdb.h] Error 1

If you get the same error, would you please tell me how to solve this error?
Thank you for your help.

Luka Kerr
  • 4,161
  • 7
  • 39
  • 50
ima0123
  • 85
  • 1
  • 10
  • 1
    try using sudo before your install command – archon92 Oct 11 '16 at 06:14
  • @archon92 Thank you for your message. I think rbenv installs in local environemnt without sudo. Is it incorrect? – ima0123 Oct 12 '16 at 00:22
  • I am not entirely sure about that,But usually ruby make requires write permissions to specific folders and the error you are getting definitely says that – archon92 Oct 12 '16 at 02:40
  • I solved this issue executing via sudo user. Thank you archon92. – ima0123 Oct 12 '16 at 06:31
  • 2
    Why do I have to append an `sudo` before `rbenv install 2.4.0`? I thought rbenv is installing everything into my `~/.rbenv`, isn't that the truth? I think prefixing install command with `sudo` defeat the purpose of having rbenv in home folder. – Bruce Sun Dec 26 '16 at 07:22

2 Answers2

7

Accepted answer is not a good answer - the install process should not require root privileges, and may lead to problems installing gems that require C extensions in the future (nokogiri is a good example).

It's a documented bug in the ruby-build package: https://github.com/rbenv/ruby-build/issues/992, the workaround is to navigate into the working directory and run make install yourself - which should run if you have XCode command line tools installed and updated.

Brian
  • 857
  • 2
  • 12
  • 25
  • for anyone else who was a little lost. the directory to run the make command may lie inside ~/.rvm/... ruby-x or ~/.rbenv/.../ruby-x. good luck – i0x539 Nov 21 '22 at 16:20
-2

add sudo before the command(To give the admin permission to install)

ex)sudo make ruby 2.3.1

vinodpasupathy
  • 158
  • 1
  • 6