Honestpuck / homebrew.sh

Install homebrew via Jamf without giving users admin rights
Apache License 2.0
107 stars 30 forks source link

Issues during install #6

Closed tina-junold closed 3 years ago

tina-junold commented 3 years ago

Hi,

i've used the script during the enrollment complete step (user initiated enrollment on a clean device). Anything i miss? Device is a MacBookPro 15,1 with BigSur. The user is admin.

Script result: Tue Feb  9 10:47:18 CET 2021 - Homebrew Installation
Tue Feb  9 10:47:18 CET 2021 - Checking for Xcode Command Line Tools installation
Tue Feb  9 10:47:18 CET 2021 - Installing Xcode Command Tools
Software Update Tool

Finding available software

Downloading Command Line Tools for Xcode
Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode
Done with Command Line Tools for Xcode
Done.
Tue Feb  9 11:12:51 CET 2021 - Installing Homebrew
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   128    0   128    0     0    317      0 --:--:-- --:--:-- --:--:--   324

  8 2286k    8  202k    0     0   110k      0  0:00:20  0:00:01  0:00:19  110k
 14 2286k   14  334k    0     0   149k      0  0:00:15  0:00:02  0:00:13  332k
 26 2286k   26  597k    0     0   161k      0  0:00:14  0:00:03  0:00:11  212k
 37 2286k   37  862k    0     0   216k      0  0:00:10  0:00:03  0:00:07  307k
 43 2286k   43  993k    0     0   163k      0  0:00:14  0:00:06  0:00:08  186k
 49 2286k   49 1125k    0     0   158k      0  0:00:14  0:00:07  0:00:07  175k
 66 2286k   66 1520k    0     0   190k      0  0:00:12  0:00:08  0:00:04  205k
 83 2286k   83 1916k    0     0   195k      0  0:00:11  0:00:09  0:00:02  216k
 89 2286k   89 2047k    0     0   200k      0  0:00:11  0:00:10  0:00:01  190k
100 2286k  100 2286k    0     0   220k      0  0:00:10  0:00:10 --:--:--  303k
chown: /usr/local/*: No such file or directory
chmod: /usr/local/*: No such file or directory
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
==> Tapping homebrew/core
fatal: could not create leading directories of '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core': Permission denied
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
export PATH="${HOMEBREW_PREFIX}/opt/openssl/bin:$PATH"
Tue Feb  9 11:13:50 CET 2021 - Updating Homebrew
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
Tue Feb  9 11:13:52 CET 2021 - Installation complete
Honestpuck commented 3 years ago

If your users have admin rights then the easiest thing is to use the official Homebrew install process. My script is only designed for use when users don't have rights.

I must also admit I haven't done any testing on Big Sur yet.

tina-junold commented 3 years ago

A next step is to degrade the user to a normal user during the enrollment, but for testing purposes i disabled this.

PhantomPhixer commented 3 years ago

I'm getting the same using a standard user, on 10.15.7 and running the script from a jamf policy. also had exactly the same on 11.2


Thu Mar 18 06:54:55 PDT 2021 - Checking for Xcode Command Line Tools installation
Thu Mar 18 06:54:55 PDT 2021 - Installing Xcode Command Tools
Software Update Tool

Downloading Command Line Tools for Xcode
Downloaded Command Line Tools for Xcode
Installing Command Line Tools for Xcode
Done with Command Line Tools for Xcode
Done.
Thu Mar 18 14:03:49 GMT 2021 - Installing Homebrew
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100   128  100   128    0     0    492      0 --:--:-- --:--:-- --:--:--   492

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  626k    0  626k    0     0   373k      0 --:--:--  0:00:01 --:--:--  590k
100 1732k    0 1732k    0     0   658k      0 --:--:--  0:00:02 --:--:--  859k
100 2316k    0 2316k    0     0   772k      0 --:--:--  0:00:02 --:--:--  972k
chown: /usr/local/*: No such file or directory
chmod: /usr/local/*: No such file or directory
mkdir: /usr/local/var/homebrew/locks: Permission denied
Error: Can't create vendor-install-ruby lock in /usr/local/var/homebrew/locks!
Fix permissions by running:
  sudo chown -R $(whoami) /usr/local/var/homebrew
Error: Failed to install Homebrew Portable Ruby (and your system version is too old)!
export PATH="${HOMEBREW_PREFIX}/opt/openssl/bin:$PATH"
Thu Mar 18 14:03:56 GMT 2021 - Updating Homebrew
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```

I've never had to install homebrew before as a default so I have no idea what is meant to happen... need to look into that myself.
PhantomPhixer commented 3 years ago

so I did a load of testing.. and I found out that the user:group permissions weren't being applied, this is on 10.15.7 and 11.x. so I modified this line: chown -R "${consoleuser}":_developer "${HOMEBREW_PREFIX}/*

to be

chown -R "$consoleuser":_developer "${HOMEBREW_PREFIX}/*

and it worked.

I have also made all the permissions assignments specific rather than all at the /usr/local/ level as there are aother apps located in there, e.g. jamf.

Honestpuck commented 3 years ago

That sounds fantastic. Would you prefer to just send it to me or open a pull request?

PhantomPhixer commented 3 years ago

homebrew- install.sh.zip brewea.sh.zip here you go. Feel free to test it and maybe refine it. I also made a complimentary extension attribute.

Honestpuck commented 3 years ago

Thanks, Mark.

I'll look at that on the weekend.

// Tony

On Thu, Apr 8, 2021 at 6:51 PM Mark @.***> wrote:

homebrew- install.sh.zip https://github.com/Honestpuck/homebrew.sh/files/6277369/homebrew-.install.sh.zip brewea.sh.zip https://github.com/Honestpuck/homebrew.sh/files/6277370/brewea.sh.zip here you go. Feel free to test it and maybe refine it. I also made a complimentary extension attribute.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Honestpuck/homebrew.sh/issues/6#issuecomment-815581257, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZIRBIFEDJVH5LXS4I2SSDTHVVCTANCNFSM4XO4LZ2Q .

Honestpuck commented 3 years ago

I'm calling this as fixed.