Error installing Homebrew on OS X - ruby

I'm attempting to install Homebrew, but I'm running into some issues. I listed the result below. How can I fix this problem?
$ ~ $ brew install wget
==> Downloading http://ftpmirror.gnu.org/wget/wget-1.14.tar.gz
Already downloaded: /Library/Caches/Homebrew/wget-1.14.tar.gz
==> ./configure --prefix=/usr/local/Cellar/wget/1.14 --sysconfdir=/usr/local/etc --with-ssl=openssl --disable-iri
checking whether make sets $(MAKE)... ./configure: /usr/local/Library/ENV/4.3/sed:/bin/bash^M: bad interpreter: No such file or directory
no
configure: error: cannot run /bin/sh build-aux/config.sub
./configure: /usr/local/Library/ENV/4.3/sed: /bin/bash^M: bad interpreter: No such file or directory
./configure: /usr/local/Library/ENV/4.3/sed: /bin/bash^M: bad interpreter: No such file or directory
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting
Note: I uninstalled MacPorts beforehand and brew doctor works without a hitch.
Solved: I settled with an alternate installation method ("Untar anywhere") that I found on the Homebrew wiki page.
What I ran: mkdir homebrew && curl -L https://github.com/mxcl/homebrew/tarball/master | tar xz --strip 1 -C homebrew

/bin/bash^M is your clue. For some reason there's a DOS line-end character in what's being downloaded. This is probably an error in the formula, but if you're adventurous, you can brew install dos2unix and then run dos2unix on the folder in question.

You are using Windows style end-of-line in Unix/Linux/Mac OS X. If you modified your Git core.autocrlf attribute before, then try:
git config --global core.autocrlf input
Then reinstall Homebrew.

Related

ruby "permission denied" installing/using homebrew cask

My wild bet is that this issue is somehow related to my base osx ruby setup... but as I'm not a ruby-ite, i need some guidance to discover more.
A couple days ago i tried to install a brew cask formula (several others were already installed previously). A couple weeks ago i upgraded to OSX Sierra.
Brew itself works perfectly, brew cask does not.
I get an "unexpected" error when I type brew cask by itself or with any subcommand:
Error: ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
checking for ruby/st.h... yes
checking for st.h... yes
checking for rb_str_replace() in ruby.h... yes
creating Makefile
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `initialize': Permission denied - Makefile (Errno::EACCES)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:2125:in `create_makefile'
from extconf.rb:24:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/msgpack-0.5.8 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-16/2.0.0/msgpack-0.5.8/gem_make.out
I've looked through many questions and tried many of the answers given, all to no avail.
Questions:
Homebrew cask option not recognized?
Failed to build gem native extension (installing Compass)
homebrew not working on OSX Can't install Brew
formulae correctly (Permission denied in /usr/local/lib)
OsX, can't use Homebrew because of Ruby permission
Attempts:
> xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
> brew install ruby
Warning: ruby-2.4.0 already installed
> ls -l /System/Library/Frameworks/Ruby.framework/Versions/
drwxr-xr-x 7 root wheel 238 2017-01-12 12:12:13 2.0
lrwxr-xr-x 1 root wheel 3 2017-01-09 09:47:51 Current -> 2.0
> sudo chown -R $(whoami):admin /usr/local
> sudo chmod -R g+w /usr/local
> brew install caskroom/cask/brew-cask
> brew cask [list|cleanup|update|etc]
(gives error shown above)
Performed a complete homebrew uninstall, rm'ing extra dirs and files. Then complete homebrew re-install, followed by re-install many of the formulae I had previously.
Same commands above give same errors after reinstall.
Color me confused. šŸ˜•
So I just resolved something similar - it was a permissions issue for me. I ended up running:
sudo chown -R $(whoami) your-directory-here
on the Cask and caskroom directories - you may have to look around a little bit to find those directories on your system.

Why am I missing a system file relating to Ruby on OSX 10.10.5?

I'm trying to install Homebrew on my Mac running OSX 10.10.5 with the following scriptā€¦
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
ā€¦but am getting the following error in the terminal:
/usr/local/Library/ENV/scm/git: line 10: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory
/usr/local/Library/ENV/scm/git: line 10: exec: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: cannot execute: No such file or directory
/usr/local/Library/ENV/scm/git: line 10: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory
/usr/local/Library/ENV/scm/git: line 10: exec: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: cannot execute: No such file or directory
/usr/local/Library/brew.sh: line 250: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: No such file or directory
/usr/local/Library/brew.sh: line 250: exec: /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby: cannot execute: No such file or directory
Failed during: /usr/local/bin/brew tap homebrew/core
This error also appears after running any brew command.
I can run Ruby 2.0.0p481, and have Xcode Version 7.2.1 (7C1002) installed, which is the latest version available to me. I'm also able to uninstall Homebrew using this script with no errors:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
Originally, I thought it was a permissions issue, so have triedā€¦
sudo chown -R $(whoami) /usr/local
ā€¦with no success.
I then searched for the path mentioned in the error. Current shows as an alias, and when I attempt to open it, I get the following error:
The operation canā€™t be completed because the original item for ā€œCurrentā€ canā€™t be found.
I can navigate to the /usr/bin/Ruby path through the Finder, but am unsure whether this relates to the path in the error.
I don't believe I've touched the Ruby installation, so I'm unsure why there's an error.
The Terminal now shows the following upon opening a Terminal window:
-bash: rbenv: command not found
-bash: rbenv: command not found
-bash: rbenv: command not found
My ultimate goal is to compile and install Tiled Map Editor on my Mac running OSX 10.10.5. I had previously installed Homebrew, so followed the instructions for compiling Tiled Map Editor, which is when I came across the problem.
I haven't found out why I'm missing a system file, but rather than reinstall the whole OS, I followed the instructions found in this answer to reinstall Essentials from the Yosemite installer, which includes Ruby.
Homebrew now installs as expected.

Tried installing MongoDB with brew and it says "Error: Permission denied - (mongod.conf, /usr/local/etc/mongod.conf)"

Using Mac OSX 10.10.4 on 13' Macbook Air
Typed in 'brew update' like the Mongo docs said and it updated
Then typed 'brew install mongodb' and it took ages to say
Error: Permission denied - (mongod.conf, /usr/local/etc/mongod.conf)
This is what the console said leading up to that point, in case this helps:
Joshuas-Air:~ Josh$ brew install mongodb
==> Downloading https://homebrew.bintray.com/bottles/mongodb-3.0.4.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring mongodb-3.0.4.yosemite.bottle.tar.gz
Error: Permission denied - /usr/local/etc/mongod.conf
Warning: Bottle installation failed: building from source.
==> Installing mongodb dependency: scons
==> Downloading https://homebrew.bintray.com/bottles/scons-2.3.5.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring scons-2.3.5.yosemite.bottle.tar.gz
šŸŗ /usr/local/Cellar/scons/2.3.5: 208 files, 2.4M
==> Downloading https://fastdl.mongodb.org/src/mongodb-src-r3.0.4.tar.gz
######################################################################## 100.0%
==> Cloning https://github.com/mongodb/mongo-tools.git
Updating /Library/Caches/Homebrew/mongodb--github.com-mongodb-mongo-tools--git
==> Checking out tag r3.0.4
==> ./build.sh
==> /usr/local/opt/scons/bin/scons install --prefix=/usr/local/Cellar/mongodb/3.0.4 -j4 --osx-version-min=10.10 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ --use-new-tools
Error: Permission denied - (mongod.conf, /usr/local/etc/mongod.conf)
Joshuas-Air:~ Josh$
Any help at all would be appreciated.
I had mostly the same error. I could not solve the problem by chown'ing the /usr/local directories as the prompts suggest possibly due to my upgrade to High Sierra. I was able to succeed installing mongodb by reinstalling homebrew using the following command:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
This allowed my subsequent brew install mongodb to work.
I had the same problem, changing the directory permissions didn't work for me so eventually I've found this solution:
Download the most recent version (.tgz).
Open the terminal and head to the ~/Downloads folder or wherever you saved the file.
Untar: tar xvf filename.tgz.
Enter the directory and go to the bin directory.
At the terminal use the sudo bash (become root) command.
Now enter the command cp * /usr/local/bin.
Create /data/db directories (optional, this is the default location MongoDB uses).
At the terminal use the command exit to exit root user.
which mongo should now respond with /usr/local/bin and you are all set to go.
My guess is that the permissions on the folder /usr/local/ are not set 755 or 777.
You can change the permissions or simply try to run the command as root:
sudo brew install mongodb

Error in running Homebrew on Mac OS X mavericks

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" -e:70: warning: Insecure world writable dir /usr in PATH, mode 040777 It appears Homebrew is already installed. If your intent is to reinstall you should do the following before running this installer again: rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup
I have this on my terminal but I cant make use of homebrew. I need to use homebrew to install django pyhton web framework. However I don't seem to get the error here. It says its already installed but none of the brew commands work.
ghochee-macbook-pro:logs streamoid$ brew doctor -bash: brew: command not found <<<<<
Can anyone please help? I also see that there is no .bash_profile file with the PATH variable set, am I looking the right folder and file here?
It sounds like /usr/local/bin isn't on your $PATH. You can add it by running the following command in the terminal:
echo 'export PATH="/usr/local/bin:${PATH}"' >> ~/.bash_profile
Then restart your terminal for the changes to take affect.

Install git via homebrew on mac osx 10.10 results in: Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2

Hi I just tried installing git via homebrew on my mac - something is wrong. I had the github for mac app installed, but I tried removing that. The current git version in my system is:
Nielsk#~: $ git --version
git version 1.9.3 (Apple Git-50)
This is what happens if I try to install git via homebrew:
Nielsk#~: $ brew install git
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/git-2.1.3.y
######################################################################## 100,0%
==> Pouring git-2.1.3.yosemite.bottle.tar.gz
==> Caveats
The OS X keychain credential helper has been installed to:
/usr/local/bin/git-credential-osxkeychain
The 'contrib' directory has been installed to:
/usr/local/share/git-core/contrib
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
Error: Permission denied - /usr/local/lib/perl5/site_perl/5.18.2
How can I solve this?
I also met the same issue. I think we should change the readable permission to make sure any of the directories is readable by "all". So I tried the command: sudo chown -R $USER:admin /usr/local
and then: brew link --overwrite git It works for me, hope it will also work for you.
From High Sierra, chown of /usr/local is not allowed. However you can still change permission the sub directories in /usr/local.
In my case, I had to create Frameworks in /usr/local and sudo chown -R $(whom) Frameworks. After that follow what brew doctor says.
The better way is to create subdirectory whatever you need and run
sudo chown -R $(whoami) $(brew --prefix)/*
For those with the new El Capitan OS, you'll need to update your permissions:
Open Terminal and type the following commands:
$ sudo chown -R $(whoami):admin /usr/local
$ brew doctor
$ brew update
$ brew link --overwrite git
The above solution will work for other brew installs like node, etc. Just replace the last line if you started the installation but encountered errors during the brew installation.
I had a similar permission denied error on install of git until I cleaned things up:
$brew doctor
..... << long output of issues, so you run:
$brew prune
$brew doctor
..... << less issues now, so manually clean up
$brew update
$brew install git
Does that address your error as well?
I did what brew doctor recommended and it helped:
sudo mkdir -p /usr/local/sbin
sudo chown -R $(whoami) /usr/local/sbin
MacOS 10.14.4

Resources