Error homebrew core is a shallow clone

➜ ~ brew info test Error: No available formula with the name "test" ==> Searching for a previously deleted formula... Warning: homebrew/core is shallow clone. To get complete history run: g...
➜  ~ brew info test 
Error: No available formula with the name "test" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.

I have modified the git remote address to mirror address of homebrew before. Maybe it’s relevant to this but I don’t know.

asked Aug 20, 2017 at 13:33

lucky yang's user avatar

3

As of Oct 2020 Homebrew no longer creates shallow clones when being installed, and as of Dec 2020 updating existing shallow clones is not allowed either.

(This makes the original question about silencing the warning moot).


If a shallow clone is configured, a message containing text like the below will be shown:

Error:
  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

It is now required to perform the unshallow process by running the git command(s) in the error message.

Note: This process may take a long time to complete without providing feedback.


For some details about the motivation for this change, see this discussion on Homebrew’s GitHub page, specifically:

There are two major downsides of shallow cloning:

  1. It places a massive computation burden on GitHub’s servers, which have to dynamically compute a fresh delta between what you have and the latest commit, on every brew update. (With full clones, GitHub can simply send you all the commits that happened after your last pull, and your local Git client takes care of the rest.)
  2. Because of [1], it makes it far more likely that GitHub will rate-limit Homebrew operations, which will make it suck for everyone.

—gromgit Dec 5, 2020, 12:29 AM EST

And also this additional text added to the error message:

This restriction has been made on GitHub’s request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask.

MrUpsidown's user avatar

MrUpsidown

21.2k14 gold badges74 silver badges127 bronze badges

answered Dec 10, 2020 at 23:29

Grisha Levit's user avatar

Grisha LevitGrisha Levit

8,0172 gold badges38 silver badges51 bronze badges

9

Under the cover Homebrew uses Git for version control, and a shallow clone
is one that doesn’t contain all history revisions/commits, for efficiency and data volume.

Actually, in most cases the warning can be safely ignored, as the formulae being searched for probably isn’t available.

But if you’re really looking for some formulae which might existed in the past, Just do what it suggests:

To get complete history run:

git -C "$(brew --repo homebrew/core)" fetch --unshallow

This way Homebrew could search for formula that existed only in the past but removed at some point.

answered Aug 20, 2017 at 17:31

ryenus's user avatar

ryenusryenus

14.9k5 gold badges56 silver badges61 bronze badges

4

somehow the unshallow is not working for me, I wait like 10 mins but nothing show up, even with -v option.

Just found one possible solution that might working(at least working for me).

You can remove the repository and clone again to get latest one.

cd /usr/local/Homebrew/Library/Taps/homebrew/
rm -rf homebrew-core
git clone https://github.com/Homebrew/homebrew-core.git

same command for homebrew-cask if you need to update that too

all the credits belong to this answer

answered Aug 17, 2021 at 11:06

Wei Jing's user avatar

Wei JingWei Jing

5314 silver badges8 bronze badges

I have update repo through git pull —unshallow

Update homebrew-core

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git pull --unshallow

Update homebrew-cask

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git pull --unshallow

answered Mar 18, 2021 at 18:29

Nanhe Kumar's user avatar

Nanhe KumarNanhe Kumar

15.1k5 gold badges78 silver badges70 bronze badges

I would advise against unshallowing the clone because it cramps disk space, makes the lookups slower and enables you only to install obsolete or unmaintaned applications.

There is currently no way to silence this warning. It was proposed in this Github issue but then ignored.

The function deleted_reason which prints the message contains a silent argument but afaik there is no way to use to use something like silent from the CLI commands which later call deleted_reason.

answered Apr 4, 2019 at 10:27

Hedge's user avatar

HedgeHedge

15.7k38 gold badges138 silver badges244 bronze badges

1

Fetch the repo using the --unshallow flag:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

Z4-tier's user avatar

Z4-tier

6,9323 gold badges27 silver badges41 bronze badges

answered Jan 21, 2021 at 1:37

Rohit Mandiwal's user avatar

Rohit MandiwalRohit Mandiwal

10.2k5 gold badges72 silver badges82 bronze badges

1

At the time of writing this, the logic Homebrew uses for checking if your clone is shallow is by checking if either of /usr/local/Homebrew/Library/Taps/homebrew/homebrew-{cask,core}/.git/shallow exists.

One can work around that check by moving the .git directory out of the repo; example command to do so (run in the Terminal):

for tap in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-{cask,core}; do 
  mv $tap{/,}.git ; 
  echo "gitdir: $tap.git" >$tap/.git ; 
done

Reference: Setting up .git folder in a custom location

Homebrew foundation is unfortunately incredibly hostile towards their community and I wouldn’t be surprised if they patched this soon.

Nonetheless, this is a lifesaver for me and possibly other people in similar situation to mine. However, if your life doesn’t immediately depend on this, perhaps do them a favor and just unshallow.

answered Oct 31, 2021 at 9:49

Fluffish's user avatar

FluffishFluffish

111 silver badge1 bronze badge

git -C "$(brew --repo homebrew/core)" fetch --unshallow

This command should run with sudo and it would work.

sudo git -C "$(brew --repo homebrew/core)" fetch --unshallow

Terminal Picture

Greenonline's user avatar

Greenonline

1,3228 gold badges22 silver badges30 bronze badges

answered Jan 7, 2021 at 13:19

user3361242's user avatar

i dont know if this is the right way but does work
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch —unshallow

wait some minutes. After that you’ll see something like this.

Resolving deltas: 100% (723461/723461), completed with 4329 local objects.
From https://github.com/Homebrew/homebrew-core
4d2aadabe6c..eab34538365 master -> origin/master

then you could paste this again to update Homebrew and that’s it.

/bin/bash -c «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)»

i’m new coding so i don’t have a exact explenation to this.

answered Sep 30, 2021 at 17:21

Sergio Boada's user avatar

1

Bug report

  • [* ] ran brew update and can still reproduce the problem?
  • [* ] ran brew doctor, fixed all issues and can still reproduce the problem?
  • [* ] ran brew config and brew doctor and included their output with your issue?

What you were trying to do (and why)

I tried to run brew update and brew upgrade as usual to update the packages on my machine. Instead, I got the error below informing me that homebrow-core is a shallow clone (that’s a good thing right?) and that I should unshallow it. Seemed a bit odd to me, as I thought the point of a shallow clone was to save a bunch of disk space, but I ran the command anyway. After running the suggested command to unshallow, the error remains on subsequent tries. So perhaps the issue is unrelated to the «shallowness» of the repo.

What happened (include command output)

Command output

$ brew update
Error: homebrew-core is a shallow clone. To brew update first run:
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow

$ git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" fetch --unshallow
remote: Enumerating objects: 848801, done.
remote: Counting objects: 100% (848798/848798), done.
remote: Compressing objects: 100% (272589/272589), done.
remote: Total 843685 (delta 574218), reused 837687 (delta 568229), pack-reused 0
Receiving objects: 100% (843685/843685), 331.47 MiB | 10.81 MiB/s, done.
Resolving deltas: 100% (574218/574218), completed with 4347 local objects.
From https://github.com/Homebrew/homebrew-core
55b17bad99..536b616fc3 master -> origin/master

$ brew upgrade
Error: homebrew-cask is a shallow clone. To brew update first run:
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" fetch --unshallow

What you expected to happen

Brew update and upgrade to update and upgrade, respectively.

Step-by-step reproduction instructions (by running brew commands)

Output of brew config and brew doctor commands

Brew Config:

HOMEBREW_VERSION: 2.6.0-68-g5ad9496
ORIGIN: https://github.com/Homebrew/brew
HEAD: 5ad949672f1fd9ce900e1196a0ad2c020f869480
Last commit: 26 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 55b17bad998d4b72411754fe69d68b7f3b4d1292
Core tap last commit: 25 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: nvim
HOMEBREW_MAKE_JOBS: 12
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: dodeca-core 64-bit kabylake
Clang: 12.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.0.1-x86_64
CLT: 12.2.0.0.1.1604076827
Xcode: 12.2

Brew Doctor:

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed kegs have no formulae!
This means they were either deleted or installed with `brew diy`.
You should find replacements for the following formulae:
  python@2

Warning: Unbrewed header files were found in /usr/local/include.
If you didn't put them there on purpose they could cause problems when
building Homebrew formulae, and may need to be deleted.

Unexpected header files:
  /usr/local/include/python2.7/greenlet/greenlet.h
  /usr/local/include/python3.7m/greenlet/greenlet.h
  /usr/local/include/python3.8/greenlet/greenlet.h

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  python@2

Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
  echo 'set -g fish_user_paths "/usr/local/sbin" $fish_user_paths' >> ~/.config/fish/config.fish

Исправление ошибки Error: homebrew-core is a shallow clone. To `brew update` first run.

Ошибка

Error: homebrew-core is a shallow clone. To `brew update` first run:
git -C «/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core» fetch —unshallow
This restriction has been made on GitHub’s request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core. We don’t do this for you automatically to avoid
repeatedly performing an expensive unshallow operation in CI systems (which
should instead be fixed to not use shallow clones). Sorry for the inconvenienc

Исправление

Запустить в консоли:

git -C «/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core» fetch —unshallow

Если не поможет также попробовать:

git -C «/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask» fetch —unshallow

У сайта нет цели самоокупаться, поэтому на сайте нет рекламы. Но если вам пригодилась информация, можете лайкнуть страницу, оставить комментарий или отправить мне подарок на чашечку кофе.

Posted on Jan. 8, 2023, 10:11 p.m. by Akarsh Kota

Category:
The development tools

Tag:
Mac

I. Brief introduction of the problem

  • Mac Homebrew installation and uninstallation

  • Brew update, brew install XXX… Updating Homebrew for a long time or getting stuck on Updating Homebrew… .

  • The reason is: since the default BREW REPO we installed is the official REPO, the connection cannot be made due to special domestic reasons, so the problem can be solved by using Alibaba’s Homebrew mirror source for acceleration.

  • Usually when we execute the BREW command to install the software, it is related to the following three warehouse addresses:

    brew.git
    homebrew-core.git
    homebrew-bottles
    Copy the code

Two, the solution (replace by steps, can be restored later)

  • replacebrew.gitThe warehouse address

    $ cd "$(brew --repo)"
    $ git remote set-url origin https://mirrors.aliyun.com/homebrew/brew.git
    Copy the code

    Restore:

    $ cd "$(brew --repo)"
    $ git remote set-url origin https://github.com/Homebrew/brew.git
    Copy the code
  • replacehomebrew-core.gitWarehouse Address:

    $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    $ git remote set-url origin https://mirrors.aliyun.com/homebrew/homebrew-core.git
    Copy the code

    Restore:

    $ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
    $ git remote set-url origin https://github.com/Homebrew/homebrew-core.git
    Copy the code
  • replacehomebrew-bottlesVisit address:

    1. This step depends on the shell version used by macOS. Check the shell version first

    $echo $SHELL prints /bin/zsh or /bin/bashCopy the code

    /bin/ ZSH = /bin/ ZSH

    $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles'  ~/.zshrc
    $ source ~/.zshrc
    Copy the code

    Restore:

    $vi ~/.zshrc # Then delete the HOMEBREW_BOTTLE_DOMAIN line to configure $source ~/.zshrcCopy the code

    If /bin/bash is output, the access address should be this:

    $ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.aliyun.com/homebrew/homebrew-bottles'  ~/.bash_profile
    $ source ~/.bash_profile
    Copy the code

    Restore:

    $vi ~/.bash_profile # Then delete the HOMEBREW_BOTTLE_DOMAIN configuration $source ~/.bash_profileCopy the code
  • The configuration ends here and can be executed again

    $ brew update
    Copy the code

    If it works, you don’t need to look down!!

  • If not, keep watching:

    Brew doctor # $output to the following error message/usr/local/Homebrew/Library/Homebrew/global rb: 12: in ` require ': cannot load such file -- active_support/core_ext/object/blank (LoadError) from /usr/local/Homebrew/Library/Homebrew/global.rb:12:in `top (required)' from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require_relative' from /usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `main'Copy the code

    Whatever error is reported, ignore it and execute the following command

    $ brew update-reset
    Copy the code

    Wait for the update to complete and execute it again

    $ brew update
    Copy the code

    If it works, you don’t need to look down!!

  • If an errorhomebrew-core is a shallow clone.

    Error: homebrew-core is a shallow clone. To `brew update`, first run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow This command may take a few minutes to run due to the large size of the repository. This restriction has been made on GitHub's request because updating shallow  clones is an extremely expensive operation due to the tree layout and traffic of Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you automatically to avoid repeatedly performing an expensive unshallow operation in CI systems (which should instead be fixed to not use shallow clones). Sorry for the inconvenience!Copy the code

    Delete homebrew-core and update it

    $ cd /usr/local/Homebrew/Library/Taps/homebrew
    $ rm -rf homebrew-core
    $ brew upgrade
    Copy the code

    Homebrew-core is updated with $brew Upgrade

  • if$ brew upgradeInstallation speed is too slow and directcontrol + cStop and install as follows

    / / into the Taps folder $CD/usr/local/Homebrew/Library/Taps / / Homebrew file and into the new, If you have this file, go to $mkdir homebrew  CD homebrew or $CD homebrew // Git and download $Git clone git://mirrors.ustc.edu.cn/homebrew-core.gitCopy the code

    After successful, execute the installation command, press Enter to confirm:

    $ /bin/bash -c "$(curl -fsSL https://cdn.jsdelivr.net/gh/ineo6/homebrew-install/install.sh)"
    Copy the code

    == Installation successful! The installation is successful.

    Finally, you can update it, which is usually the latest version, and then install the tool via BREW.

    $ brew update
    Copy the code

    Almost done here!! After configuration to install some tools and modules will be able to find very happy!!

    Included: Homebrew Tutorial on Mirroring for Mac, there are other mirroring sources available in this article!

You may like:

A new version of Homebrew is available, and you may encounter this error if it has not been updated. Fortunately, you can fix this error by following a couple of easy steps. First, you must uninstall any Homebrew packages you have installed. Then, run the git command to un-shallow them. This procedure may take a long time.

This error message will occur when attempting to upgrade a clone. The GitHub servers are under enormous computational burdens when updating a shallow clone. They must dynamically compute the delta between the current state and the latest commit. This computation is performed on a local Git client instead of GitHub’s servers. Adding rate-limiting to such a CI system will make Homebrew operations slow and inefficient.

This is a problem with GitHub’s rate-limit. It requires massive computational effort to update a shallow clone, which will negatively affect other users. This restriction is necessary to prevent GitHub from spending massive amounts of money on a single operation. Another issue with this policy is that it will force developers to use a local Git client to perform updates.

To fix this problem, you should revert to the previous version of the homebrew project. This version is an old version, and you must use it to revert back to it. You should consider updating these versions as a last resort if you want to fix this issue. You can also try to run a brew update command from GitHub. This might take a few minutes, but it will be worth the wait.

If you are trying to use this version of Homebrew, you must revert it to the original version. This is an expensive operation. This error occurs when your homebrew-core is a shallow copy. To fix this, you should revert your homebrew project to the original version. Then, run the brew update command. The process will take a few minutes.

If you are a developer, you should consider updating your clone manually. GitHub will make these updates, but they’ll take a long time. You should avoid cloning the same version twice. The more often you update your clone, the better. Just revert it to the original version. Otherwise, you’ll encounter this error again.

When you try to install homebrew-core, you will get an error: “homebrew-core is a shallow cleaver”. If you are a developer, you need to update the clone on GitHub. It is a common mistake, and is not recommended. If you’re a beginner, you should use the GitHub clone.

This error can make it difficult to update your clone of Homebrew. You should try a different version. There are other ways to fix this error. One way is to make it less of a shallow clone. It is important to avoid this error. Using this method will cause your clone to be incompatible with other clones.

This error is caused by an issue with GitHub’s rate-limits. If you’re updating a homebrew-core clone, it will take a few minutes to complete. It’s not a good idea to clone a GitHub clone if you’re not confident in the source code. It’s not a safe practice.

A homebrew-core clone is a shallow clone. Rather, a clone is a clone of an old version. It’s possible to use both versions of a clone and a new one. You can upgrade Homebrew only if you have the correct Macos version.

➜  ~ brew info test 
Error: No available formula with the name "test" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.

I have modified the git remote address to mirror address of homebrew before. Maybe it’s relevant to this but I don’t know.

9 Answers

As of Oct 2020 Homebrew no longer creates shallow clones when being installed, and as of Dec 2020 updating existing shallow clones is not allowed either.

(This makes the original question about silencing the warning moot).


If a shallow clone is configured, a message containing text like the below will be shown:

Error:
  homebrew-core is a shallow clone.
  homebrew-cask is a shallow clone.
To `brew update`, first run:
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
  git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow

It is now required to perform the unshallow process by running the git command(s) in the error message.

Note: This process may take a long time to complete without providing feedback.


For some details about the motivation for this change, see this discussion on Homebrew’s GitHub page, specifically:

There are two major downsides of shallow cloning:

  1. It places a massive computation burden on GitHub’s servers, which have to dynamically compute a fresh delta between what you have and the latest commit, on every brew update. (With full clones, GitHub can simply send you all the commits that happened after your last pull, and your local Git client takes care of the rest.)
  2. Because of [1], it makes it far more likely that GitHub will rate-limit Homebrew operations, which will make it suck for everyone.

—gromgit Dec 5, 2020, 12:29 AM EST

And also this additional text added to the error message:

This restriction has been made on GitHub’s request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask.

Under the cover Homebrew uses Git for version control, and a shallow clone
is one that doesn’t contain all history revisions/commits, for efficiency and data volume.

Actually, in most cases the warning can be safely ignored, as the formulae being searched for probably isn’t available.

But if you’re really looking for some formulae which might existed in the past, Just do what it suggests:

To get complete history run:

git -C "$(brew --repo homebrew/core)" fetch --unshallow

This way Homebrew could search for formula that existed only in the past but removed at some point.

I would advise against unshallowing the clone because it cramps disk space, makes the lookups slower and enables you only to install obsolete or unmaintaned applications.

There is currently no way to silence this warning. It was proposed in this Github issue but then ignored.

The function deleted_reason which prints the message contains a silent argument but afaik there is no way to use to use something like silent from the CLI commands which later call deleted_reason.

Fetch the repo using the --unshallow flag:

git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow

I have update repo through git pull —unshallow

Update homebrew-core

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git pull --unshallow

Update homebrew-cask

cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask
git pull --unshallow

somehow the unshallow is not working for me, I wait like 10 mins but nothing show up, even with -v option.

Just found one possible solution that might working(at least working for me).

You can remove the repository and clone again to get latest one.

cd /usr/local/Homebrew/Library/Taps/homebrew/
rm -rf homebrew-core
git clone https://github.com/Homebrew/homebrew-core.git

same command for homebrew-cask if you need to update that too

all the credits belong to this answer

At the time of writing this, the logic Homebrew uses for checking if your clone is shallow is by checking if either of /usr/local/Homebrew/Library/Taps/homebrew/homebrew-{cask,core}/.git/shallow exists.

One can work around that check by moving the .git directory out of the repo; example command to do so (run in the Terminal):

for tap in /usr/local/Homebrew/Library/Taps/homebrew/homebrew-{cask,core}; do 
  mv $tap{/,}.git ; 
  echo "gitdir: $tap.git" >$tap/.git ; 
done

Reference: Setting up .git folder in a custom location

Homebrew foundation is unfortunately incredibly hostile towards their community and I wouldn’t be surprised if they patched this soon.

Nonetheless, this is a lifesaver for me and possibly other people in similar situation to mine. However, if your life doesn’t immediately depend on this, perhaps do them a favor and just unshallow.

git -C "$(brew --repo homebrew/core)" fetch --unshallow

This command should run with sudo and it would work.

sudo git -C "$(brew --repo homebrew/core)" fetch --unshallow

Terminal Picture

i dont know if this is the right way but does work
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch —unshallow

wait some minutes. After that you’ll see something like this.

Resolving deltas: 100% (723461/723461), completed with 4329 local objects.
From https://github.com/Homebrew/homebrew-core
4d2aadabe6c..eab34538365 master -> origin/master

then you could paste this again to update Homebrew and that’s it.

/bin/bash -c «$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)»

i’m new coding so i don’t have a exact explenation to this.

You do not need to install or configure anything else to use Python 2. As you can see below, there is already Python 2.7.x version on macOS X.

AnalysisMan:/Users/analysisman% python —version
Python 2.7.16

Now let’s install Python 3.x version.

Step 1. Install Homebrew

Homebrew is an essential package for Mac users. Homebrew allows us to install the latest and updated version of popular applications, packages, and developer tools.

Here is a link to how to install Homebrew on macOS.

Step 2. Install Python3 with a brew command

brew install python3
This will take a minute or two.

AnalysisMan:/Users/analysisman% brew install python3
Error:
homebrew-core is a shallow clone.
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch —unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch —unshallow
This restriction has been made on GitHub’s request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don’t do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for the inconvenience!
Error: [email protected]: no bottle available!
You can try to install from source with e.g.
brew install —build-from-source [email protected]
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew’s GitHub, Twitter or any other
official channels.

If you see the above error, try out the following command.

AnalysisMan:/Users/analysisman% brew install —build-from-source [email protected]

Error:
homebrew-core is a shallow clone.
homebrew-cask is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch —unshallow
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch —unshallow
This restriction has been made on GitHub’s request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don’t do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
==> Downloading https://homebrew.bintray.com/bottles/pkg-config-0.29.2_3.catalina.bottle.tar.gz
==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/80f141e695f73bd058fd82e9f539dc67471666ff6800c5e280b5af7d3050f435?response-
######################################################################## 100.0%

… snipped…

> Downloading https://files.pythonhosted.org/packages/cb/5f/ae1eb8bda1cde4952bd12e468ab8a254c345a0189402bf1421457577f4f3/pip-20.3.1
######################################################################## 100.0%
==> Downloading https://www.python.org/ftp/python/3.9.1/Python-3.9.1.tar.xz
######################################################################## 100.0%
Error: Xcode alone is not sufficient on Catalina.
Install the Command Line Tools:
xcode-select —install

If you get an error as below, install the Xcode by ‘xcode-select —install‘.
Error: Xcode alone is not sufficient on Catalina.

Step 3. Make an alias for Python3 or link by symbolic link

Now you have two Python versions. The default Python 2.7.x and the newly installed Python 3.x.
If you want to make the Python 3.x as default. Here are two options.

Option 1) Alias in your Shell

You can alias the commands in most Shells, Since the default shells in macOS (bash in 10.14 and below; zsh in 10.15). You could put alias python=’python3′ in your ~/.bash_profile, and then source ~/.bash_profile in your ~/.bash_profile or ./.zshrc and source ~/.zshrc.

# bash
vi ~/.bash_profile

# zsh
vi ~/.zshrc

alias python=’python3′

Option 2) Link the python with a symbolic link

unlink /usr/local/bin/python
ln -s /usr/local/bin/python3.9 /usr/local/bin/python

After you did Option 1 or 2, you should be able to see your Python version has changed with the installed version.

AnalysisMan:/Users/analysisman% python —version
Python 3.9.2

Понравилась статья? Поделить с друзьями:
  • Error hid project can only be used with an usb mcu
  • Error hid dll
  • Error help us prevent spam by completing the captcha challenge
  • Error helm upgrade requires 2 arguments
  • Error heater автономка скания не запускается