DEV Community

loading...

Install homebrew on MacOS Mojave

berry_clione profile image darkside haguremetal ・6 min read

Install homebrew on Mac

environment

  • Mac OS X 10.14.2 Mojave
  • zsh

how to install

  • install command line tools for Xcode
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
Enter fullscreen mode Exit fullscreen mode
  • this command above shows an window of "install Command Line Developer Tools", so click "Install"

  • "License Agreement" are popped up, and "Agree"
    • if your Mac is on battery power, an attention is shown, so "Continue on Battery Power".

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Enter fullscreen mode Exit fullscreen mode
  • but, an error happens...
You have not agreed to the Xcode license.
Before running the installer again please agree to the license by opening
Xcode.app or running:
    sudo xcodebuild -license
Enter fullscreen mode Exit fullscreen mode
  • so, open Xcode and "Agree", or execute "sudo xcodebuild -license"

  • execute the homebrew install command again.
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew

Press RETURN to continue or any other key to abort
==> Downloading and installing Homebrew...
remote: Enumerating objects: 36, done.
remote: Counting objects: 100% (36/36), done.
remote: Compressing objects: 100% (30/30), done.
remote: Total 116179 (delta 9), reused 13 (delta 5), pack-reused 116143
Receiving objects: 100% (116179/116179), 27.37 MiB | 10.71 MiB/s, done.
Resolving deltas: 100% (84823/84823), done.
From https://github.com/Homebrew/brew
 * [new branch]          master     -> origin/master
 * [new tag]             0.1        -> 0.1
 * [new tag]             0.2        -> 0.2
 * [new tag]             0.3        -> 0.3
 * [new tag]             0.4        -> 0.4
 * [new tag]             0.5        -> 0.5
 * [new tag]             0.6        -> 0.6
 * [new tag]             0.7        -> 0.7
 * [new tag]             0.7.1      -> 0.7.1
 * [new tag]             0.8        -> 0.8
 * [new tag]             0.8.1      -> 0.8.1
 * [new tag]             0.9        -> 0.9
 * [new tag]             0.9.1      -> 0.9.1
 * [new tag]             0.9.2      -> 0.9.2
 * [new tag]             0.9.3      -> 0.9.3
 * [new tag]             0.9.4      -> 0.9.4
 * [new tag]             0.9.5      -> 0.9.5
 * [new tag]             0.9.8      -> 0.9.8
 * [new tag]             0.9.9      -> 0.9.9
 * [new tag]             1.0.0      -> 1.0.0
 * [new tag]             1.0.1      -> 1.0.1
 * [new tag]             1.0.2      -> 1.0.2
 * [new tag]             1.0.3      -> 1.0.3
 * [new tag]             1.0.4      -> 1.0.4
 * [new tag]             1.0.5      -> 1.0.5
 * [new tag]             1.0.6      -> 1.0.6
 * [new tag]             1.0.7      -> 1.0.7
 * [new tag]             1.0.8      -> 1.0.8
 * [new tag]             1.0.9      -> 1.0.9
 * [new tag]             1.1.0      -> 1.1.0
 * [new tag]             1.1.1      -> 1.1.1
 * [new tag]             1.1.10     -> 1.1.10
 * [new tag]             1.1.11     -> 1.1.11
 * [new tag]             1.1.12     -> 1.1.12
 * [new tag]             1.1.13     -> 1.1.13
 * [new tag]             1.1.2      -> 1.1.2
 * [new tag]             1.1.3      -> 1.1.3
 * [new tag]             1.1.4      -> 1.1.4
 * [new tag]             1.1.5      -> 1.1.5
 * [new tag]             1.1.6      -> 1.1.6
 * [new tag]             1.1.7      -> 1.1.7
 * [new tag]             1.1.8      -> 1.1.8
 * [new tag]             1.1.9      -> 1.1.9
 * [new tag]             1.2.0      -> 1.2.0
 * [new tag]             1.2.1      -> 1.2.1
 * [new tag]             1.2.2      -> 1.2.2
 * [new tag]             1.2.3      -> 1.2.3
 * [new tag]             1.2.4      -> 1.2.4
 * [new tag]             1.2.5      -> 1.2.5
 * [new tag]             1.2.6      -> 1.2.6
 * [new tag]             1.3.0      -> 1.3.0
 * [new tag]             1.3.1      -> 1.3.1
 * [new tag]             1.3.2      -> 1.3.2
 * [new tag]             1.3.3      -> 1.3.3
 * [new tag]             1.3.4      -> 1.3.4
 * [new tag]             1.3.5      -> 1.3.5
 * [new tag]             1.3.6      -> 1.3.6
 * [new tag]             1.3.7      -> 1.3.7
 * [new tag]             1.3.8      -> 1.3.8
 * [new tag]             1.3.9      -> 1.3.9
 * [new tag]             1.4.0      -> 1.4.0
 * [new tag]             1.4.1      -> 1.4.1
 * [new tag]             1.4.2      -> 1.4.2
 * [new tag]             1.4.3      -> 1.4.3
 * [new tag]             1.5.0      -> 1.5.0
 * [new tag]             1.5.1      -> 1.5.1
 * [new tag]             1.5.10     -> 1.5.10
 * [new tag]             1.5.11     -> 1.5.11
 * [new tag]             1.5.12     -> 1.5.12
 * [new tag]             1.5.13     -> 1.5.13
 * [new tag]             1.5.14     -> 1.5.14
 * [new tag]             1.5.2      -> 1.5.2
 * [new tag]             1.5.3      -> 1.5.3
 * [new tag]             1.5.4      -> 1.5.4
 * [new tag]             1.5.5      -> 1.5.5
 * [new tag]             1.5.6      -> 1.5.6
 * [new tag]             1.5.7      -> 1.5.7
 * [new tag]             1.5.8      -> 1.5.8
 * [new tag]             1.5.9      -> 1.5.9
 * [new tag]             1.6.0      -> 1.6.0
 * [new tag]             1.6.1      -> 1.6.1
 * [new tag]             1.6.10     -> 1.6.10
 * [new tag]             1.6.11     -> 1.6.11
 * [new tag]             1.6.12     -> 1.6.12
 * [new tag]             1.6.13     -> 1.6.13
 * [new tag]             1.6.14     -> 1.6.14
 * [new tag]             1.6.15     -> 1.6.15
 * [new tag]             1.6.16     -> 1.6.16
 * [new tag]             1.6.17     -> 1.6.17
 * [new tag]             1.6.2      -> 1.6.2
 * [new tag]             1.6.3      -> 1.6.3
 * [new tag]             1.6.4      -> 1.6.4
 * [new tag]             1.6.5      -> 1.6.5
 * [new tag]             1.6.6      -> 1.6.6
 * [new tag]             1.6.7      -> 1.6.7
 * [new tag]             1.6.8      -> 1.6.8
 * [new tag]             1.6.9      -> 1.6.9
 * [new tag]             1.7.0      -> 1.7.0
 * [new tag]             1.7.1      -> 1.7.1
 * [new tag]             1.7.2      -> 1.7.2
 * [new tag]             1.7.3      -> 1.7.3
 * [new tag]             1.7.4      -> 1.7.4
 * [new tag]             1.7.5      -> 1.7.5
 * [new tag]             1.7.6      -> 1.7.6
 * [new tag]             1.7.7      -> 1.7.7
 * [new tag]             1.8.0      -> 1.8.0
 * [new tag]             1.8.1      -> 1.8.1
 * [new tag]             1.8.2      -> 1.8.2
 * [new tag]             1.8.3      -> 1.8.3
 * [new tag]             1.8.4      -> 1.8.4
 * [new tag]             1.8.5      -> 1.8.5
 * [new tag]             1.8.6      -> 1.8.6
Checking out files: 100% (1872/1872), done.
HEAD is now at 2ff07a60c Merge pull request #5458 from Homebrew/readme-remove-coverage
==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Enumerating objects: 4894, done.
remote: Counting objects: 100% (4894/4894), done.
remote: Compressing objects: 100% (4698/4698), done.
remote: Total 4894 (delta 49), reused 303 (delta 4), pack-reused 0
Receiving objects: 100% (4894/4894), 4.02 MiB | 7.59 MiB/s, done.
Resolving deltas: 100% (49/49), done.
Checking out files: 100% (4911/4911), done.
Tapped 2 commands and 4678 formulae (4,936 files, 12.5MB).
==> Migrating /Library/Caches/Homebrew to /Users/foo/Library/Caches/Homebrew...
==> Deleting /Library/Caches/Homebrew...
Already up-to-date.
==> Installation successful!

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations
==> Next steps:
- Run `brew help` to get started
- Further documentation:
    https://docs.brew.sh
Enter fullscreen mode Exit fullscreen mode
  • check installation of homebrew
$ brew -v
Homebrew 1.8.6
Homebrew/homebrew-core (git revision a654; last commit 2019-01-01)
Enter fullscreen mode Exit fullscreen mode

Discussion (7)

Collapse
fohring profile image
fohring

Thanks for the article, I just used this. My homebrew was broken after upgrading to Mojave.
Updating Xcode looks problematic for some people, as it seems like the only version of Xcode in the App Store requires macOS 10.15.2 or later. I was able to circumvent this by downloading git manually via dmg on sourceforge. I was then able to upgrade homebrew.

Collapse
rpgoldman profile image
rpgoldman

Any advice for those of us upgrading to Mojave instead? Migration techniques?

Collapse
berry_clione profile image
darkside haguremetal Author

I've tried on Mojave preinstalled PC, so I'm not so sure how homebrew is by upgrading to Mojave.
But it seems homebrew doesn't work sometimes if you upgrade MacOS to Mojave.

How about trying

brew doctor

, or installing command-line-tool again by

xcode-select --install

or

xcode-select --reset

?

Collapse
rpgoldman profile image
rpgoldman

Hi. I should have been more clear. What I was asking was whether there are steps that brew users should take before and after upgrading to Mojave.
I used to use MacPorts and for that it was important to remove the entire Ports installation (saving information about your installed ports), upgrade the OS, and reinstall Ports.
I understand from others that this is not necessary for brew. Do you know?
It seems like dumping a brew bundle is a good precaution, because I think it could be used to rebuild the brew configuration if necessary.

Collapse
nitairoy profile image
nroy

This step by step helps me to know in details homebrew installation on my mac. It helps me finally to install mongodb.

Collapse
ashes9999 profile image
Ashoka Ranadheer

Thank you buddy, really helps.

Collapse
mika1k profile image
mika1K

when executing the commad this happen for me i and i cant execute this with the sudo command my mac automatically prohibit me from doing this

Forem Open with the Forem app