Reinstall brew mac os

Installing Homebrew on a Mac

Installation

Homebrew is package manager for Macs which makes installing lots of different software like Git, Ruby, and Node simpler. Homebrew lets you avoid possible security problems associated with using the sudo command to install software like Node.

Prerequisites

  • You should have some familiarity with the Mac Terminal application since you’ll need to use it to install Homebrew. The Terminal application is located in the Utilities folder in the Applications folder.
  • Dependencies. You need to install one other piece of software before you can install Homebew:
    • Xcode. Install Apple’s Xcode development software: Xcode in the Apple App Store.

Installation Overview

Installing Homebrew is straightforward as long as you understand the Mac Terminal. The Homebrew installation process guides through each step.

Installation Steps

  • Open the Terminal app.
  • Type ruby -e «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)» You’ll see messages in the Terminal explaining what you need to do to complete the installation process. You can learn more about Homebrew at the Homebrew website.

How to Update Homebrew

New versions of Homebrew come out frequently, so make sure you update it before updating any of the other software components that you’ve installed using Homebrew. * In Terminal type brew update

Источник

Homebrew: Менеджер пакетов для OS X

Все менеджеры пакетов в Unix имеют определенные недостатки и большинство Linux-дистрибутивов пытаются по-разному эти недостатки обойти. В этом посте я расскажу про Homebrew — новый менеджер пакетов, нацеленный на простоту использования.

До Homebrew было несколько различных попыток создать эффективные пакетные менеджеры для OS X. Две наиболее популярные вылились в итоге в Fink и Macports, но у каждой из них все равно есть свои острые углы. В частности, в обоих создание своих пакетов или портов является черезчур сложным.

В Homebrew создавать новые пакеты и работать с ними проще пареной репы. Давайте посмотрим.

Что оно делает?

Основная мысль очень проста. Homebrew упрощает и автоматизирует монотонные действия по скачиванию и сборке пакетов. Если вам надоели бесконечные ./configure && make && make install , Homebrew поможет.

Зачем оно?

Как я уже заметил выше, для OS X уже есть два решения: Fink и MacPorts. Если какое-то из них у вас уже установлено и всем устраивает — отлично. Но если вы имели неудачный опыт с ними в прошлом, я сильно рекомендую попробовать Homebrew. С ним намного проще. Плюс, его легко модифицировать, ведь он состоит всего из нескольких сотен строк кода на Ruby.

Homebrew не навязывает никакой строгой структуры и путей. По-умолчанию, он устанавливается в /usr/local , но его можно поставить куда угодно. Все пакеты устанавливаются в директории в специальном «подвале» (cellar), например Cellar/git/1.6.5.4/ . После установки Homebrew делает симлинки в стандартные Unix-директории. Ручная установка каких-то пакетов не из Homebrew отлично уживается с ними.

Читайте также:  Asus xonar dg драйвер windows 10 не устанавливается

Это редко может понадобиться, но пакеты можно ставить напрямую из систем контроля версий. Если у пакета есть публичный git, svn, cvs или mercurial репозиторий, всегда можно собрать самую свежую devel-версию прямо оттуда простым brew install .

Кстати, установка занимает меньше времени, поскольку Homebrew старается избегать дублирования пакетов. Например, она не ставит очередную версию Perl в качестве зависимости, поскольку в системе уже есть готовый и работающий Perl. Плюс, Homebrew задуман так, чтобы вам не приходилось использовать sudo при работе с пакетами.

Звучит неплохо. Как это установить?

Первая и единственная зависимость Homebrew — OS X Developer Tools, которые есть на любом установочном диске с OS X и доступны для бесплатного скачивания с сайта Apple.

Самое простое — установить в /usr/local . Это можно сделать весьма просто:
# Присваиваем папку /usr/local себе, чтобы не использовать sudo
sudo chown -R `whoami` /usr/local
# Чиним права на mysql, если он у вас установлен
sudo chown -R mysql:mysql /usr/local/mysql
# Скачиваем и устанавливаем Homebrew с гитхаба
curl -L github.com/mxcl/homebrew/tarball/master | tar xz —strip 1 -C /usr/local

Все, установка завершена. Давайте проверим что все работает:
brew install wget
brew info git

На сайте Homebrew есть wiki, где можно почитать всякого интересного про интеграцию с Rubygems, CPAN и Python EasyInstall.

Следить за обновлениями Homebrew тоже достаточно просто:
brew install git
brew update

Если у вас установлен git, вы можете в любой момент обновлять репозитории Homebrew и устанавливать последнии версии пакетов.

Создавать свои пакеты почти так же просто. Например, если бы в Homebrew не было бы пакета для wget, его создание выглядело бы примерно так:
brew create ftp.gnu.org/gnu/wget/wget-1.12.tar.bz2

После сохранения пакета, его можно протестировать: brew install -vd wget . Если что-то работает неправильно и вам нужна помощь по настройке пакета, на wiki есть много документации. Еще там можно посмотреть примеры создания таких пакетов как git или flac.

Если вы создали новый пакет и желаете поделиться им с сообществом, это тоже достаточно просто сделать с помощью гема github.

gem install json github
git add .
git commit -m «Added a formula for wget»
github fork
git push mastergitx

После того, как вы сделаете push, нужно в Homebrew issue tracker создать новый тикет с темой «New formula: ». Если там все в порядке, ваш пакет будет добавлен в главный репозиторий Homebrew и доступен всем пользователям.

Источник

Как установить Homebrew в MacOS

Homebrew это самый популярный менеджер пакетов для macOS. С помощью команды brew вы можете легко и просто устанавливать пакеты на ваш mac. Но для начала нужно установить сам Homebrew

В статье ниже я расскажу, как установить Homebrew в MacOS

Установка Homebrew в MacOS

Запустите терминал ( /Applications/Utilities/Terminal (в русскоязычном варианте — /Приложения/Утилиты/Терминал )) и выполните следующую команду:

ruby -e «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)»

В процессе установки у вас будет запрошен пароль. Введите пароль при запросе для завершения процедуры установки Homebrew. Процесс занимает некоторое время.

По завершению процесса установки, выполните команду ниже, чтобы проверить версию.

Homebrew 2.1.6
Homebrew/homebrew-core (git revision b2de; last commit 2019-06-19)

Вы также можете проверить корректность установки с помощью следующей команды:

Команда выше предоставит инструкции по решению всех возникших проблем с Homebrew.

Обновление Homebrew

Обновление Homebrew происходит загрузкой исходных кодов из репозитория Git. Сделать это можно следующей командой:

cd «$(brew —repo)» git fetch && git reset —hard origin/master && brew update

Удаление Homebrew

Чтобы удалить Homebrew выполните следующую команду:

ruby -e «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)»

Вы также можете загрузить скрипт для удаления и запустить его, чтобы увидеть больше опций по удалению.

Источник

brandonsimpson / reinstall_git_brew.md

Re-installing Git on Mac OSX with Brew

This is helpful if you’ve previously installed git from source on OSX, and other compilers can’t find the correct path. You need to remove the current version of git, then re-install with brew.

Uninstall git if installed manually

Check which git you’re running:

output should be similar to this: /usr/bin/git

Remove that git install

Re-install git with brew

Check which git you’re now running:

Should now say: /usr/local/bin/git

This comment has been minimized.

Copy link Quote reply

Читайте также:  Elm 327 interface obd2 драйвер для windows

yilliot commented Mar 31, 2018

sudo rm -rf /usr/bin/git wont work for El Capitan due to SIP restriction

simple solution is create alias

This comment has been minimized.

Copy link Quote reply

kungfumike commented Jun 1, 2018

This comment has been minimized.

Copy link Quote reply

novonimo commented Dec 29, 2018 •

consider that for change in bin folder (which is read-only) you must disable SIP System Intergradation Protection in your mac:
1- reboot your mac
2- press and hold ⌘ R until seeing the apple’s logo
3- from recovery menu utils>Terminal

csrutil disable
reboot

now you can remove bin’s stuff
note that: after this change re-enables it using this command:
csrutil enable

This comment has been minimized.

Copy link Quote reply

sidonaldson commented Mar 14, 2019

sudo rm -rf /usr/bin/git wont work for El Capitan due to SIP restriction

simple solution is create alias

brew does this anyways 🙂

This comment has been minimized.

Copy link Quote reply

rezaabdolmaleki commented Jul 3, 2019

that’s great. working for me. thanks 😉

This comment has been minimized.

Copy link Quote reply

titoniubo commented Jul 25, 2019

I follow the instructions and then I am being requested to enter a password.

I do enter the password, but I get an error message:

Thanks for your help.

This comment has been minimized.

Copy link Quote reply

peterHernandez8451 commented Sep 9, 2019

I have gone through the steps you listed in this instruction set, however once I run the «sudo rm -rf /usr/bin/git/» I get the error

rm: /usr/bin/git: Operation not permitted

I am currently running MacOS Mojave v.10.14.6.

and I have Xcode installed (if that means anything).

Please advise.
-Pete8451

This comment has been minimized.

Copy link Quote reply

HadiYaac commented Mar 21, 2020

I have gone through the steps you listed in this instruction set, however once I run the «sudo rm -rf /usr/bin/git/» I get the error

rm: /usr/bin/git: Operation not permitted

I am currently running MacOS Mojave v.10.14.6.

and I have Xcode installed (if that means anything).

Did you found out a solution for your problem?? I got the same error «Operation not permitted» and I’ve been struggling for days with this problem

This comment has been minimized.

Copy link Quote reply

aonrobot commented Jul 31, 2020

I have gone through the steps you listed in this instruction set, however once I run the «sudo rm -rf /usr/bin/git/» I get the error
rm: /usr/bin/git: Operation not permitted
I am currently running MacOS Mojave v.10.14.6.
and I have Xcode installed (if that means anything).
Please advise.
-Pete8451

Did you found out a solution for your problem?? I got the same error «Operation not permitted» and I’ve been struggling for days with this problem

This comment has been minimized.

Copy link Quote reply

peterHernandez8451 commented Aug 26, 2020

Hey people! I was able to get this issue resolved. However i had to install manually (not using brew initially).

I followed the steps from the Git website to reinstall Git.
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
It automatically updated the git version i had on my Mac. Having XCode on my device did not effect the install. I know this may seem broad, but it worked for me!! hope this helps!

This comment has been minimized.

Copy link Quote reply

akshajmody commented Oct 12, 2020

Hi guys, I am having a similar issue. I checked my git version and it was 2.23.0, I did brew install git which should have updated to 2.28.0 I believe however when I restarted my mac and checked git version I still see 2.23.0. I checked which git and it shows «/usr/local/bin/git». How do I know if I am using the right git on my system?

This comment has been minimized.

Copy link Quote reply

akshajmody commented Oct 12, 2020

This comment has been minimized.

Copy link Quote reply

Georgian commented Oct 16, 2020

rm: /usr/bin/git: Operation not permitted is because Mac’s «System Integrity Protection».

This comment has been minimized.

Copy link Quote reply

sjpedro commented Nov 4, 2020

Hey people! I was able to get this issue resolved. However i had to install manually (not using brew initially).

I followed the steps from the Git website to reinstall Git.
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git
It automatically updated the git version i had on my Mac. Having XCode on my device did not effect the install. I know this may seem broad, but it worked for me!! hope this helps!

Читайте также:  При создании образа системы windows 10 выдает ошибку недостаточно места

this worked for me — now running: git version 2.27.0 Catalina 10.15.7

This comment has been minimized.

Copy link Quote reply

johnpancoast commented Nov 24, 2020 •

Hi guys, I am having a similar issue. I checked my git version and it was 2.23.0, I did brew install git which should have updated to 2.28.0 I believe however when I restarted my mac and checked git version I still see 2.23.0. I checked which git and it shows «/usr/local/bin/git». How do I know if I am using the right git on my system?

IMPORTANT EDIT — Any solution I wrote in this comment should be ignored unless you’ve already done the following: restarted your terminal after running brew install git (important!), ensured which git is returning /usr/local/bin/git and that this is what brew installed, confirmed /usr/local/bin/git —version is displaying the new version installed via brew, and if git —version is still returning the old Xcode version even after restarting your terminal then you can either use simple workarounds to add the path to the proper git install as others and myself mentioned (shown below this edit) or you can use people’s solutions above to remove Xcode’ git . However it’s unlikely any of this is necessary with newer versions of macOS if you’ve restarted the terminal after installing git with homebrew. For details see @martbe’s comment and my comment below it that explains where confusion can happen after installing git with homebrew alongside Xcode’s git. For newer versions of macOS, the problem that myself and possibly others experienced is due to simply not restarting the terminal after running brew install git .

See above edit before reading further.

If you do which -a git you’ll notice there are multiple versions of git installed assuming you have one installed from XCode (or straight from git) and another that you’ve just installed from homebrew.

The one in /usr/local/bin/git is the one from homebrew which you can confirm with ls -al /usr/local/bin/git and you’ll see it’s symlinked to the git binary installed in homebrew’s Cellar directory. You can alternatively confirm by passing —version to each absolute command path to see which is which.

When you run a non-absolute command like git it will search directories in the $PATH environment variable and use the first command it finds so you should run echo $PATH and ensure that /usr/local/bin comes before /usr/bin , and if it does then running git should run the correct command for you. Btw, macOS sets up the $PATH variable this way by default but if you’ve changed your $PATH just ensure that /usr/local/bin comes first.

If the above is true and $PATH is correct but git —version is still running the /usr/bin/git command then the quickest and simplest fixes are to either:

    Set an alias like somebody else said by adding alias git=»/usr/local/bin/git» to

/.bash_aliases .

  • Add the correct git command to $PATH by adding export PATH=$PATH:/usr/local/bin/git
  • If that case is happening where $PATH is correctly loading from /usr/local/bin first but git is still running the /usr/bin/git command, I think this may have to do with Xcode overriding things but somebody else who’s more knowledgeable of Xcode can confirm this since I’m not sure. I’ve just seen odd things like this before, and it would explain some of these weird cases (and I know Xcode has things like xcrun to find tools). I’m just not sure. EditThis could also be related to @martbe’s point about reloading terminal, even for older versions, not sure. I’m leaving this be now lol. I’ve done enough damage!

    Источник

    Оцените статью