install.sh fails when brew is installed by different user
TheDauntless opened this issue · comments
Describe the bug
When running install.sh, the script fails early because of wrong permissions of brew.
To Reproduce
- Create new OS X user
- Install brew through user1
- Run install.sh from user2
Expected behavior
It works
Terminal output
/install.sh
Platform check: OK. Proceeding with Mac OS X version check.
Detected compatible version of Mac OS X! Proceeding with installation.
/usr/local/bin/brew
proceeding: brew installed
Installing Ansible
Error: No such keg: /usr/local/Cellar/ansible
Error: /usr/local/Cellar is not writable. You should change the
ownership and permissions of /usr/local/Cellar back to your
user account:
sudo chown -R $(whoami) /usr/local/Cellar
Error: Cannot write to /usr/local/Cellar
Error: No such keg: /usr/local/Cellar/ansible
installing necessary roles
Desktop (please complete the following information):
- OS: MacOS 10.13.6 (17G65)
- Latest
Additional context
A fix is to create a group for brew and change the permissions (https://gitlab.com/alyda/dotfiles/snippets/19654). This would be outside of the scope of the install.sh script, but a sensible error message would be nice.
The recommendation doesn't work since High Sierra (Homebrew/brew#3228). So maybe a separate info page on this project is appropriate.
When "admin" is the group where your users are in:
chgrp -R admin /usr/local/*
chmod -R g+w /usr/local/*
Will add it soon to the readme as a separate item. Same holds for https://github.com/geerlingguy/macos-virtualbox-vm to allow others to use it :)
Fixed in #38