Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing Rails on Mac OS fails with several errors

I am trying to install Rails on my Mac OS v10.10.4 system, and it fails when I run brew install rbenv ruby-build. The error is:

Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.

At the end of the process it says:

installing man3/d2i_SSL_SESSION.3ssl
i2d_SSL_SESSION.3ssl => d2i_SSL_SESSION.3ssl
installing man3/ssl.3ssl
Cannot create directory /usr/local/etc/openssl: Permission denied

Here is the complete log of all what I tried during this attempt:

Mac-213978b7b1793718b9:ROR developer$ brew install rbenv ruby-build
Warning: rbenv-0.4.0 already installed
==> Installing ruby-build dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2d.tar.gz
######################################################################## 100.0%
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2d_1 --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darw
==> make depend
==> make
==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2d_1/share/man MANSUFFIX=ssl
installing man3/d2i_SSL_SESSION.3ssl
i2d_SSL_SESSION.3ssl => d2i_SSL_SESSION.3ssl
installing man3/ssl.3ssl
Cannot create directory /usr/local/etc/openssl: Permission denied
make: *** [install_sw] Error 13

READ THIS: https://git.io/brew-troubleshooting

These open issues may also help:
Installing Elixir fails due to OpenSSL errors. https://github.com/Homebrew/homebrew/issues/33218
Mac-213978b7b1793718b9:ROR developer$ rbenv install --patch 2.1.1
rbenv: no such command `install`
Mac-406c8f4772a8:ROR developer$ rbenv instal --patch 2.1.1
rbenv: no such command `instal`
Mac-406c8f4772a8:ROR developer$ brew install --HEAD ruby-build
==> Installing ruby-build dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2d.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2d_1 --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darw
==> make depend
==> make
brew install rbenv ruby-build==> make test
==> make install MANDIR=/usr/local/Cellar/openssl/1.0.2d_1/share/man MANSUFFIX=ssl
installing man3/d2i_SSL_SESSION.3ssl
i2d_SSL_SESSION.3ssl => d2i_SSL_SESSION.3ssl
installing man3/ssl.3ssl
Cannot create directory /usr/local/etc/openssl: Permission denied
make: *** [install_sw] Error 13

READ THIS: https://git.io/brew-troubleshooting

These open issues may also help:
Installing Elixir fails due to OpenSSL errors. https://github.com/Homebrew/homebrew/issues/33218
Mac-213978b7b1793718b9:ROR developer$ brew install rbenv ruby-build
Warning: rbenv-0.4.0 already installed
==> Installing ruby-build dependency: openssl
==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2d_1.yosemite.bottle.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d_1.yosemite.bottle.tar.gz
==> Pouring openssl-1.0.2d_1.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/openssl
Warning: Bottle installation failed: building from source.
==> Downloading https://www.openssl.org/source/openssl-1.0.2d.tar.gz
Already downloaded: /Library/Caches/Homebrew/openssl-1.0.2d.tar.gz
==> perl ./Configure --prefix=/usr/local/Cellar/openssl/1.0.2d_1 --openssldir=/usr/local/etc/openssl no-ssl2 zlib-dynamic shared enable-cms darw
^Z
[1]+  Stopped                 brew install rbenv ruby-build
Mac-213978b7b1793718b9:ROR developer$ curl https://gist.githubusercontent.com/andschwa/11334511/raw/563d5c2efb869cafb0c65404d12243822bba2817/ruby-2.1.1-readline.patch | rbenv install --patch 2.1.1
% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
Dload  Upload   Total   Spent    Left  Speed
0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0rbenv: no such command `install'
100  1713  100  1713    0     0   1499      0  0:00:01  0:00:01 --:--:--  1498
(23) Failed writing body
Mac-213978b7b1793718b9:ROR developer$

I have looked at the folllowing links so far:

  • http://rubyonrails.org/download/
  • Installing gem or updating RubyGems fails with permissions error
  • https://github.com/sstephenson/rbenv/
  • https://gorails.com/setup/osx/10.10-yosemite
  • Missing the OpenSSL lib?
like image 799
rptwsthi Avatar asked Aug 02 '15 21:08

rptwsthi


1 Answers

Run this command first

sudo chown -R <your username>:admin /usr/local

Replace <your username> with whatever your username on your mac is. So, in my case, I would run

sudo chown -R Adrian:admin /usr/local

Then try installing rbenv and ruby-build.

Your problem is most likely caused by the use of package installers (.pkg files) as they tend to create files as root in places where they shouldn't.

Note: you can find out your username by running whoami

like image 195
Adrian Avatar answered Sep 19 '22 15:09

Adrian