xebia / mobilehacktools

A repository for scripting a mobile attack toolchain
MIT License
63 stars 15 forks source link

install.sh fails when brew is installed by different user #30

Closed TheDauntless closed 6 years ago

TheDauntless commented 6 years ago

Describe the bug When running install.sh, the script fails early because of wrong permissions of brew.

To Reproduce

  1. Create new OS X user
  2. Install brew through user1
  3. 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):

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.

TheDauntless commented 6 years ago

The recommendation doesn't work since High Sierra (https://github.com/Homebrew/brew/issues/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/*
commjoen commented 6 years ago

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 :)

commjoen commented 6 years ago

Fixed in #38