Skip to content

Instantly share code, notes, and snippets.

@kevinkarwaski
Last active July 22, 2024 20:34
Show Gist options
  • Save kevinkarwaski/94bfb1e83ee20cf80c13 to your computer and use it in GitHub Desktop.
Save kevinkarwaski/94bfb1e83ee20cf80c13 to your computer and use it in GitHub Desktop.

Revisions

  1. Kevin Karwaski revised this gist Mar 7, 2016. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion install-brew.sh
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/
    # Update group ownership of global brew cache.
    echo "Changing group ownership of /Library/Caches/Homebrew to staff..."
    sudo chgrp staff /Library/Caches/Homebrew
    sudo chown $username /usr/local
    sudo chown -Rv $username /usr/local

    # Remove admin rights from current user. This is how you could make this
    # change from the cli.
  2. Kevin Karwaski revised this gist Jan 29, 2015. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions install-brew.sh
    Original file line number Diff line number Diff line change
    @@ -10,13 +10,16 @@
    # admin privileges. Once the script completes, you can change your
    # user to a "standard" OSX user and retain use of brew without being an admin.

    # The user executing the script.
    username=`id -u -n`

    # Install latest stable version of brew.
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    # Update group ownership of global brew cache.
    echo "Changing group ownership of /Library/Caches/Homebrew to staff..."
    sudo chgrp staff /Library/Caches/Homebrew
    sudo chown $username /usr/local

    # Remove admin rights from current user. This is how you could make this
    # change from the cli.
  3. Kevin Karwaski created this gist Dec 11, 2014.
    26 changes: 26 additions & 0 deletions install-brew.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    #!/usr/bin/env bash

    # This script installs brew and chowns the right directories needed to run
    # brew as a standard user. Your user should be the owner of /usr/local which
    # gets set during the installation of brew. The global homebrew cache directory
    # group should be set to 'staff' which is not set during a brew install. This
    # script fixes that.

    # To begin, you MUST execute this script with your user account while it has
    # admin privileges. Once the script completes, you can change your
    # user to a "standard" OSX user and retain use of brew without being an admin.


    # Install latest stable version of brew.
    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    # Update group ownership of global brew cache.
    echo "Changing group ownership of /Library/Caches/Homebrew to staff..."
    sudo chgrp staff /Library/Caches/Homebrew

    # Remove admin rights from current user. This is how you could make this
    # change from the cli.
    # sudo dseditgroup -o edit -d $USER -t user admin

    # Tell user to remove admin rights and restart.
    echo "Congrats! Brew is properly set up for a Standard OSX user. You can remove admin rights from your user account and restart."